$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

# 3.4: Method of Undetermined Coefficients

Up to now, we have considered homogeneous second order differential equations. In this discussion, we will investigate nonhomogeneous second order linear differential equations.

Theorem: Solutions of Nonhomogeneous Second Order Linear Differential Equations

Let

$L(y) = y'' + p(t)y' + q(t)y = g(t)$

be a second order linear differential equation with p, q, and g continuous and let

$L(y_1) = L(y_2) = 0 \;\;\; \text{and} \;\;\; L(y_p) = g(t)$

and let

$y_h = c_1y_1 + c_2y_2.$

Then the general solution is given by

$y = y_h + y_p .$

Proof

Since $$L$$ is a linear transformation,

\begin{align*} L(y_h + y_p) &= C_1L(y_1) + C_2L(y_2) + L(y_h)\\[5pt] &= C_1(0) + C_2(0) + g(t) = g(t). \end{align*}

This establishes that $$y_h + y_p$$ is a solution. Next we need to show that all solutions are of this form. Suppose that $$y_3$$ is a solution to the nonhomogeneous differential equation. Then we need to show that

$y_3 = y_h + y_p$

for some constants $$c_1$$ and $$c_2$$ with

$y_h = c_1y_1 + c_2y_2.$

This is equivalent to

$y_3 - y_p = y_h .$

We have

$L(y_3 - y_p) = L(y_3) - L(y_p) = g(t) - g(t) = 0.$

Therefore $$y_3 - y_p$$ is a solution to the homogeneous solution. We can conclude that

$y_3 - y_p = c_1y_1 + c_2y_2 = y_h.$

$$\square$$

This theorem provides us with a practical way of finding the general solution to a nonhomogeneous differential equation.

• Step 1: Find the general solution $$y_h$$ to the homogeneous differential equation.
• Step 2: Find a particular solution $$y_p$$ to the nonhomogeneous differential equation.
• Step 3: Add $$y_h + y_p$$ .

We have already learned how to do Step 1 for constant coefficients. We will now embark on a discussion of Step 2 for some special functions $$g(t)$$.

Definition

A function $$g(t)$$ generates a UC-set if the vector space of functions generated by $$g(t)$$ and all the derivatives of $$g(t)$$ is finite dimensional.

Example $$\PageIndex{1}$$

Let $$g(t) = t \sin(3t)$$.

Then

\begin{align*} g'(t) &= \sin(3t) + 3t \cos(3t) & g''(t) &= 6 \cos(3t) - 9t \sin(3t) \\ g^{(3)} (t) &= -27 \sin(3t) - 27t \cos(3t) & g^{(4)}(t) &= 81 \cos(3t) - 108t \sin(3t) \\ g^{(4)} (t) &= 405 \sin(3t) - 243t \cos(3t) & g^{(5)}(t) &= 1458 \cos(3t) - 729t \cos(3t) \end{align*}

We can see that $$g(t)$$ and all of its derivative can be written in the form

$g^{(n)} (t) = A \sin(3t) + B \cos(3t) + Ct \sin(3t) + Dt \cos(3t).$

We can say that $$\left \{ \sin(3t), \cos(3t), t \sin(3t), t \cos(3t) \right \}$$ is a basis for the UC-Set.

We now state without proof the following theorem tells us how to find the particular solution of a nonhomogeneous second order linear differential equation.

Theorem:

Let

$L(y) = ay'' + by' + cy = g(t)$

be a nonhomogeneous linear second order differential equation with constant coefficients such that g(t) generates a UC-Set

${f_1(t), f_2(t), ...f_n(t)}$

Then there exists a whole number s such that

$y_p = t^s[c_1f_1(t) + c_2f_2(t) + ... + c_nf_n(t)]$

is a particular solution of the differential equation.

Remark: The "s" will come into play when the homogeneous solution is also in the UC-Set.

Example $$\PageIndex{2}$$

Find the general solution of the differential equation

$y'' + y' - 2y = e^{-t} \text{sin}\, t .$

Solution

First find the solution to the homogeneous differential equation

$y'' + y' - 2y = 0 .$

We have

$r^2 + r - 2 = (r - 1)(r + 2) = 0$

$r = -2 \;\;\; \text{or} \;\;\; r = 1.$

