
5.5: The Method of Undetermined Coefficients II


In this section we consider the constant coefficient equation

$\label{eq:5.5.1} ay''+by'+cy=e^{\lambda x}\left(P(x)\cos \omega x+Q(x)\sin \omega x\right)$

where $$\lambda$$ and $$\omega$$ are real numbers, $$\omega\ne0$$, and $$P$$ and $$Q$$ are polynomials. We want to find a particular solution of Equation \ref{eq:5.5.1}. As in Section 5.4, the procedure that we will use is called the method of undetermined coefficients.

Forcing Functions Without Exponential Factors

We begin with the case where $$\lambda=0$$ in Equation \ref{eq:5.5.1} ; thus, we we want to find a particular solution of

$\label{eq:5.5.2} ay''+by'+cy=P(x)\cos\omega x+Q(x)\sin\omega x,$

where $$P$$ and $$Q$$ are polynomials.

Differentiating $$x^r\cos\omega x$$ and $$x^r\sin\omega x$$ yields

${d\over dx}x^r\cos\omega x=-\omega x^r\sin\omega x+ rx^{r-1}\cos\omega x \nonumber$

and

${d\over dx}x^r\sin\omega x=\phantom{-}\omega x^r\cos\omega x+ rx^{r-1}\sin\omega x. \nonumber$

This implies that if

$y_p=A(x)\cos\omega x+B(x)\sin\omega x\nonumber$

where $$A$$ and $$B$$ are polynomials, then

$ay_p''+by_p'+cy_p=F(x)\cos\omega x+G(x)\sin\omega x,\nonumber$

where $$F$$ and $$G$$ are polynomials with coefficients that can be expressed in terms of the coefficients of $$A$$ and $$B$$. This suggests that we try to choose $$A$$ and $$B$$ so that $$F=P$$ and $$G=Q$$, respectively. Then $$y_p$$ will be a particular solution of Equation \ref{eq:5.5.2}. The next theorem tells us how to choose the proper form for $$y_p$$. For the proof see Exercise 5.5.37.

Theorem 5.5.1

Suppose $$\omega$$ is a positive number and $$P$$ and $$Q$$ are polynomials. Let $$k$$ be the larger of the degrees of $$P$$ and $$Q.$$ Then the equation

$ay''+by'+cy=P(x)\cos \omega x+Q(x)\sin \omega x \nonumber$

has a particular solution

$\label{eq:5.5.3} y_p=A(x)\cos\omega x+B(x)\sin\omega x,$

where

$A(x)=A_0+A_1x+\cdots+A_kx^k \quad \text{and} \quad B(x)=B_0+B_1x+\cdots+B_kx^k, \nonumber$

provided that $$\cos\omega x$$ and $$\sin\omega x$$ are not solutions of the complementary equation. The solutions of

$a(y''+\omega^2y)=P(x)\cos \omega x+Q(x)\sin \omega x \nonumber$

for which $$\cos\omega x$$ and $$\sin\omega x$$ are solutions of the complementary equation are of the form of Equation \ref{eq:5.5.3}, where

$A(x)=A_0x+A_1x^2+\cdots+A_kx^{k+1} \quad \text{and} \quad B(x)=B_0x+B_1x^2+\cdots+B_kx^{k+1}. \nonumber$

For an analog of this theorem that’s applicable to Equation \ref{eq:5.5.1}, see Exercise 5.5.38.

Example 5.5.1

Find a particular solution of

$\label{eq:5.5.4} y''-2y'+y=5\cos2x+10\sin2x.$

Solution

In Equation \ref{eq:5.5.4} the coefficients of $$\cos2x$$ and $$\sin2x$$ are both zero degree polynomials (constants). Therefore Theorem 5.5.1 implies that Equation \ref{eq:5.5.4} has a particular solution

$y_p=A\cos2x+B\sin2x.\nonumber$

Since

$y_p'=-2A\sin2x+2B\cos2x\quad \text{and} \quad y_p''=-4(A\cos2x+B\sin2x),\nonumber$

replacing $$y$$ by $$y_p$$ in Equation \ref{eq:5.5.4} yields

\begin{aligned} y_p''-2y_p'+y_p&=-4(A\cos2x+B\sin2x)-4(-A\sin2x+B\cos2x) \\ &&+(A\cos2x+B\sin2x)\\ &= (-3A-4B)\cos2x+(4A-3B)\sin2x.\end{aligned}\nonumber

