Method of Undetermined Coefficients

The general solution to the linear differential equation `L(y)=phi(x)` is given as `y=y_h+y_p`, where `y_p` denotes one solution to the differential equation and `y_h` is the general solution to the associated homogeneous equation `L(y) = 0`. For the method to obtain `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 `y_p` once `y_h` is known.

The method of undetermined coefficients is applicable only if `phi(x)` and all of its derivatives can be written in terms of the same finite set of linearly independent functions, which we denote by {`y_1(x),\ y_2(x),\ ...,\ y_n(x)`}.
The method is initiated by assuming a particular solution of the form `y_p=A_1 y_1(x)+A_2 y_2(x)+...+A_n y_n(x)`, where `A_1,\ A_2, ...,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. `phi(x)=p_n(x)`, a polynomial of n-th degree. Assume the solution of the form `y_p=A_n x^n+A_(n-1) x^(n-1)+...+Ax+A_0`, where `A_j` (`j=0, 1, ..., n`) are the constants to be determined.

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

Assume that the particular solution is of the form `y_p=Ax^2+Bx+C`.

Then, `y_p'=2Ax+B`, and `y_p''=2A`.

Now, plug these values into the differential equation:

`(2A)+3(2Ax+B)+2(Ax^2+Bx+C)=2Ax^2+(6A+2B)x+(2A+3B+C)`.

Equating the like terms with `x^2+2` gives:

`{(2A=1),(6A+2B=0),(2A+3B+C=2):}`,

Which has the solution `A=1/2,B=-3/2,C=11/4`.

So, the particular solution is `y_p=1/2 x^2-3/2 x+11/4`.

Case 2. `phi(x)=ke^(alpha x)`. Assume the solution of the form `y_p=Ae^(alpha x)`, where `A` is the constant to be determined.

Example 2. Find the particular solution of `y'''-4y'+2y=3e^(7x)`.

Assume that the particular solution is of the form `y_p=Ae^(7x)`.

Then, `y_p'=7Ae^(7x)`, `y_p''=49Ae^(7x)`, and `y_p'''=343Ae^(7x)`.

Plugging these values into the equation gives `343Ae^(7x)-4*7Ae^(7x)+2Ae^(7x)=317Ae^(7x)`.

Equating the coefficients with `3e^(7x)` gives `317A=3`, or `A=3/317`.

So, the particular solution is `y_p=3/317 e^(7x)`.

Case 3. `phi(x)=k_1cos(beta x)+k_2 sin(beta x)`. Assume the solution in the form of `y_p=Acos(beta x)+Bcos(beta x)` (even when either `k_1` or `k_2` equals zero).

Example 3. Solve `y''+y=cos(2x)`.

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

The characteristic equation is `r^2+1=0` that has the roots `r_1=i,\ r_2=-i`; so, the solution of the homogeneous equation (see how to solve a homogeneous equation) is `y_h=c_1 cos(x)+c_2 sin(x)`.

Now, assume that the particular solution is of the form `y_p=Acos(2x)+Bsin(2x)`; then, `y_p'=-2Asin(2x)+2Bcos(2x)`, and `y_p''=-4Acos(2x)-4Bsin(2x)`.

Plugging these values into the equation gives: `-4Acos(2x)-4Bsin(2x)+Acos(2x)+Bsin(2x)=-3Acos(2x)-3Bsin(2x)`.

Equating the like terms with `cos(2x)`, we obtain that

`{(-3A=1),(-3B=0):}`

So, `A=-1/3, B=0`.

Thus, the particular solution is `y_p=-1/3cos(2x)`.

Finally, the general solution is `y=y_h+y_p=c_1 cos(x)+c_2 sin(2x)-1/3 cos(2x)`.

Generalizations. If `phi(x)` 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 `phi(x)=e^(alpha x)p_n(x)sin(beta x)` or `phi(x)=e^(alpha x)p_n(x)cos(beta x)`, assume the particular solution in the form

`y_p=e^(alpha x)(A_n x^n+A_(n-1)x^(n-1)+...+A_1x+A_0)cos(beta x)+`

`+e^(alpha x)(B_n x^n+B_(n-1)x^(n-1)+...+B_1x+B_0)cos(beta x)`, where `A_j` and `B_j` (`j=0, 1, ..., n`) are constants that still need to be determined.

