Wichita State University Logo

Math 555: Differential Equations

3.5 Nonhomogeneous Equations and
the Method of Undetermined Coefficients


3.5.1 Nonhomogeneous Equations

Up until this point, we have considered cases where the right hand side of our differential equation is zero. We now consider the nonhomogenous case of the linear differential equation, where

$$ L[y] = y'' + p(t)y' + q(t) y = g(t) $$
for functions $p(t)$, $q(t)$, and a nonzero function $g(t)$ that are continuous on an interval $I$.

The function $g(t)$ may be zero sometimes, but it is not always equal to zero.

For the sake of clarity, we need to distinguish between the homogeneous differential equation

$$ L[y] = y'' + p(t)y' + q(t) y = 0 $$
and the nonhomogeneous differential equation

$$ L[y] = y'' + p(t)y' + q(t) y = g(t), $$
as our approach to finding a complete solution will combine solutions for these two cases.

Solutions to Nonhomogeneous Equations

To begin, let's establish a couple of theorems about the solutions to nonhomogeneous equations.

Theorem 3.5.1

If $Y_1$ and $Y_2$ are solutions to the nonhomogeneous equation

$$ L[y] = y'' + p(t)y' + q(t) y = g(t), $$
then their difference $Y_1 - Y_2$ is a solution to corresponding homogeneous equation. Additionally, this solution forms a fundamental set of solutions $y_1$ and $y_2$ to the homogeneous equation which may be expressed as a linear combination:

$$ Y_1(t) - Y_2(t) = c_1 y_1(t) + c_2 y_2(t). $$

Proof:

Since $Y_1$ and $Y_2$ solve the nonhomogeneous equation, we have that

$$ L[Y_1](t) = g(t),\quad L[Y_2](t) = g(t), $$
and so their difference must be

$$ L[Y_1](t) - L[Y_2](t) = g(t) - g(t) = 0. $$
Also, due to linearity, we have that

$$ L[Y_1] - L[Y_2] = L[Y_1 - Y_2] = 0, $$
so the difference $Y_1 - Y_2$ is a solution to the homogeneous equation and must be expressible as a linear combination of a fundamental set of solutions.

Theorem 3.5.2

The general solution of the nonhomogeneous equation can be written in the form

$$ y = \phi(t) = c_1 y_1(t) + c_2 y_2(t) + Y(t), $$
where $y_1$ and $y_2$ for a fundamental set of solutions to the homogeneous problem and $Y(t)$ is a particular solution to the nonhomogeneous equation.

Proof:

Suppose $\phi(t)$ and $Y(t)$ are solutions to the nonhomogeneous equation, specifically $Y_1$ and $Y_2$ from Theorem 3.5.1. Then

$$ \phi(t) - Y(t) = c_1 y_1(t) + c_2 y_2(t), $$
which may be solved for $\phi(t)$ to achieve the desired formula.

Finding Solutions

To find a solution to a nonhomogeneous equation, Theorem 3.5.2 suggests the following steps

  1. Find the general solution to the homogeneous equation $y_c (t) = c_1 y_1(t) + c_2 y_2(t)$, sometimes called the complimentary solution .
  2. Find any solution $Y(t)$ of the nonhomogeneous equation, referred to as the particular solution .
  3. Add these solutions, $\phi(t) = y_c (t) + Y(t).$

What we have shown here is that finding solutions to nonhomogeneous equations is just an extension of finding solutions to the homogeneous cases. The previous sections in this chapter have covered how to solve the homogeneous problems, so we will focus here on finding particular solutions to nonhomogeneous problems.

3.5.2 Some Beginning Examples

Example 3.5.1

Find a particular solution of

$$ y'' - 5y' + 6y = 4e^{-t}. $$

Solution:

Our particular solution $Y(t)$ needs to be such that $Y'' - 5Y' + 6Y = 4e^{-t} $. It seems reasonable to guess that our solution is likely of the form $Y(t) = Ae^{-t}$ for some unknown constant $A$. We compute the first two derivatives of this guess

