Skip to main content

Section 13.2 The Method of Undetermined Coefficients

We return now to the problem of finding solutions to non-homogeneous second order linear DEs with constant coefficients, i.e. to DEs of the form

\begin{equation*} ay''+by'+cy=f(x) \end{equation*}

Since we don't have any alternative method (such as using an integrating factor) for finding a solution to this class of DE we are forced to use the method suggested by the previous section.

Definition 13.2.1.

The general solution to the non-homogeneous second order linear DE with constant coefficients

\begin{equation*} ay''+by'+cy=f(x) \end{equation*}

is

\begin{equation*} y(x)=y_c(x)+y_p(x) \end{equation*}

where \(y_c(x)\text{,}\) the complementary solution, is the general solution to the associated homogeneous DE

\begin{equation*} ay''+by'+cy=0 \end{equation*}

and \(y_p(x)\) is any particular solution to non-homogeneous DE.

It is easy to show that \(y(x)=y_c(x)+y_p(x)\) is a solution to the non-homogeneous DE but how do we know that we have found all such solutions, i.e. that we have found the general solution? (After all, \(y_p(x)\) is just one particular solution.) Let \(\phi(x)\) be any solution to the DE

\begin{equation*} ay''+by'+cy=f(x) \end{equation*}

Then the function \(g(x)=\phi(x)-y_p(x)\) is a solution to the homogeneous DE

\begin{equation*} ay''+by'+cy=0 \end{equation*}

since

