Method of Undetermined Coefficients

The general solution to the linear differential equation L(y)=ϕ(x){L}{\left({y}\right)}=\phi{\left({x}\right)} is given as y=yh+yp{y}={y}_{{h}}+{y}_{{p}}, where yp{y}_{{p}} denotes one solution to the differential equation and yh{y}_{{h}} is the general solution to the associated homogeneous equation L(y)=0{L}{\left({y}\right)}={0}. For the method to obtain yh{y}_{{h}} when the differential equation has constant coefficients, see the method of solutions note.
Here, one method will be given for obtaining the particular solution yp{y}_{{p}} once yh{y}_{{h}} is known.

The method of undetermined coefficients is applicable only if ϕ(x)\phi{\left({x}\right)} and all of its derivatives can be written in terms of the same finite set of linearly independent functions, which we denote by {y1(x), y2(x), , yn(x){y}_{{1}}{\left({x}\right)},\ {y}_{{2}}{\left({x}\right)},\ \ldots,\ {y}_{{n}}{\left({x}\right)}}.
The method is initiated by assuming a particular solution of the form yp=A1y1(x)+A2y2(x)++Anyn(x){y}_{{p}}={A}_{{1}}{y}_{{1}}{\left({x}\right)}+{A}_{{2}}{y}_{{2}}{\left({x}\right)}+\ldots+{A}_{{n}}{y}_{{n}}{\left({x}\right)}, where A1, A2,,An{A}_{{1}},\ {A}_{{2}},\ldots,{A}_{{n}} denote arbitrary multiplicative constants. These arbitrary constants are then evaluated by substituting the proposed solution into the given differential equation and equating the coefficients of the like terms.

Case 1. ϕ(x)=pn(x)\phi{\left({x}\right)}={p}_{{n}}{\left({x}\right)}, a polynomial of n-th degree. Assume the solution of the form yp=Anxn+An1xn1++Ax+A0{y}_{{p}}={A}_{{n}}{{x}}^{{n}}+{A}_{{{n}-{1}}}{{x}}^{{{n}-{1}}}+\ldots+{A}{x}+{A}_{{0}}, where Aj,j=0,1,,n{A}_{{j}}, j=0,{1},\ldots,n are the constants to be determined.

Example 1. Find the particular solution of y+3y+2y=x2+2{y}''+{3}{y}'+{2}{y}={{x}}^{{2}}+{2}.

Assume that the particular solution is of the form yp=Ax2+Bx+C{y}_{{p}}={A}{{x}}^{{2}}+{B}{x}+{C}.

Then, yp=2Ax+B{y}_{{p}}'={2}{A}{x}+{B}, and yp=2A{y}_{{p}}''={2}{A}.

Now, plug these values into the differential equation:

(2A)+3(2Ax+B)+2(Ax2+Bx+C)=2Ax2+(6A+2B)x+(2A+3B+C){\left({2}{A}\right)}+{3}{\left({2}{A}{x}+{B}\right)}+{2}{\left({A}{{x}}^{{2}}+{B}{x}+{C}\right)}={2}{A}{{x}}^{{2}}+{\left({6}{A}+{2}{B}\right)}{x}+{\left({2}{A}+{3}{B}+{C}\right)}.

Equating the like terms with x2+2{{x}}^{{2}}+{2} gives:

{2A=16A+2B=02A+3B+C=2{\left\{\begin{array}{c}{2}{A}={1}\\{6}{A}+{2}{B}={0}\\{2}{A}+{3}{B}+{C}={2}\\ \end{array}\right.},

Which has the solution A=12,B=32,C=114{A}=\frac{{1}}{{2}},{B}=-\frac{{3}}{{2}},{C}=\frac{{11}}{{4}}.

So, the particular solution is yp=12x232x+114{y}_{{p}}=\frac{{1}}{{2}}{{x}}^{{2}}-\frac{{3}}{{2}}{x}+\frac{{11}}{{4}}.

Case 2. ϕ(x)=keαx\phi{\left({x}\right)}={k}{{e}}^{{\alpha{x}}}. Assume the solution of the form yp=Aeαx{y}_{{p}}={A}{{e}}^{{\alpha{x}}}, where A{A} is the constant to be determined.

Example 2. Find the particular solution of y4y+2y=3e7x{y}'''-{4}{y}'+{2}{y}={3}{{e}}^{{{7}{x}}}.

Assume that the particular solution is of the form yp=Ae7x{y}_{{p}}={A}{{e}}^{{{7}{x}}}.

Then, yp=7Ae7x{y}_{{p}}'={7}{A}{{e}}^{{{7}{x}}}, yp=49Ae7x{y}_{{p}}''={49}{A}{{e}}^{{{7}{x}}}, and yp=343Ae7x{y}_{{p}}'''={343}{A}{{e}}^{{{7}{x}}}.

Plugging these values into the equation gives 343Ae7x47Ae7x+2Ae7x=317Ae7x{343}{A}{{e}}^{{{7}{x}}}-{4}\cdot{7}{A}{{e}}^{{{7}{x}}}+{2}{A}{{e}}^{{{7}{x}}}={317}{A}{{e}}^{{{7}{x}}}.

Equating the coefficients with 3e7x{3}{{e}}^{{{7}{x}}} gives 317A=3{317}{A}={3}, or A=3317{A}=\frac{{3}}{{317}}.

So, the particular solution is yp=3317e7x{y}_{{p}}=\frac{{3}}{{317}}{{e}}^{{{7}{x}}}.

Case 3. ϕ(x)=k1cos(βx)+k2sin(βx)\phi{\left({x}\right)}={k}_{{1}}{\cos{{\left(\beta{x}\right)}}}+{k}_{{2}}{\sin{{\left(\beta{x}\right)}}}. Assume the solution in the form of yp=Acos(βx)+Bcos(βx){y}_{{p}}={A}{\cos{{\left(\beta{x}\right)}}}+{B}{\cos{{\left(\beta{x}\right)}}} (even when either k1{k}_{{1}} or k2{k}_{{2}} equals zero).

Example 3. Solve y+y=cos(2x){y}''+{y}={\cos{{\left({2}{x}\right)}}}.

We are asked to solve the equation, so we should first detemine the solution of the homogeneous equation y+y=0{y}''+{y}={0}.

The characteristic equation is r2+1=0{{r}}^{{2}}+{1}={0} that has the roots r1=i, r2=i{r}_{{1}}={i},\ {r}_{{2}}=-{i}; so, the solution of the homogeneous equation (see how to solve a homogeneous equation) is yh=c1cos(x)+c2sin(x){y}_{{h}}={c}_{{1}}{\cos{{\left({x}\right)}}}+{c}_{{2}}{\sin{{\left({x}\right)}}}.

Now, assume that the particular solution is of the form yp=Acos(2x)+Bsin(2x){y}_{{p}}={A}{\cos{{\left({2}{x}\right)}}}+{B}{\sin{{\left({2}{x}\right)}}}; then, yp=2Asin(2x)+2Bcos(2x){y}_{{p}}'=-{2}{A}{\sin{{\left({2}{x}\right)}}}+{2}{B}{\cos{{\left({2}{x}\right)}}}, and yp=4Acos(2x)4Bsin(2x){y}_{{p}}''=-{4}{A}{\cos{{\left({2}{x}\right)}}}-{4}{B}{\sin{{\left({2}{x}\right)}}}.

Plugging these values into the equation gives: 4Acos(2x)4Bsin(2x)+Acos(2x)+Bsin(2x)=3Acos(2x)3Bsin(2x)-{4}{A}{\cos{{\left({2}{x}\right)}}}-{4}{B}{\sin{{\left({2}{x}\right)}}}+{A}{\cos{{\left({2}{x}\right)}}}+{B}{\sin{{\left({2}{x}\right)}}}=-{3}{A}{\cos{{\left({2}{x}\right)}}}-{3}{B}{\sin{{\left({2}{x}\right)}}}.

Equating the like terms with cos(2x){\cos{{\left({2}{x}\right)}}}, we obtain that

{3A=13B=0{\left\{\begin{array}{c}-{3}{A}={1}\\-{3}{B}={0}\\ \end{array}\right.}

So, A=13,B=0{A}=-\frac{{1}}{{3}},{B}={0}.

Thus, the particular solution is yp=13cos(2x){y}_{{p}}=-\frac{{1}}{{3}}{\cos{{\left({2}{x}\right)}}}.

Finally, the general solution is y=yh+yp=c1cos(x)+c2sin(2x)13cos(2x){y}={y}_{{h}}+{y}_{{p}}={c}_{{1}}{\cos{{\left({x}\right)}}}+{c}_{{2}}{\sin{{\left({2}{x}\right)}}}-\frac{{1}}{{3}}{\cos{{\left({2}{x}\right)}}}.

Generalizations. If ϕ(x)\phi{\left({x}\right)} is the product of functions from the above cases, assume the particular solution to be the product of the assumed solutions of the corresponding cases. For example, if ϕ(x)=eαxpn(x)sin(βx)\phi{\left({x}\right)}={{e}}^{{\alpha{x}}}{p}_{{n}}{\left({x}\right)}{\sin{{\left(\beta{x}\right)}}} or ϕ(x)=eαxpn(x)cos(βx)\phi{\left({x}\right)}={{e}}^{{\alpha{x}}}{p}_{{n}}{\left({x}\right)}{\cos{{\left(\beta{x}\right)}}}, assume the particular solution in the form

yp=eαx(Anxn+An1xn1++A1x+A0)cos(βx)+{y}_{{p}}={{e}}^{{\alpha{x}}}{\left({A}_{{n}}{{x}}^{{n}}+{A}_{{{n}-{1}}}{{x}}^{{{n}-{1}}}+\ldots+{A}_{{1}}{x}+{A}_{{0}}\right)}{\cos{{\left(\beta{x}\right)}}}+

+eαx(Bnxn+Bn1xn1++B1x+B0)cos(βx)+{{e}}^{{\alpha{x}}}{\left({B}_{{n}}{{x}}^{{n}}+{B}_{{{n}-{1}}}{{x}}^{{{n}-{1}}}+\ldots+{B}_{{1}}{x}+{B}_{{0}}\right)}{\cos{{\left(\beta{x}\right)}}}, where Aj{A}_{{j}} and Bj,j=0,1,,n{B}_{{j}},j=0,1,\ldots,n are constants that still need to be determined.

If ϕ(x)\phi{\left({x}\right)} is the sum (or difference) of the terms already considered, then we take yp{y}_{{p}} to be the sum (or difference) of the corresponding assumed solutions and algebraically combine the arbitrary constants where possible.

Example 4. Find the particular solution of y+y=excos(2x)+x2{y}''+{y}={{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{{x}}^{{2}}.

Here, ϕ(x)\phi{\left({x}\right)} is the sum of two manageable functions: ϕ(x)=(excos(2x))+(x2)\phi{\left({x}\right)}={\left({{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}\right)}+{\left({{x}}^{{2}}\right)}.

So, assume the particular solution in the form of yp=(ex(Acos(2x)+Bsin(2x)))+(Cx2+Dx+E){y}_{{p}}={\left({{e}}^{{-{x}}}{\left({A}{\cos{{\left({2}{x}\right)}}}+{B}{\sin{{\left({2}{x}\right)}}}\right)}\right)}+{\left({C}{{x}}^{{2}}+{D}{x}+{E}\right)}.

Then, yp=Aexcos(2x)2Aexsin(2x)Bexsin(2x)+2Bexcos(2x)+2Cx+D{y}_{{p}}'=-{A}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}-{2}{A}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}-{B}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{2}{B}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{2}{C}{x}+{D}, and

yp=Aexcos(2x)+2Aexsin(2x)+2Aexsin(2x)4Aexcos(2x)+Bexsin(2x)2Bexcos(2x)2Bexcos(2x)4Bexsin(2x)+2C{y}_{{p}}''={A}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{2}{A}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{2}{A}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}-{4}{A}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{B}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}-{2}{B}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}-{2}{B}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}-{4}{B}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{2}{C}.

Plugging these values into the equation gives:

Aexcos(2x)+2Aexsin(2x)+2Aexsin(2x)4Aexcos(2x)+Bexsin(2x)2Bexcos(2x)2Bexcos(2x)4Bexsin(2x)+2C+ex(Acos(2x)+Bsin(2x))+Cx2+Dx+E=(A4A2B2B+A)excos(2x)+(2A+2A+B4B+B)exsin(2x)+Cx2+Dx+(2C+E)=(2A4B)excos(2x)+(4A2B)exsin(2x)+Cx2+Dx+(2C+E){A}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{2}{A}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{2}{A}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}-{4}{A}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{B}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}-{2}{B}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}-{2}{B}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}-{4}{B}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{2}{C}+{{e}}^{{-{x}}}{\left({A}{\cos{{\left({2}{x}\right)}}}+{B}{\sin{{\left({2}{x}\right)}}}\right)}+{C}{{x}}^{{2}}+{D}{x}+{E}={\left({A}-{4}{A}-{2}{B}-{2}{B}+{A}\right)}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{\left({2}{A}+{2}{A}+{B}-{4}{B}+{B}\right)}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{C}{{x}}^{{2}}+{D}{x}+{\left({2}{C}+{E}\right)}={\left(-{2}{A}-{4}{B}\right)}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{\left({4}{A}-{2}{B}\right)}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{C}{{x}}^{{2}}+{D}{x}+{\left({2}{C}+{E}\right)}

