# How to Solve Nonhomogeneous Linear ODEs using Annihilators

**Estimated Read Time:**7 minute(s)

**Common Topics:**solution, operator, homogeneous, order, general

My previous Insights article, Solving Homogeneous Linear ODEs using Annihilators, discussed several examples of homogeneous differential equations, equations of the form F(y, y’, y”, …) = 0. In this Insights article we will look at equations of the form F(y, y’, y”, …) = g(t), for certain functions g.

**Ex. 1**: y” – 4y’ + 3y = 5

For this example, we note two facts:

- The left side can be rewritten as ##(D^2 – 4D + 3)y##.
- The derivative of 5 = 0; that is,
**D**(5) = 0.

If I apply the D operator to both sides, I get:

$$D(D^2 – 4D – 3)y = D(5) = 0$$

or, in factored form:

$$D(D – 3)(D – 1)y = 0$$

By “annihilating” the right side, I have converted the nonhomogeneous differential equation y” – 4y’ + 3y = 5 into a homogeneous differential equation, albeit of a higher order.

The characteristic equation of the new equation can be read off from the operator notation: ##r(r – 3)(r – 1) = 0##. The roots are r = 0, r = 3, and r = 1, so a fundamental solution set is ##\{e^{0t} = 1, e^{3t}, e^t\}##.

The general solution for the third-order homogeneous equation is ##y(t) = A \cdot 1 + c_1e^{3t} + c_2e^t##. You might wonder why I have different coefficients for the three fundamental solutions. The reason is that I want to keep the one (A) that came from the nonhomogeneous problem separate from the other two (##c_1## and ##c_2##).

Differentiating the solution twice, I get:

##y(t) = A \cdot 1 + c_1e^{3t} + c_2e^t##

##y'(t) = 3c_1e^{3t} + c_2e^t##

##y”(t) = 9c_1e^{3t} + c_2e^t##

Substituting back into the original differential equation, I get

##9c_1e^{3t} + c_2e^t – 4(3c_1e^{3t} + c_2e^t) + 3(A + c_1e^{3t} + c_2e^t) = 5##

##\Rightarrow (9c_1 – 12c_1 + 3c_1)e^{3t} + (c_2 – 4c_2 + 3 c_2)e^t + 3A = 5##

##\Rightarrow A = \frac 5 3##

The general solution to the original differential equation is ##y(t) = \frac 5 3 + c_1e^{3t} + c_2e^t##.

**Note**: If initial conditions had been given in this problem, we could find the constants ##c_1## and ##c_2##.

**Ex. 2**: ##y” – 4y’ + 3y = e^{2t}##

This equation can be rewritten as ##(D^2 – 4D + 3)y = e^{2t}##. Recall that the (**D – 2**) operator annihilates ##e^{2t}##. That is, ##(D – 2)e^{2t} = 0##.

If we apply the (D – 2) operator to both sides, we get ##(D – 2)(D^2 – 4D + 3)y = (D – 2)e^{2t} = 0##, which is a homogeneous equation, of third order.

Factoring the operators, we have ##(D – 2)(D – 3)(D – 1)y = 0##, so a fundamental solution set is ##\{e^{2t}, e^{3t}, e^t\}##. Note that the characteristic equation of the third-order, homogeneous equation is (r – 2)(r – 3)(r – 1) = 0.

The general solution of the homogeneous equation is ##y(t) = Ae^{2t} + c_1e^{3t} + c_2e^t##. If we substitute this into the original, nonhomogeneous equation, we get

$$(4A – 8A + 3A)e^{2t} + (9c_1 – 12c_1 + 3c_1)e^{3t} + (c_2 – 4c_2 + 3c_2)e^t = e^{2t}$$

$$\Rightarrow -Ae^{2t} = e^{2t} \Rightarrow A = -1$$

The general solution to the original nonhomogeneous equation is ##y(t) = -e^{2t} + c_1e^{3t} + c_2e^t##.

**Ex. 3**: ##y” – 4y’ + 3y = e^{3t}##