$$ Y'(t) = -Ae^{-t},\quad Y''(t) = Ae^{-t} $$
and plug these into our equation, which gives

$$ Ae^{-t} + 5Ae^{-t} + 6Ae^{-t} = \left(A + 5A + 6A \right)e^{-t} = 4e^{-t}. $$
Clearly, $12A$ must be equal to $4$ for this to be satisfied, so $A = \frac{1}{3}$ and our particular solution is

$$ Y(t) = \frac{1}{3}e^{-t}. $$

Example 3.5.2

Find a particular solution of

$$ y'' - 5y' + 6y = 2\sin (t). $$

Solution

Again, our approach to finding a particular solution $Y(t)$ is to make a reasonable guess for the form of the solution, and then figuring out which coefficient is required to make the guess work. Here, we guess a solution of the form $Y(t) = A\sin (t)$, and compute the derivatives

$$ Y'(t) = A\cos (t),\quad Y''(t) = A\sin(t). $$
Immediately, we see a problem, because if we plug this into the differential equation, we have

$$ A\sin(t) - 5\left(A\cos (t)\right) + 6\left(A\sin (t)\right) = 2\sin(t). $$
Rearranging this yields

$$ 7A\sin(t) - 5A\cos(t) = 2\sin(t), $$
which isn't possible to solve for all $t$. (Set $t=0$ and $t=\frac{\pi}{2}$ to see this for yourself.)

To fix this, we need a better guess for $Y(t)$. The presence of cosine when we differentiated our original guess suggests we should try $Y(t) = A\sin(t) + B\cos(t)$. Differentiating gives us

$$ Y'(t) = A\cos(t) - B\sin(t),\quad Y''(t) = -A\sin(t) - B\cos(t), $$
which we plug into the ODE.

$$ \begin{aligned} \left( -A\sin(t) - B\cos(t) \right) - 5 \left( A\cos(t) - B\sin(t) \right) + 6\left( A\sin(t) + B\cos(t) \right) &= 2\sin(t) \\ \\ \left(-A + 5B + 6A \right)\sin(t) + \left( -B - 5A + 6B \right)\cos(t) &= 2\sin(t) \\ \\ \left( 5A + 5B \right)\sin(t) + \left(-5A + 5B\right)\cos(t) &= 2\sin(t) \end{aligned} $$
This suggests the system of equations

$$ \begin{matrix} \ 5A + \ 5B = 2 \\ -5A + \ 5B = 0, \end{matrix} $$
whose solution is $A = \frac{1}{5}$, $B = \frac{1}{5}$, so our particular solution is

$$ Y(t) = \frac{1}{5}\sin(t) + \frac{1}{5}\cos(t). $$

3.5.3 Method of Undetermined Coefficients

The technique employed in the previous two examples is known as the method of undetermined coefficients . When presented with a nonhomogeneous problem, a guess is made that roughly matches the form of the forcing function on the right hand side of the differential equation. This guess is then plugged into the ODE and a system of equations is solved to find the coefficients necessary for the particular solution.

This method is useful, but has some important limitations:

Method of Undetermined Coefficients Rules

  1. The guess must be "complete."
    As we saw in the previous example, the guess must be sufficiently sophisticated to describe the nature of the nonhomogeneous part of the equation. A necessary skill to develop for using this technique is to understand the sorts of guesses you have to make for the particular solution candidate.

  2. This technique only works on "simple" nonhomogeneous problems.
    As we will see through the completion of a few more examples, there are going to be problems where this technique will fail. This will be due to either subtle details for the specific nonhomogeneous problem at hand causing problems with our particular solution candidate or because it will be difficult to come up with a good guess for the particular solution in the first place. We will handle some of these issues through the completion of examples and additional guidance, but the truly difficult problems will require a different approach altogether.

Example 3.5.3

Find a particular solution of

$$ y'' - 5y' + 6y = -e^{t}\cos(2t). $$

Solution