If `phi(x)` is the sum (or difference) of the terms already considered, then we take `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=e^(-x)cos(2x)+x^2`.

Here, `phi(x)` is the sum of two manageable functions: `phi(x)=(e^(-x)cos(2x))+(x^2)`.

So, assume the particular solution in the form of `y_p=(e^(-x)(Acos(2x)+Bsin(2x)))+(Cx^2+Dx+E)`.

Then, `y_p'=-Ae^(-x)cos(2x)-2Ae^(-x)sin(2x)-Be^(-x)sin(2x)+2Be^(-x)cos(2x)+2Cx+D`, and

`y_p''=Ae^(-x)cos(2x)+2Ae^(-x)sin(2x)+2Ae^(-x)sin(2x)-4Ae^(-x)cos(2x)+Be^(-x)sin(2x)-2Be^(-x)cos(2x)-2Be^(-x)cos(2x)-4Be^(-x)sin(2x)+2C`.

Plugging these values into the equation gives:

`Ae^(-x)cos(2x)+2Ae^(-x)sin(2x)+2Ae^(-x)sin(2x)-4Ae^(-x)cos(2x)+Be^(-x)sin(2x)-2Be^(-x)cos(2x)-2Be^(-x)cos(2x)-4Be^(-x)sin(2x)+2C+e^(-x)(Acos(2x)+Bsin(2x))+Cx^2+Dx+E=(A-4A-2B-2B+A)e^(-x)cos(2x)+(2A+2A+B-4B+B)e^(-x)sin(2x)+Cx^2+Dx+(2C+E)=(-2A-4B)e^(-x)cos(2x)+(4A-2B)e^(-x)sin(2x)+Cx^2+Dx+(2C+E)`

Equating the like terms with `e^(-x)cos(2x)+x^2`, we obtain that

`{(-2A-4B=1),(4A-2B=0),(C=1),(D=0),(2C+E=0):}`

This system has the following solution: `A=-1/10, B=-1/5, C=1, D=0,E=-2`; so, the particular solution is

`y_p=-1/10 e^(-x)cos(2x)-1/5 e^(-x)sin(2x)+x^2-2`.

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

Example 5. Find the particular solution of `y''+y=cos(x)`.

As already known from example 3, the homogeneous solution is `y_h=c_1cos(x)+c_2sin(x)`.

We can't take the particular solution to be `Acos(x)+Bsin(x)` because its terms are parts of the homogeneous solution; so, let

`y_p=Axcos(x)+Bxsin(x)`.

Then, `y_p'=Acos(x)-Axsin(x)+Bsin(x)+Bxcos(x)`, and `y_p''=-Asin(x)-Asin(x)-Axcos(x)+Bcos(x)+Bcos(x)-Bxsin(x)`.

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)`.

Equating the like terms with `cos(x)`, we obtain that

`{(-2A=0),(2B=1):}`

The solution is `A=0, B=1/2`.

So, the particular solution is `y_p=1/2 xsin(x)`.

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

Example 6. Solve `y''-2y'+y=e^(x)`.

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

The characteristic equation is `r^2-2r+1=0` or `(r-1)^2=0` that has the roots `r_1=1, r_2=1`.

There is one root of the multiplicity 2; so, the solution is `y_h=c_1e^x+c_2 xe^x`.

Now, what will be the particular solution? It isn't `e^x` because `e^x` is already in the solution, it is not `xe^x` either. The lowest number `m` for which `x^me^x` is not in the solution is `m=2`: `x^2 e^x`.

So, let `y_p=Ax^2e^x`.

Then, `y_p'=2Axe^x+Ax^2e^x=Ae^x (x^2+2x)`, and `y_p''=2Ae^x+2Axe^x+2Axe^x+Ax^2e^x=Ae^x (x^2+4x+2)`.

Plugging the obtained values into equation, we have

`Ae^x(x^2+4x+2)-2Ae^x(x^2+2x)+Ax^2 e^x=e^x`

`2Ae^x=e^x`

Equating the like terms with `e^x` gives `2A=1`, or `A=1/2`.

So, the particular soltuion is `y_p=1/2 x^2e^x`.

Finally, the general solution is `y=y_h+y_p=c_1e^x+c_2xe^x+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 `phi(x)` 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)` cannot be found with the method of undetermined coefficients.