Rewriting the equation in operator notation, we have ##(D^2 – 4D + 3D)y = e^{3t}##, or ##(D – 3)(D – 1)y = e^{3t}##

We notice that the right side can be annihilated with the (**D – 3**) operator.

If we apply this operator to both sides, we get ##(D – 3)^2(D – 1) y = (D -3)e^{3t} = 0##, which is a third order, homogeneous equation.

One thing to notice is that, unlike the previous example, we now have a repeated factor ##(D – 3)^2##. This means that our fundamental set of solutions will be ##\{e^{3t}, te^{3t}, e^t\}##.

The general solution to the third order problem is ##y(t) = c_1e^{3t} + Ate^{3t} + c_2e^t##. The A coefficient on the middle term is to mark it as stemming from the second-order nonhomogeneous problem.

If we substitute this function and its first two derivatives into the second-order equation, we get A = 1/2. (Verification left to the reader.)

The general solution is ##y(t) = c_1e^{3t} + \frac 1 2 te^{3t} + c_2e^t##.

As before, if the problem included initial conditions, we could find the constants ##c_1## and ##c_2##.

**Ex. 4**: ##y” + 4y = te^{-t}##

In operator notation, the equation above is ##(D^2 + 4)y = te^{-t}##. The annihilator of the function on the right side is ##(D + 1)^2##. The reason for the exponent of 2 is because of the presence of t on the right side. The ##D + 1## operator annihilates ##e^{-t}##, and the ##(D + 1)^2## operator annihilates ##te^{-t}##.

Applying the ##(D + 1)^2## operator to both sides, we get ##(D + 1)^2(D^2 + 4)y = (D + 1)^2(te^{-t} = 0##. What was a second-order nonhomogeneous equation is now a fourth order homogeneous equation.

With a fourth-order equation, we expect the fundamental solution set to consist of four linearly independent solutions: ##\{e^{-t}, te^{-t}, \cos(2t), \sin(2t) \}##.

The general solution of the fourth-order equation is ##y(t) = Ae^{-t} + Bte^{-t} + c_1\cos(2t) + c_2\sin(2t)##.

I haven’t mentioned this before, but the first two terms in the equation above represent a *particular* *solution* to the original nonhomogeneous problem. The last two terms represent the complementary solutions — they are solutions of the related homogeneous equation y” + 4y = 0.

Instead of taking the first two derivatives of y(t) above, we can save some work by taking the derivatives of ##y_p(t) = Ae^{-t} + Bte^{-t}##, the particular solution to the nonhomogeneous equation, ##y” + y = te^{-t}##.

##y_p(t)## and its first two derivatives are:

##y_p(t) = Ae^{-t} + Bte^{-t}##

##y_p'(t) = -Ae^{-t} + Be^{-t} – Bte^{-t}##

##y_p”(t) = Ae^{-t} – Be^{-t} – Be^{-t} + Bte^{-t}##

Substituting into ##y” + y = te^{-t}##, we get:

##y_p”(t) + y_p = (2A – 2B)e^{-t} + 2Bte^{-t}##, or

A = B = 1/2

The general solution of the equation of this example is ##y(t) = \frac 1 2 e^{-t} + \frac 1 2 te^{-t} + c_1\cos(2t) + c_2\sin(2t)##.

**Ex. 5**: ##y” + y = 2\cos(t)##

In operator notation, this equation is ##(D^2 + 1)y = 2\cos(t)##. The annihilator of the right side is ##(D^2 + 1)##. (The coefficient of 2 on the right side has no effect on the annihilator we choose. If an operator annihilates f(t), the same operator annihilates k*f(t), for any constant k.)

Applying the ##(D^2 + 1)## operator to both sides, we get ##(D^2 + 1)(D^2 + 1)y = (D^2 + 1)(2\cos(t)) = 0##.

In slightly different form, we see that this is ##(D^2 + 1)^2y = 0##, a fourth-order homogeneous equation whose characteristic equation has repeated roots.