For this nonhomogeneous equation, we recognize the right hand side as a common form that shows up when we solve homogeneous equations. It thus makes sense to start with a guess in the form

$$ Y(t) = Ae^t\sin(2t) + Be^t\cos(2t). $$
The derivatives of this function are

$$ \begin{aligned} Y'(t) &= Ae^t\sin(2t) + 2Ae^t\cos(2t) + Be^t\cos(2t) - 2Be^t\sin(2t) \\ &= (A-2B)e^t\sin(2t) + (2A+B)e^t\cos(2t) \\ \\ Y''(t) &= (A-2B)e^t\sin(2t) + 2(A-2B)e^t\cos(2t) \\ &\qquad + (2A+B)e^t\cos(2t) - 2(2A+B)e^t\sin(2t) \\ &= -(3A+4B)e^t\sin(2t) + (4A-3B)e^t\cos(2t) \end{aligned} $$
Substituting these into the ODE and factoring,

$$ \begin{aligned} \Big( -3A-4B - 5(A-2B) + 6A \Big)e^t\sin(t)+\ldots & \\ \Big( (4A-3B) - 5(2A+B) + 6B \Big) e^t\cos(t) &= -e^t\cos(2t) \\ \Big( -2A + 6B \Big)e^t\sin(t) + \Big( -6A - 2B \Big) e^t\cos(t) & = -e^t\cos(2t). \end{aligned} $$
These coefficients may be found by writing this as a matrix equation

$$ \begin{bmatrix} -2 & \ 6 \\ -6 & -2 \end{bmatrix} \begin{bmatrix} A \\ B \end{bmatrix} = \begin{bmatrix} \ 0 \\ -1 \end{bmatrix}, $$
and employing Cramer's rule

$$ A = \dfrac{\begin{vmatrix} \ 0 & \ 6 \\ -1 & -2 \end{vmatrix}}{\begin{vmatrix} -2 & \ 6 \\ -6 & -2 \end{vmatrix}} = \dfrac{3}{20},\qquad B = \dfrac{\begin{vmatrix} -2 & \ 0 \\ -6 & -1 \end{vmatrix}}{\begin{vmatrix} -2 & \ 6 \\ -6 & -2 \end{vmatrix}} = \dfrac{1}{20}. $$
The particular solution is

$$ Y(t) = \frac{3}{20}e^t\sin(2t) + \frac{1}{20}e^t\cos(2t). $$

3.5.4 Taking Advantage of Linearity

If we have a complicated nonhomogeneous part of the equation, such as

$$ 4e^{-t} + 2\sin(t) -e^{t}\cos(2t) $$
you may think things will be difficult to do. However, the reality is quite fortunate.

Example 3.5.4

Find a particular solution of

$$ y'' - 5y' + 6y = 4e^{-t} + 2\sin(t) -e^{t}\cos(2t). $$

Solution

The nonhomogeneous part of this equation is the sum of the right hand sides from the previous examples. If we use those particular solutions, $Y_1(t) = \frac{1}{3}e^{-t}$, $Y_2(t) = \frac{1}{5}\sin(t) + \frac{1}{5}\cos(t)$, and $Y_3(t) = \frac{3}{20}e^t\sin(t) + \frac{1}{20}e^t\cos(t)$ then we know that

$$ \begin{aligned} L[Y_1] &= 4e^{-t} \\ L[Y_2] &= 2\sin(t) \\ L[Y_3] &= -e^t\cos(2t). \end{aligned} $$
Because our differential equation is linear, we can simply add each of these particular solutions to find a particular solution for this example

$$ Y(t) = \frac{1}{3}e^{-t} + \frac{1}{5}\sin(t) + \frac{1}{5}\cos(t)+ \frac{3}{20}e^t\sin(2t) + \frac{1}{20}e^t\cos(2t). $$

3.5.5 Additional Examples

Example 5

Find a particular solution for

$$ y'' - 5y' + 6y = 5e^{2t}. $$

Solution

Our guess for the particular solution here $Y(t) = Ae^{2t}$, and its derivatives are