Equating the coefficients of $$\cos2x$$ and $$\sin2x$$ here with the corresponding coefficients on the right side of Equation \ref{eq:5.5.4} shows that $$y_p$$ is a solution of Equation \ref{eq:5.5.4} if

\begin{aligned} -3A-4B&=\phantom{1}5\phantom{.}\\ \phantom{-}4A-3B&=10.\end{aligned}\nonumber

Solving these equations yields $$A=1$$, $$B=-2$$. Therefore

$y_p=\cos2x-2\sin2x\nonumber$

is a particular solution of Equation \ref{eq:5.5.4}.

Example 5.5.2

Find a particular solution of

$\label{eq:5.5.5} y''+4y=8\cos2x+12\sin2x.$

Solution

The procedure used in Example 5.5.1 doesn’t work here; substituting $$y_p=A\cos2x+B\sin2x$$ for $$y$$ in Equation \ref{eq:5.5.5} yields

$y_p''+4y_p=-4(A\cos2x+B\sin2x) +4(A\cos2x+B\sin2x)=0\nonumber$

for any choice of $$A$$ and $$B$$, since $$\cos2x$$ and $$\sin2x$$ are both solutions of the complementary equation for Equation \ref{eq:5.5.5}. We’re dealing with the second case mentioned in Theorem 5.5.1 , and should therefore try a particular solution of the form

$\label{eq:5.5.6} y_p=x(A\cos2x+B\sin2x).$

Then

\begin{aligned} y_p'&=A\cos2x+B\sin2x+2x(-A\sin2x+B\cos2x) \\ \text{and} y_p''&=-4A\sin2x+4B\cos2x-4x(A\cos2x+B\sin2x)\\ &=-4A\sin2x+4B\cos2x-4y_p \mbox{ (see \eqref{eq:5.5.6})},\end{aligned}\nonumber

so

$y_p''+4y_p=-4A\sin2x+4B\cos2x.\nonumber$

Therefore $$y_p$$ is a solution of Equation \ref{eq:5.5.5} if

$-4A\sin2x+4B\cos2x=8\cos2x+12\sin2x,\nonumber$

which holds if $$A=-3$$ and $$B=2$$. Therefore

$y_p=-x(3\cos2x-2\sin2x)\nonumber$

is a particular solution of Equation \ref{eq:5.5.5}.

Example 5.5.3

Find a particular solution of

$\label{eq:5.5.7} y''+3y'+2y=(16+20x)\cos x+10\sin x.$

Solution

The coefficients of $$\cos x$$ and $$\sin x$$ in Equation \ref{eq:5.5.7} are polynomials of degree one and zero, respectively. Therefore Theorem 5.5.1 tells us to look for a particular solution of Equation \ref{eq:5.5.7} of the form

$\label{eq:5.5.8} y_p=(A_0+A_1x)\cos x+(B_0+B_1x)\sin x.$

Then

$\label{eq:5.5.9} y_p'=(A_1+B_0+B_1x)\cos x+(B_1-A_0-A_1x)\sin x$

and

$\label{eq:5.5.10} y_p''=(2B_1-A_0-A_1x)\cos x-(2A_1+B_0+B_1x)\sin x,$

so

$\label{eq:5.5.11} \begin{array}{rcl} y_p''+3y_p'+2y_p&=\left[A_0+3 A_1+3 B_0+2 B_1+(A_1+3 B_1)x\right]\cos x + \left[B_0+3 B_1-3 A_0-2 A_1+(B_1-3 A_1)x\right]\sin x. \end{array}$

Comparing the coefficients of $$x\cos x$$, $$x\sin x$$, $$\cos x$$, and $$\sin x$$ here with the corresponding coefficients in Equation \ref{eq:5.5.7} shows that $$y_p$$ is a solution of Equation \ref{eq:5.5.7} if

$\begin{array}{rcr} \phantom{-3}A_1+3B_1&=20\phantom{.}\\ -3A_1+\phantom{3}B_1&=0\phantom{.}\\ \phantom{-3}A_0+3B_0+3A_1+2B_1&=16\phantom{.}\\ -3A_0+\phantom{3}B_0-2A_1+3B_1&=10. \end{array}\nonumber$

Solving the first two equations yields $$A_1=2$$, $$B_1=6$$. Substituting these into the last two equations yields