Equating the like terms with excos(2x)+x2{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}+{{x}}^{{2}}, we obtain that

{2A4B=14A2B=0C=1D=02C+E=0{\left\{\begin{array}{c}-{2}{A}-{4}{B}={1}\\{4}{A}-{2}{B}={0}\\{C}={1}\\{D}={0}\\{2}{C}+{E}={0}\\ \end{array}\right.}

This system has the following solution: A=110,B=15,C=1,D=0,E=2{A}=-\frac{{1}}{{10}},{B}=-\frac{{1}}{{5}},{C}={1},{D}={0},{E}=-{2}; so, the particular solution is

yp=110excos(2x)15exsin(2x)+x22{y}_{{p}}=-\frac{{1}}{{10}}{{e}}^{{-{x}}}{\cos{{\left({2}{x}\right)}}}-\frac{{1}}{{5}}{{e}}^{{-{x}}}{\sin{{\left({2}{x}\right)}}}+{{x}}^{{2}}-{2}.

If any term of the assumed solution, disregarding the multiplicative constants, is also a term of yh{y}_{{h}} (the homogeneous solution), the assumed solution has to be modified by multiplying it by xm{{x}}^{{m}}, where m{m} is the smallest positive integer such that the product of xm{x}_{{m}} with the assumed solution has no terms in common with yh{y}_{{h}}.

Example 5. Find the particular solution of y+y=cos(x){y}''+{y}={\cos{{\left({x}\right)}}}.

As already known from example 3, the homogeneous solution is yh=c1cos(x)+c2sin(x){y}_{{h}}={c}_{{1}}{\cos{{\left({x}\right)}}}+{c}_{{2}}{\sin{{\left({x}\right)}}}.

We can't take the particular solution to be Acos(x)+Bsin(x){A}{\cos{{\left({x}\right)}}}+{B}{\sin{{\left({x}\right)}}} because its terms are parts of the homogeneous solution; so, let

yp=Axcos(x)+Bxsin(x){y}_{{p}}={A}{x}{\cos{{\left({x}\right)}}}+{B}{x}{\sin{{\left({x}\right)}}}.

Then, yp=Acos(x)Axsin(x)+Bsin(x)+Bxcos(x){y}_{{p}}'={A}{\cos{{\left({x}\right)}}}-{A}{x}{\sin{{\left({x}\right)}}}+{B}{\sin{{\left({x}\right)}}}+{B}{x}{\cos{{\left({x}\right)}}}, and yp=Asin(x)Asin(x)Axcos(x)+Bcos(x)+Bcos(x)Bxsin(x){y}_{{p}}''=-{A}{\sin{{\left({x}\right)}}}-{A}{\sin{{\left({x}\right)}}}-{A}{x}{\cos{{\left({x}\right)}}}+{B}{\cos{{\left({x}\right)}}}+{B}{\cos{{\left({x}\right)}}}-{B}{x}{\sin{{\left({x}\right)}}}.

Plugging these values into the equation gives:

Asin(x)Asin(x)Axcos(x)+Bcos(x)+Bcos(x)Bxsin(x)+Axcos(x)+Bxsin(x)=2Asin(x)+2Bcos(x)-{A}{\sin{{\left({x}\right)}}}-{A}{\sin{{\left({x}\right)}}}-{A}{x}{\cos{{\left({x}\right)}}}+{B}{\cos{{\left({x}\right)}}}+{B}{\cos{{\left({x}\right)}}}-{B}{x}{\sin{{\left({x}\right)}}}+{A}{x}{\cos{{\left({x}\right)}}}+{B}{x}{\sin{{\left({x}\right)}}}=-{2}{A}{\sin{{\left({x}\right)}}}+{2}{B}{\cos{{\left({x}\right)}}}.

Equating the like terms with cos(x){\cos{{\left({x}\right)}}}, we obtain that

{2A=02B=1{\left\{\begin{array}{c}-{2}{A}={0}\\{2}{B}={1}\\ \end{array}\right.}

The solution is A=0,B=12{A}={0},{B}=\frac{{1}}{{2}}.

So, the particular solution is yp=12xsin(x){y}_{{p}}=\frac{{1}}{{2}}{x}{\sin{{\left({x}\right)}}}.

Now, let's take a look at another example.

Example 6. Solve y2y+y=ex{y}''-{2}{y}'+{y}={{e}}^{{{x}}}.

First, find the solution of the corresponding homogeneous equation y2y+y=0{y}''-{2}{y}'+{y}={0}.

The characteristic equation is r22r+1=0{{r}}^{{2}}-{2}{r}+{1}={0} or (r1)2=0{{\left({r}-{1}\right)}}^{{2}}={0} that has the roots r1=1,r2=1{r}_{{1}}={1},{r}_{{2}}={1}.

There is one root of the multiplicity 2; so, the solution is yh=c1ex+c2xex{y}_{{h}}={c}_{{1}}{{e}}^{{x}}+{c}_{{2}}{x}{{e}}^{{x}}.

Now, what will be the particular solution? It isn't ex{{e}}^{{x}} because ex{{e}}^{{x}} is already in the solution, it is not xex{x}{{e}}^{{x}} either. The lowest number m{m} for which xmex{{x}}^{{m}}{{e}}^{{x}} is not in the solution is m=2{m}={2}: x2ex{{x}}^{{2}}{{e}}^{{x}}.

So, let yp=Ax2ex{y}_{{p}}={A}{{x}}^{{2}}{{e}}^{{x}}.

Then, yp=2Axex+Ax2ex=Aex(x2+2x){y}_{{p}}'={2}{A}{x}{{e}}^{{x}}+{A}{{x}}^{{2}}{{e}}^{{x}}={A}{{e}}^{{x}}{\left({{x}}^{{2}}+{2}{x}\right)}, and yp=2Aex+2Axex+2Axex+Ax2ex=Aex(x2+4x+2){y}_{{p}}''={2}{A}{{e}}^{{x}}+{2}{A}{x}{{e}}^{{x}}+{2}{A}{x}{{e}}^{{x}}+{A}{{x}}^{{2}}{{e}}^{{x}}={A}{{e}}^{{x}}{\left({{x}}^{{2}}+{4}{x}+{2}\right)}.

Plugging the obtained values into equation, we have

Aex(x2+4x+2)2Aex(x2+2x)+Ax2ex=ex{A}{{e}}^{{x}}{\left({{x}}^{{2}}+{4}{x}+{2}\right)}-{2}{A}{{e}}^{{x}}{\left({{x}}^{{2}}+{2}{x}\right)}+{A}{{x}}^{{2}}{{e}}^{{x}}={{e}}^{{x}}

2Aex=ex{2}{A}{{e}}^{{x}}={{e}}^{{x}}

Equating the like terms with ex{{e}}^{{x}} gives 2A=1{2}{A}={1}, or A=12{A}=\frac{{1}}{{2}}.

So, the particular soltuion is yp=12x2ex{y}_{{p}}=\frac{{1}}{{2}}{{x}}^{{2}}{{e}}^{{x}}.

Finally, the general solution is y=yh+yp=c1ex+c2xex+12x2ex{y}={y}_{{h}}+{y}_{{p}}={c}_{{1}}{{e}}^{{x}}+{c}_{{2}}{x}{{e}}^{{x}}+\frac{{1}}{{2}}{{x}}^{{2}}{{e}}^{{x}}.

As can be seen, the method of undetermined coefficients requires many calculations and solving a system of linear equations. So, it is time-consuming.

In general, if ϕ(x)\phi{\left({x}\right)} is not one of the types of functions considered above or if the differential equation does not have constant coefficients, the method of undetermined coefficients is unapplicable. For example, the particular solution to the equation y+y=cos(x)sin(x){y}''+{y}=\frac{{{\cos{{\left({x}\right)}}}}}{{\sin{{\left({x}\right)}}}} cannot be found with the method of undetermined coefficients.