$$ Y'(t) = 2Ae^{2t},\quad Y''(t) = 4Ae^{2t}. $$
Plugging this into the ODE, we have

$$ \begin{aligned} \left(4Ae^{2t}\right) - 5\left(2Ae^{2t}\right) + 6Ae^{2t} &= 5e^{2t} \\ \\ \left(4A - 10A + 6A\right)e^{2t} &= 5e^{2t} \\ \\ 0 e^{2t} &= 5e^{2t}, \end{aligned} $$
which doesn't work!

This fails because $e^{2t}$ is a member the fundamental set of solutions for the homogeneous equation

$$ y'' - 5y' + 6y = 0, $$
whose general solution is $y(t) = c_1 e^{2t} + c_2 e^{3t}$. Here we have a situation where the method of undetermined coefficients typically fails, when the forcing function (right hand side) is linearly dependent on the fundamental set of solutions to the homogeneous equation. To solve this equation, we need a workaround to help us make a better guess for the particular solution.

Since our issue is related to the homogeneous equation, let's take a closer look at that. Specifically, its characteristic equation

$$ r^2 - 5r + 6 = (r-2)(r-3) = 0. $$
Originally, we used this character equation to figure out which values of $r$ would make $e^{rt}$ work as a solution to the ODE. Now, we'll use one of the factors in this characteristic equation to come up with a first-order ODE that has the same characteristic equation (and is thus analogous to) this second-order equation.

We'll be employing the operator method discussed in Section 3.4 picking $d-2$ as our differential operator, since this is where our solution $e^{2t}$ to the second-order homogeneous equation comes from. This suggests that an analogous first-order equation would be

$$ \begin{aligned} (d-2)[y] &= 5e^{2t} \\ \\ y' - 2y &= 5e^{2t}, \end{aligned} $$
since each power of $r$ corresponds to a derivative of $y$ and we want the right hand side to be the nonhomogeneous part. This is a first-order linear equation that may be solved using an integrating factor $\mu(t) = e^{-2t} $:

$$ \begin{aligned} \dfrac{d}{dt}\left( e^{-2t}y \right) &= 5 \\ \\ e^{-2t}y &= 5t + C \\ \\ y(t) &= 5te^{2t} + Ce^{2t} \end{aligned}$$
We know that the part that is a constant multiple of $e^{2t}$ won't work because it is part of the fundamental solution to the homogeneous equation, so our guess for the particular solution will just be $Y(t) = Ate^{2t}$.

The derivatives of $Y(t)$ are

$$ \begin{aligned} Y'(t) &= Ae^{2t} + 2Ate^{2t} \\ \\ Y''(t) &= 2Ae^{2t} + 2Ae^{2t} + 4Ate^{2t} = (1+t)4Ae^{2t}. \end{aligned} $$
Using this particular solution in the nonhomogeneous equation,

$$ \begin{aligned} (1+t)4Ae^{2t} - 5(1+2t)Ae^{2t} + 6Ate^{2t} &= 5e^{2t} \\ \\ (4A-5A)e^{2t} + (4A - 10A + 6A)te^{2t} &= 5e^{2t} \\ \\ -Ae^{2t} &= 5e^{2t} \end{aligned} $$
and so $A = -5$. Hence the particular solution is

$$ Y(t) = -5e^{2t}. $$

Exercise 3.5.1

Find a particular solution for

$$ y'' - 4y' + 3y = t^2 - 3. $$

Check Your Work
$$ y(t) = \frac{1}{3}t^2 + \frac{8}{9}t - \frac{1}{27} $$

Video Solution

Creative Commons Logo - White


Your use of this self-initiated mediated course material is subject to our Creative Commons License .


Creative Commons Attribution-NonCommercial-ShareAlike 4.0

Creative Commons Logo - Black
Attribution
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Creative Commons Logo - Black
Noncommercial
You may not use the material for commercial purposes.

Creative Commons Logo - Black
Share Alike
You are free to share, copy and redistribute the material in any medium or format. If you adapt, remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.