\begin{aligned} \phantom{-3}A_0+3B_0&=16-3A_1-2B_1=-2\phantom{.}\\ -3A_0+\phantom{3}B_0&=10+2A_1-3B_1=-4. \end{aligned}\nonumber

Solving these equations yields $$A_0=1$$, $$B_0=-1$$. Substituting $$A_0=1$$, $$A_1=2$$, $$B_0=-1$$, $$B_1=6$$ into Equation \ref{eq:5.5.8} shows that

$y_p=(1+2x)\cos x-(1-6x)\sin x \nonumber$

is a particular solution of Equation \ref{eq:5.5.7}.

A Useful Observation

In Equations \ref{eq:5.5.9}, \ref{eq:5.5.10}, and \ref{eq:5.5.11} the polynomials multiplying $$\sin x$$ can be obtained by replacing $$A_0,A_1,B_0$$, and $$B_1$$ by $$B_0$$, $$B_1$$, $$-A_0$$, and $$-A_1$$, respectively, in the polynomials mutiplying $$\cos x$$. An analogous result applies in general, as follows (Exercise 5.5.36).

Theorem 5.5.2

If

$y_p=A(x)\cos\omega x+B(x)\sin\omega x, \nonumber$

where $$A(x)$$ and $$B(x)$$ are polynomials with coefficients $$A_0$$ …, $$A_k$$ and $$B_0$$, …, $$B_k,$$ then the polynomials multiplying $$\sin\omega x$$ in

$y_p',\quad y_p'',\quad ay_p''+by_p'+cy_p \quad \text{and} \quad y_p''+\omega^2 y_p \nonumber$

can be obtained by replacing $$A_0$$, …$$,$$ $$A_k$$ by $$B_0,$$ …$$,$$ $$B_k$$ and $$B_0,$$ …$$,$$ $$B_k$$ by $$-A_0,$$ …$$,$$ $$-A_k$$ in the corresponding polynomials multiplying $$\cos\omega x$$.

We will not use this theorem in our examples, but we recommend that you use it to check your manipulations when you work the exercises.

Example 5.5.4

Find a particular solution of

$\label{eq:5.5.12} y''+y=(8-4x)\cos x-(8+8x)\sin x.$

Solution

According to Theorem 5.5.1 , we should look for a particular solution of the form

$\label{eq:5.5.13} y_p=(A_0x+A_1x^2)\cos x+(B_0x+B_1x^2)\sin x,$

since $$\cos x$$ and $$\sin x$$ are solutions of the complementary equation. However, let’s try

$\label{eq:5.5.14} y_p=(A_0+A_1x)\cos x+(B_0+B_1x)\sin x$

first, so you can see why it doesn’t work. From Equation \ref{eq:5.5.10},

$y_p''=(2B_1-A_0-A_1x)\cos x-(2A_1+B_0+B_1x)\sin x, \nonumber$

which together with Equation \ref{eq:5.5.14} implies that

$y_p''+y_p=2B_1\cos x-2A_1\sin x. \nonumber$

Since the right side of this equation does not contain $$x\cos x$$ or $$x\sin x$$, Equation \ref{eq:5.5.14} can’t satisfy Equation \ref{eq:5.5.12} no matter how we choose $$A_0$$, $$A_1$$, $$B_0$$, and $$B_1$$.

Now let $$y_p$$ be as in Equation \ref{eq:5.5.13}. Then

\begin{aligned} y_p'&=\left[A_0+(2A_1+B_0)x+B_1x^2\right]\cos x\\ & +\left[B_0+(2B_1-A_0)x-A_1x^2\right]\sin x \end{aligned}\nonumber

and

\begin{aligned} y_p''&= \left[2A_1+2B_0-(A_0-4B_1)x-A_1x^2\right]\cos x\\ &+ \left[2B_1-2A_0-(B_0+4A_1)x-B_1x^2\right]\sin x,\end{aligned}\nonumber

so

$y_p''+y_p=(2A_1+2B_0+4B_1x)\cos x+(2B_1-2A_0-4A_1x)\sin x. \nonumber$

Comparing the coefficients of $$\cos x$$ and $$\sin x$$ here with the corresponding coefficients in Equation \ref{eq:5.5.12} shows that $$y_p$$ is a solution of Equation \ref{eq:5.5.12} if