Thus

$y_h = c_1 e^{-2t} + c_2 e^t .$

Next notice that $$e^{-t} \sin t$$ and all of its derivatives are of the form

$A e^{-t} \sin t + B e^{-t} \cos t .$

We set

$y_p = A e^{-t} \sin t + B e^{-t} \cos t$

and find

\begin{align*} y'_p &= A ( -e^{-t} \sin t + e^{-t} \cos t) + B (-e^{-t} \cos t - e^{-t} \sin t ) \\[5pt] &= -(A + B)e^{-t} \sin t + (A - B)e^{-t} \cos t \end{align*}

and

\begin{align*} y''_p &= -(A + B)(-e^{-t} \sin t + e^{-t} \cos t ) + (A - B)(-e^{-t} \cos t - e^{-t} \sin t ) \\ &= [(A + B) - (A - B)] e^{-t} \sin t + [-(A + B) - (A - B) ] e^{-t} \cos t \\ &= 2B e^{-t} \sin t - 2A e^{-t} \cos t . \end{align*}

Now put these into the original differential equation to get

$2B e^{-t} \sin t - 2A e^{-t} \cos t + -(A + B)e^{-t} \sin t + (A - B) e^{-t} \cos t - 2(A e^{-t} \sin t + B e^{-t} \cos t) = e^{-t} \sin t.$

Combine like terms to get

$(2B - A - B - 2A) e^{-t} \sin t + ( -2A + A - B - 2B) e^{-t} \cos t = e^{-t} \sin t$

or

$(-3A + B) e^{-t} \sin t + (-A - 3B) e^{-t} \cos t = e^{-t} \sin t.$

Equating coefficients, we get

$-3A + B = 1 \;\;\; \text{and} \;\;\; -A - 3B = 0.$

This system has solution

$A = - \frac {3}{10}, \;\;\; B = \frac{1}{10}.$

The particular solution is

$y_p = - \frac {3}{10} e^{-t} \sin t + \frac {1}{10} e^{-t} \cos t.$

Adding the particular solution to the homogeneous solution gives

$y = y_h + y_p = c_1 e^{-2t} + c_2 e^{t} + - \frac {3}{10} e^{-t} \sin t + \frac {1}{10} e^{-t} \cos t.$

Example $$\PageIndex{3}$$

Solve

$y'' + y = 5 \, \sin t. \label{ex3.1}$

Solution

The characteristic equation is

$r^2 + 1 = 0. \nonumber$

Which has the complex roots

$r = i \;\;\; \text{or} \;\;\; r = -i . \nonumber$

The homogeneous solution is

$y_h = c_1 \sin t + c_2 \cos t. \nonumber$

The UC-Set for $$\sin t$$ is $$\left \{ \sin t , \cos t \right \}$$. Derivatives are all $$\sin$$ and $$\cos$$ functions

Notice that both of the functions in the UC-Set are solutions to the homogeneous differential equation. We need to multiply by $$t$$ to get

$\left \{ t \sin t, t \cos t \right \}. \nonumber$

The particular solution is

\begin{align*} y_p &= At \, \sin t + B \cos t \\[5pt] y_p' &= A \sin t + At \cos t + B \cos t - Bt \sin t \\[5pt] y_p'' &= A \cos t + A \cos t - At \sin t - B\, \sin t - B\sin t - Bt \cos t \\[5pt]&= 2A \cos t - At \sin t - 2B \sin t - Bt \cos t. \end{align*}

Now put these back into the original differential equation (Equation \ref{ex3.1}) to get

\begin{align*} 2A \cos t - At \sin t -2B \sin t - Bt \cos t + At \sin t + Bt \cos t &= 5 \sin t \\[5pt] 2A \cos t - 2B \sin t &= 5 \sin t. \end{align*}

Equating coefficients gives

$2A = 0 \;\;\; \text{and} \;\;\; -2 B = 5.$

So

$A = 0 \;\;\; \text{and} \;\;\; B = - \frac {2}{5}.$

We have

$y_p = - \frac {2}{5} \cos t.$

Adding $$y_p$$ to $$y_h$$ gives

$y = c_1 \sin t + c_2 \cos t - \frac {2}{5} \cos t.$