For the set of fundamental solutions, we choose ##\{ \cos(t), \sin(t), t\cos(t), t\sin(t)\}##. The general solution of the fourth-order homogeneous equation is ##y(t) = c_1 \cos(t) + c_2 \sin(t) + At\cos(t) + Bt\sin(t)##. As before the terms with the coefficients of A and B make up the particular solution. The other two terms make up the complementary function, the general solution of the related homogeneous problem, y” + y = 0.

##y_p(t)## and its first two derivatives are:

##y_p(t) = At\cos(t) + Bt\sin(t)##

##y_p'(t) = A\cos(t) – At\sin(t) + B\sin(t) + Bt\cos(t)##

##y_p”(t) = -A\sin(t) – A\sin(t) – At\cos(t) + B\cos(t) + B\cos(t) – Bt\sin(t) = -2A\sin(t) – At\cos(t) + 2B\cos(t) – Bt\sin(t)##

Substituting into the nonhomogeneous equation ##y” + y = 2\cos(t)##, we can simplify things to ##-2A\sin(t) + 2B\cos(t) = 2\cos(t) \Rightarrow A = 0## and ##B = 1##, so ##y_p(t) = t\sin(t)##.

The general solution for the equation of this example is ##y(t) = c_1\cos(t) + c_2\sin(t) + t\sin(t)##.

The following table lists several operators, together with the functions that they annihilate.

Operator | Function that is annihilated |
---|---|

##D, D^2, D^3, \dots ## | 1, t, ##t^2##, ##t^3##, … |

##D – k, (D – k)^2, (D – k)^3, \dots## | ##e^{kt}, te^{kt}, t^2e^{kt},## … |

##(D^2 + 1)## | cos(t), sin(t) |

##(D^2 + 1)^2## | tcos(t), tsin(t) |

##(D^2 + 4)## | cos(2t), sin(2t) |

Former college mathematics professor for 19 years where I also taught a variety of programming languages, including Fortran, Modula-2, C, and C++. Former technical writer for 15 years at a large software firm headquartered in Redmond, WA. Current associate faculty at a nearby community college, teaching classes in C++ and computer architecture/assembly language.

I enjoy traipsing around off-trail in Olympic National Park and the North Cascades and elsewhere, as well as riding and tinkering with my four motorcycles.

[QUOTE=”PWiz, post: 5315734, member: 536763″]I think I found 2 small typos in the post. In ex 1, you said

I think in the 2nd last step ##(c_2–4c_2+3c_2)e^t## should be over there instead of ##(c_2–4c_2+c_2)e^t##.

In ex 4, you said

The 2nd solution should be ##te^{-t}## right?[/QUOTE]

Thanks for spotting these — I have fixed both of them.

Even though I looked through this stuff before publishing it, it’s still hard to catch everythin, especially when you’re working with LaTeX .

I think I found 2 small typos in the post. In ex 1, you said

[QUOTE=”Mark44″]

Substituting back into the original differential equation, I get

##9c_1e^{3t}+c_2e^t–4(3c_1e^{3t}+c_2e^t)+3(A+c_1e^{3t}+c_2e^t)=5

⇒(9c_1–12c_1+3c_1)e^{3t}+(c_2–4c_2+c_2)e^t+3A=5

⇒A=5/3##

[/QUOTE]

I think in the 2nd last step ##(c_2–4c_2+3c_2)e^t## should be over there instead of ##(c_2–4c_2+c_2)e^t##.

In ex 4, you said

[QUOTE=”Mark44″]

With a fourth-order equation, we expect the fundamental solution set to consist of four linearly independent solutions: {##e^{−t},te−t,cos(2t),sin(2t)## }.

[/QUOTE]

The 2nd solution should be ##te^{-t}## right?

[QUOTE=”PWiz, post: 5315620, member: 536763″]Great entry! Please make some more math tutorials Mark!![/QUOTE]

Thank you! I have another one in mind coming soon, and probably some more after that.

Great entry! Please make some more math tutorials Mark!!

Nice review! Some more here: http://jekyll.math.byuh.edu/courses/m334/handouts/annihilator.pdf