← MATH 241 MathScape 0 MATH241

Method of Undetermined Coefficients

2 min read

Jump to a section
Reference: Stewart §17.2

Textbook Reference

Primary source OpenStax Calculus Volume 3, Section 7.2: “Nonhomogeneous Linear Equations”
Direct link https://openstax.org/books/calculus-volume-3/pages/7-2-nonhomogeneous-linear-equations
Textbook used in class Stewart, Calculus, Section 17.2: “Nonhomogeneous Linear Equations” (Examples 1-4)

Quick Reference

Trial solution table (for $ay''+by'+cy = g(x)$ with constant $a,b,c$):

$g(x)$ Trial $y_p$
$P_n(x)$ (degree-$n$ polynomial) $A_n x^n + \cdots + A_1 x + A_0$
$e^{kx}$ $A e^{kx}$
$\sin(kx)$ or $\cos(kx)$ $A\cos(kx) + B\sin(kx)$
$e^{kx}\sin(kx)$ or $e^{kx}\cos(kx)$ $e^{kx}(A\cos(kx)+B\sin(kx))$
Product of above Product of corresponding trials

Modification rule: if any term of the trial $y_p$ is a solution of the homogeneous equation, multiply the entire trial by $x$ (or $x^2$ if the root is repeated twice).


Motivation

When the right-hand side $g(x)$ consists of polynomials, exponentials, sines, and cosines (and products thereof), differentiating $g$ repeatedly stays within the same family. A constant-coefficient operator $L = aD^2 + bD + c$ maps exponentials to exponentials, polynomials to polynomials, etc. So it makes sense to guess that $y_p$ belongs to the same family as $g$ and solve for the coefficients.

The method fails if $g(x)$ is something like $\ln x$ or $\sec x$, because those functions spawn new functions under differentiation. For those cases, use variation of parameters.


Worked Example

Find the general solution of $y'' - 4y = e^{3x}$.

Step 1: Solve the homogeneous equation. $r^2 - 4 = 0 \Rightarrow r = \pm 2$. So $y_h = c_1 e^{2x} + c_2 e^{-2x}$.

Step 2: Choose the trial particular solution. $g(x) = e^{3x}$. Trial: $y_p = Ae^{3x}$. $e^{3x}$ does not appear in $y_h$ (which has $e^{2x}$ and $e^{-2x}$), so no modification needed.

Step 3: Substitute and solve for $A$. $y_p' = 3Ae^{3x}$, $y_p'' = 9Ae^{3x}$. $$y_p'' - 4y_p = 9Ae^{3x} - 4Ae^{3x} = 5Ae^{3x} = e^{3x}.$$ $$5A = 1 \Rightarrow A = \tfrac{1}{5}.$$

Step 4: Write the general solution. $$y = c_1 e^{2x} + c_2 e^{-2x} + \frac{1}{5}e^{3x}.$$


Example requiring the modification rule:

Find a particular solution of $y'' - 4y' + 4y = e^{2x}$.

Homogeneous: $r^2 - 4r + 4 = (r-2)^2 = 0 \Rightarrow r = 2$ (repeated). $y_h = (c_1 + c_2 x)e^{2x}$.

Trial: $g(x) = e^{2x}$. Initial trial $Ae^{2x}$, but $e^{2x}$ is in $y_h$ (as $c_1 e^{2x}$). Multiply by $x$: new trial $Axe^{2x}$, but $xe^{2x}$ is also in $y_h$ (as $c_2 x e^{2x}$). Multiply by $x$ again: $y_p = Ax^2 e^{2x}$.

Substitute: $y_p = Ax^2 e^{2x}$, $y_p' = A(2x+2x^2)e^{2x} = A(2x+2x^2)e^{2x}$, $y_p'' = A(2 + 8x + 4x^2)e^{2x}$.

$y_p'' - 4y_p' + 4y_p = A\bigl[(2+8x+4x^2) - 4(2x+2x^2) + 4x^2\bigr]e^{2x} = A[2+8x+4x^2-8x-8x^2+4x^2]e^{2x} = 2Ae^{2x}$.

Setting $2Ae^{2x} = e^{2x}$: $A = \frac{1}{2}$.

$$y_p = \frac{x^2}{2}e^{2x}.$$


Common misconception

the trial for $\sin(kx)$ on the right side is just $A\sin(kx)$. When $g(x)$ involves sine, the trial must include both $\cos(kx)$ and $\sin(kx)$: $y_p = A\cos(kx)+B\sin(kx)$. This is because the operator $L$ maps $\cos(kx)$ to a linear combination of both $\sin$ and $\cos$, so you need both terms to match all the coefficients. Guessing only $A\sin(kx)$ will fail when the cosine terms do not cancel.


Leveled Practice

Problem 1. Find the general solution of $y'' + 3y' + 2y = 3x$.

Show answer

Homogeneous: $r^2+3r+2 = (r+1)(r+2) = 0$, $r = -1,-2$. $y_h = c_1 e^{-x}+c_2 e^{-2x}$.

Trial: $g = 3x$, try $y_p = Ax+B$.

$y_p'' = 0$, $y_p' = A$.

$0 + 3A + 2(Ax+B) = 3x \Rightarrow 2Ax + (3A+2B) = 3x+0$.

$2A = 3 \Rightarrow A = 3/2$; $3A+2B = 0 \Rightarrow B = -9/4$.

$y = c_1 e^{-x}+c_2 e^{-2x} + \frac{3}{2}x - \frac{9}{4}$.


Mastery Checklist


Next: Variation of Parameters