\begin{align*} ag''+bg'+cg \amp = a(\phi''-y_p'')+b(\phi'-y_p')+c(\phi-y_p)\\ \amp = (a\phi''+b\phi'+c\phi)-(ay_p''+by_p'+cy_p)\\ \amp = f(x)-f(x)\\ \amp =0 \end{align*}

Now since \(y_c(x)\) is the general solution to the homogeneous DE, \(g(x)\) must be one of the solutions in \(y_c(x)\text{.}\) Thus \(\phi(x)=g(x)+y_p(x)\) must be one of the solutions in \(y(x)=y_c(x)+y_p(x)\text{,}\) or to put it the other way, \(y(x)=y_c(x)+y_p(x)\) contains all solutions to the non-homogeneous DE.

Thus to solve a non-homogeneous second order DE with constant coefficients we have to first find the complementary solution, then find any particular solution and then add these solutions together. We already know how to find the complementary solution (see Chapter 12) so all that remains is to work out how to find a particular solution, \(y_p\text{.}\) The method of undetermined coefficients tries to find \(y_p\) by guessing that the form that \(y_p\) should take is a linear combination of the non-homogeneous term, \(f(x)\text{,}\) and its derivatives.

Find a particular solution to the DE

\begin{equation*} y''+2y'-3y=4x^2 \end{equation*}
Answer.

\(y_p(x)=-\dfrac{4}{3}x^2-\dfrac{16}{9}x-\dfrac{56}{27}\)

Solution.

Here the non-homogeneous term is \(f(x)=4x^2\text{.}\) This is a 2nd degree polynomial. The first and second derivatives of this will be a linear polynomial and a constant respectively. Thus we guess that a particular solution can found of the form

\begin{equation} y_p(x)=Ax^2+Bx+C\label{DEs_5_Example_4_1}\tag{13.2.1} \end{equation}

where \(A\text{,}\) \(B\) and \(C\) are coefficients to be determined by substituting into the DE. Now, from (13.2.1)

\begin{equation*} y_p'=2Ax+B \end{equation*}
\begin{equation*} y_p''=2A \end{equation*}

Substituting into the DE gives

\begin{align*} y_p''+2y_p'-3y_p \amp = 4x^2\\ (2A)+2(2Ax+B)-3(Ax^2+Bx+C)\amp = 4x^2\\ (-3A)x^2+(4A-3B)x+(2A+2B-3C)\amp = 4x^2 \end{align*}

Thus for \(y_p\) to be a solution

\begin{align*} -3A \amp = 4\\ 4A-3B \amp = 0\\ 2A+2B-3C \amp = 0 \end{align*}

Solving these equations gives

\begin{equation*} A=-\frac{4}{3}, \hspace{5mm} B=-\frac{16}{9}, \hspace{5mm} C=-\frac{56}{27} \end{equation*}

Thus a particular solution to the DE is

\begin{equation*} y_p(x)=-\frac{4}{3}x^2-\frac{16}{9}x-\frac{56}{27} \end{equation*}

The method of undetermined coefficients is only useful for finding the particular solution when the non-homogeneous term is fairly simple. Table 13.2.3 gives a guide to the form of the particular solution, \(y_p\text{,}\) to try for various non-homogeneous terms \(f\text{.}\)

Table 13.2.3.
Non-Homogenous Term Form of Particular Solution
\(f(x)=ae^{kx}\) \(y_p(x)=Ce^{kx}\)
\(f(x)=a\sin(kx)\) \(y_p(x)=C_1\sin(kx)+C_2\cos(kx)\)
\(f(x)=a\cos(kx)\) \(y_p(x)=C_1\sin(kx)+C_2\cos(kx)\)
\(f(x)=\sum_{i=0}^{n} a_{n-i}x^{n-i}\) \(y_p(x)=\sum_{i=0}^{n} C_{n-i}x^{n-i}\)
\(f(x)\) \(y_p(x)\) is a linear combination of \(f(x)\) and its derivatives, i.e. \(y_p(x)=\sum_{k=0} C_kf^{(k)}(x)\)

Find the general solution to

\begin{equation*} x''+6x'+8x=8\sin(2t) \end{equation*}
Answer.

\(x(t)=Ae^{-2t}+Be^{-4t}+\dfrac{1}{5}\sin(2t)-\dfrac{3}{5}\cos(2t)\)

Solution.

The first step is to find the general solution to the homogeneous DE

\begin{equation*} x''+6x'+8x=0 \end{equation*}

The characteristic equation for this DE is

\begin{equation*} r^2+6r+8=0 \end{equation*}

which has solutions

\begin{equation*} r=-2, -4 \end{equation*}

Thus the complementary solution is

\begin{equation*} x_c(t)=Ae^{-2t}+Be^{-4t} \end{equation*}

The next step is to find a particular solution to the non-homogeneous DE. Using the method of undetermined coefficients we try a particular solution of the form

\begin{equation*} x_p(t)=C_1\sin(2t)+C_2\cos(2t) \end{equation*}

where \(C_1\) and \(C_2\) are the coefficients to be determined. Now

\begin{align*} x_p'(t) \amp = 2C_1\cos(2t)-2C_2\sin(2t)\\ x_p''(t) \amp = -4C_1\sin(2t)-4C_2\cos(2t) \end{align*}

For \(x_p(t)\) to be a solution

\begin{equation*} x_p''+6x_p'+8x_p=8\sin(2t) \end{equation*}

and so, on substituting

\begin{equation*} (-4C_1\sin(2t)-4C_2\cos(2t))+6(2C_1\cos(2t)-2C_2\sin(2t))+8(C_1\sin(2t)+C_2\cos(2t)) = 8\sin(2t) \end{equation*}

which simplifies to

\begin{equation*} (4C_1-12C_2)\sin(2t)+(12C_1+4C_2)\cos(2t) = 8\sin(2t) \end{equation*}

Equating coefficients on each side of the equation gives

\begin{align*} 4C_1-12C_2 \amp = 8\\ 12C_1+4C_2 \amp = 0 \end{align*}

Solving these equations gives

\begin{equation*} C_1=\frac{1}{5}, \hspace{5mm} C_2=-\frac{3}{5} \end{equation*}

and so a particular solution is

\begin{equation*} x_p(t)=\frac{1}{5}\sin(2t)-\frac{3}{5}\cos(2t) \end{equation*}

Combining the particular solution with the complementary solution gives the general solution

\begin{equation*} x(t)=Ae^{-2t}+Be^{-4t}+\frac{1}{5}\sin(2t)-\frac{3}{5}\cos(2t) \end{equation*}

Solve the initial-value problem

\begin{equation*} y''+3y'=5e^{2x} \end{equation*}
\begin{equation*} y(0)=1,\hspace{5mm} y'(0)=-2 \end{equation*}
Answer.

\(y(x)=e^{-3x}+\dfrac{1}{2}e^{2x}-\dfrac{1}{2}\)

Solution.

To solve the initial-value problem we have to begin by finding the general solution to the DE. Since this DE is a non-homogeneous second order DE with constant coefficients we have to first find the general solution to the associated homogeneous DE

\begin{equation*} y''+3y'=0 \end{equation*}

The characteristic equation for this DE is

\begin{equation*} r^2+3r=0 \end{equation*}

which has solutions

\begin{equation*} r=0, -3 \end{equation*}

Thus the complementary solution is

\begin{equation*} y_c(x)=A+Be^{-3x} \end{equation*}

For the particular solution try a function of the form

\begin{equation*} y_p(x)=Ce^{2x} \end{equation*}

Then

\begin{align*} y_p'(x) \amp =2Ce^{2x}\\ y_p''(x) \amp=4Ce^{2x} \end{align*}

For this to be a solution

\begin{equation*} y_p''+3y_p'=5e^{2x} \end{equation*}

and so

\begin{align*} 4Ce^{2x}+3(2Ce^{2x}) \amp =5e^{2x}\\ 10Ce^{2x} \amp=5e^{2x} \end{align*}

On equating coefficients on both sides of this equation

\begin{equation*} 10C=5\Rightarrow C=\frac{1}{2} \end{equation*}

Combining the complementary solution and this particular solution gives the general solution as

\begin{equation*} y(x)=A+Be^{-3x}+\frac{1}{2}e^{2x} \end{equation*}

On using the initial condition \(y(0)=1\) we find

\begin{equation*} A+B=\frac{1}{2} \end{equation*}

Since

\begin{equation*} y'(x)=-3Be^{-3x}+e^{2x} \end{equation*}

on using the initial condition \(y'(0)=2\) we find

\begin{equation*} B=1 \end{equation*}

Thus \(A=-\frac{1}{2}, B=1\) and the solution to the initial-value problem is

\begin{equation*} y(x)=e^{-3x}+\frac{1}{2}e^{2x}-\frac{1}{2} \end{equation*}

If the non-homogeneous term \(f\) is itself a solution to the associated homogeneous DE then the form that we guess for the particular solution has to change. Guided by our experience from non-homogeneous first order constant coefficient DEs (see Example 13.1.3) what we try for the particular solution is to multiply the usual form by \(x\) (or \(x^2\text{,}\) \(x^3\) etc. if necessary) so that no term in the particular solution is itself a solution to the homogeneous DE.

Find the general solution to

\begin{equation*} \frac{d^2u}{dt^2}+\frac{du}{dt}-2u=e^t \end{equation*}
Answer.

\(u(t)=Ae^t+Be^{-2t}+\dfrac{1}{3}te^t\)

Solution.

The general solution to the associated homogeneous DE, i.e.

\begin{equation*} \frac{d^2u}{dt^2}+\frac{du}{dt}-2u=0 \end{equation*}

is the complementary solution to the given DE. Thus

\begin{equation*} u_c(t)=Ae^t+Be^{-2t} \end{equation*}

We can see here that the non-homogeneous term \(f(x)=e^x\) is a solution to the homogeneous DE (put \(A=1\) and \(B=0\) into \(u_c(t)\)). Obviously then, trying a particular solution of the form

\begin{equation*} u_p(t)=Ce^t \end{equation*}

will not work. Thus we try instead a solution of the form

\begin{equation*} u_p(t)=Cte^t \end{equation*}

For this function, using the product rule

\begin{equation*} \frac{du_p}{dt}=Cte^t+Ce^t \end{equation*}

and

\begin{equation*} \frac{d^2u_p}{dt^2}=Cte^t+2Ce^t \end{equation*}

Substituting into the DE gives

\begin{align*} (Cte^t+2Ce^t)+(Cte^t+Ce^t)-2(Cte^t) \amp =e^t\\ 3Ce^t \amp =e^t \end{align*}

Notice that the \(te^t\) terms will cancel out and so on equating the coefficients of the \(e^t\) terms gives

\begin{equation*} C=\frac{1}{3} \end{equation*}

Thus, a particular solution is

\begin{equation*} u_p(t)=\frac{1}{3}te^t \end{equation*}

and hence the general solution is

\begin{equation*} u(t)=Ae^t+Be^{-2t}+\frac{1}{3}te^t \end{equation*}

Solve the initial-value problem

\begin{equation*} y''+y'=x \end{equation*}
\begin{equation*} y(0)=1,\hspace{5mm} y'(0)=1 \end{equation*}
Answer.

\(y(x)=3-2e^{-x}+\dfrac{1}{2}x^2-x\)

Solution.

The associated homogeneous DE is

\begin{equation*} y''+y'=0 \end{equation*}

Thus the complementary solution is

\begin{equation*} y_c(x)=Ae^{-x}+B \end{equation*}

Since the non-homogeneous term is \(f(x)=x\) the usual form that we would try for the particular solution would be

\begin{equation*} y_p(x)=C_1x+C_2 \end{equation*}

However this contains a constant term and we can see from the complementary solution (put \(A=0\)) that a constant will satisfy the homogeneous DE. Thus the constant term in the particular solution will not work and we must modify the particular solution. So instead try a particular solution of the form

\begin{equation*} y_p(x)=C_1x^2+C_2x \end{equation*}

Thus

\begin{align*} y_p'(x) \amp=2C_1x+C_2\\ y_p''(x) \amp=2C_1 \end{align*}

Substituting into the DE gives

\begin{align*} (2C_1)+(2C_1x+C_2) \amp =x\\ (2C_1)x+(2C_1+C_2) \amp =x \end{align*}

Equating coefficients yields

\begin{align*} 2C_1 \amp =1\\ 2C_1+C_2 \amp =0 \end{align*}

and hence

\begin{equation*} C_1=\frac{1}{2},\hspace{5mm} C_2=-1 \end{equation*}

Thus, a particular solution is

\begin{equation*} y_p(x)=\frac{1}{2}x^2-x \end{equation*}

and hence the general solution is

\begin{equation*} y(x)=Ae^{-x}+B+\frac{1}{2}x^2-x \end{equation*}

To solve the initial-value problem we need the derivative of \(y\) which is

\begin{equation*} y'(x)=-Ae^{-x}+2x-1 \end{equation*}

Using \(y(0)=1\)

\begin{equation*} A+B=1 \end{equation*}

Using \(y'(0)=1\)

\begin{equation*} -A-1=1 \end{equation*}

Thus

\begin{equation*} A=-2,\hspace{5mm} B=3 \end{equation*}

and the solution is

\begin{equation*} y(x)=3-2e^{-x}+\frac{1}{2}x^2-x \end{equation*}

Exercises Example Tasks

1.

Find the general solution to the DE

\begin{equation*} y''+3y'-10y=10x^2+4x \end{equation*}

2.

Find the general solution to the DE

\begin{equation*} r''+r=\sin(x) \end{equation*}

3.

Solve the initial value problem

\begin{equation*} y''-y'-6y=\sinh(x),\hspace{5mm}y(0)=1,\hspace{5mm}y'(0)=0 \end{equation*}

4.

Find the general solution to the DE

\begin{equation*} u''+u'=xe^x+3\sin(x) \end{equation*}