$\begin{array}{rcr} \phantom{-}4B_1&=-4\phantom{.}\\ -4A_1&=-8\phantom{.}\\ \phantom{-}2B_0+2A_1&=8\phantom{.}\\ -2A_0+2B_1&=-8. \end{array}\nonumber$

The solution of this system is $$A_1=2$$, $$B_1=-1$$, $$A_0=3$$, $$B_0=2$$. Therefore

$y_p=x\left[(3+2x)\cos x+(2-x)\sin x\right] \nonumber$

is a particular solution of Equation \ref{eq:5.5.12}.

Forcing Functions with Exponential Factors

To find a particular solution of

$\label{eq:5.5.15} ay''+by'+cy=e^{\lambda x}\left(P(x)\cos \omega x+Q(x)\sin \omega x\right)$

when $$\lambda\ne0$$, we recall from Section 5.4 that substituting $$y=ue^{\lambda x}$$ into Equation \ref{eq:5.5.15} will produce a constant coefficient equation for $$u$$ with the forcing function $$P(x)\cos \omega x+Q(x)\sin \omega x$$. We can find a particular solution $$u_p$$ of this equation by the procedure that we used in Examples 5.5.1 -5.5.4 . Then $$y_p=u_pe^{\lambda x}$$ is a particular solution of Equation \ref{eq:5.5.15}.

Example 5.5.5

Find a particular solution of

$\label{eq:5.5.16} y''-3y'+2y=e^{-2x}\left[2\cos 3x-(34-150x)\sin 3x\right].$

Let $$y=ue^{-2x}$$. Then

\begin{aligned} y''-3y'+2y&=e^{-2x}\left[(u''-4u'+4u)-3(u'-2u)+2u\right]\\ &=e^{-2x}(u''-7u'+12u)\\ &= e^{-2x}\left[2\cos 3x-(34-150x)\sin 3x\right]\end{aligned}\nonumber

if

$\label{eq:5.5.17} u''-7u'+12u=2\cos 3x-(34-150x)\sin 3x.$

Since $$\cos3x$$ and $$\sin3x$$ aren’t solutions of the complementary equation

$u''-7u'+12u=0,\nonumber$

Theorem 5.5.1 tells us to look for a particular solution of Equation \ref{eq:5.5.17} of the form

$\label{eq:5.5.18} u_p=(A_0+A_1x)\cos 3x +(B_0+B_1x)\sin 3x.$

Then

\begin{aligned} u_p'&=(A_1+3B_0+3B_1x)\cos 3x+(B_1-3A_0-3A_1x)\sin 3x\\ \text{and} \qquad u_p''&=(-9A_0+6B_1-9A_1x)\cos 3x-(9B_0+6A_1+9B_1x)\sin 3x,\end{aligned}\nonumber

so

\begin{aligned} u_p''-7u_p'+12u_p&=\left[3A_0-21B_0-7A_1+6B_1+(3A_1-21B_1)x\right]\cos 3x\\ &+\left[21A_0+3B_0-6A_1-7B_1+(21A_1+3B_1)x\right]\sin 3x.\end{aligned}\nonumber

Comparing the coefficients of $$x\cos 3x$$, $$x\sin 3x$$, $$\cos 3x$$, and $$\sin 3x$$ here with the corresponding coefficients on the right side of Equation \ref{eq:5.5.17} shows that $$u_p$$ is a solution of Equation \ref{eq:5.5.17} if

$\label{eq:5.5.19} \begin{array}{rcr} 3A_1-21B_1&=0\phantom{.}\\ 21A_1+\phantom{2}3B_1&=150\phantom{.}\\ 3A_0-21B_0-7A_1+\phantom{2}6B_1&=\phantom{-3}2\phantom{.}\\ 21A_0+\phantom{2}3B_0-6A_1-\phantom{5}7B_1&=-34. \end{array}$

Solving the first two equations yields $$A_1=7$$, $$B_1=1$$. Substituting these values into the last two equations of Equation \ref{eq:5.5.19} yields

\begin{aligned} \phantom{2}3A_0-21B_0&=\phantom{-3}2+7A_1-6B_1=45\phantom{.}\\ 21A_0+\phantom{2}3B_0&=-34+6A_1+7B_1=15.\end{aligned}\nonumber

Solving this system yields $$A_0=1$$, $$B_0=-2$$. Substituting $$A_0=1$$, $$A_1=7$$, $$B_0=-2$$, and $$B_1=1$$ into Equation \ref{eq:5.5.18} shows that

$u_p=(1+7x)\cos 3x-(2-x)\sin 3x\nonumber$

is a particular solution of Equation \ref{eq:5.5.17}. Therefore

$y_p=e^{-2x}\left[(1+7x)\cos 3x-(2-x)\sin 3x\right]\nonumber$

is a particular solution of Equation \ref{eq:5.5.16}.

Example 5.5.6

Find a particular solution of

$\label{eq:5.5.20} y''+2y'+5y=e^{-x}\left[(6-16x)\cos2x-(8+8x)\sin2x\right].$

Solution

Let $$y=ue^{-x}$$. Then

\begin{aligned} y''+2y'+5y&=e^{-x}\left[(u''-2u'+u)+2(u'-u)+5u\right]\\ &=e^{-x}(u''+4u)\\ &= e^{-x}\left[(6-16x)\cos2x-(8+8x)\sin2x\right]\end{aligned}\nonumber

if

$\label{eq:5.5.21} u''+4u=(6-16x)\cos2x-(8+8x)\sin2x.$

Since $$\cos2x$$ and $$\sin2x$$ are solutions of the complementary equation

$u''+4u=0,\nonumber$

Theorem 5.5.1 tells us to look for a particular solution of Equation \ref{eq:5.5.21} of the form

$u_p=(A_0x+A_1x^2)\cos2x+(B_0x+B_1x^2)\sin2x.\nonumber$

Then

\begin{aligned} u_p'&=\left[A_0+(2A_1+2B_0)x+2B_1x^2\right]\cos2x \\ & +\left[B_0+(2B_1-2A_0)x-2A_1x^2\right]\sin2x\end{aligned}\nonumber

and

\begin{aligned} u_p''&=\left[2A_1+4B_0-(4A_0-8B_1)x-4A_1x^2\right]\cos2x\\ & +\left[2B_1-4A_0-(4B_0+8A_1)x-4B_1x^2\right]\sin2x,\end{aligned}\nonumber

so

$u_p''+4u_p=(2A_1+4B_0+8B_1x)\cos2x+(2B_1-4A_0-8A_1x)\sin2x.\nonumber$

Equating the coefficients of $$x\cos2x$$, $$x\sin2x$$, $$\cos2x$$, and $$\sin2x$$ here with the corresponding coefficients on the right side of Equation \ref{eq:5.5.21} shows that $$u_p$$ is a solution of Equation \ref{eq:5.5.21} if

$\label{eq:5.5.22} \begin{array}{rcr} 8B_1&=-16\phantom{.}\\ -8A_1&=-\phantom{1}8\phantom{.}\\ \phantom{-}4B_0+2A_1&=6\phantom{.}\\ -4A_0+2B_1&=-8. \end{array}$

The solution of this system is $$A_1=1$$, $$B_1=-2$$, $$B_0=1$$, $$A_0=1$$. Therefore

$u_p=x[(1+x)\cos2x+(1-2x)\sin2x]\nonumber$

is a particular solution of Equation \ref{eq:5.5.21}, and

$y_p=xe^{-x}\left[(1+x)\cos2x+(1-2x)\sin2x\right]\nonumber$

is a particular solution of Equation \ref{eq:5.5.20}.

You can also find a particular solution of Equation \ref{eq:5.5.20} by substituting

$y_p=xe^{-x}\left[(A_0+A_1x)\cos 2x +(B_0+B_1x)\sin 2x\right]\nonumber$

for $$y$$ in Equation \ref{eq:5.5.20} and equating the coefficients of $$xe^{-x}\cos2x$$, $$xe^{-x}\sin2x$$, $$e^{-x}\cos2x$$, and $$e^{-x}\sin2x$$ in the resulting expression for

$y_p''+2y_p'+5y_p\nonumber$

with the corresponding coefficients on the right side of Equation \ref{eq:5.5.20}. (See Exercise 5.5.38). This leads to the same system Equation \ref{eq:5.5.22} of equations for $$A_0$$, $$A_1$$, $$B_0$$, and $$B_1$$ that we obtained in Example 5.5.6 . However, if you try this approach you’ll see that deriving Equation \ref{eq:5.5.22} this way is much more tedious than the way we did it in Example 5.5.6 .

5.5: The Method of Undetermined Coefficients II is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by William F. Trench.