Inhomogeneous Linear Second-Order ODEs

We now consider second-order linear equations with a forcing term. The general form is

$$ \frac{d^2y}{dt^2} + p(t)\frac{dy}{dt} + q(t)y = g(t), \quad y(t_0) = y_0, \quad y'(t_0) = y_0' $$

The associated homogeneous equation is

$$ \frac{d^2y}{dt^2} + p(t)\frac{dy}{dt} + q(t)y = 0 $$

As before, the general solution of the inhomogeneous equation can be written as

$$ y(t) = y_p(t) + y_c(t) $$

where \( y_p(t) \) is a particular solution and \( y_c(t) \) is the complementary solution, the general solution of the homogeneous equation. The key task is therefore to determine \( y_p(t) \).

Constant Coefficient Equations and Undetermined Coefficients

Consider the constant coefficient equation

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

We already know how to find \( y_c(t) \). To find \( y_p(t) \), we use the method of undetermined coefficients. The idea is to guess a form that can reproduce \( g(t) \), and then determine the coefficients by substitution.

eg. Find a particular solution to \( \color{#00f0ff} y'' - 3y' - 4y = 3 e^{2t} \)

First solve the homogeneous equation. The characteristic equation is

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

so the complementary solution is

$$ y_c(t) = c_1 e^{-t} + c_2 e^{4t} $$

Since \( g(t) = 3 e^{2t} \) is not part of \( y_c(t) \), we guess

$$ y_p(t) = A e^{2t}, \quad y_p'(t) = 2A e^{2t}, \quad y_p''(t) = 4A e^{2t} $$

Substituting gives

$$ (4A - 6A - 4A) \, e^{2t} = 3 e^{2t} $$ $$ -6A = 3 \, \Rightarrow \, A = -\frac{1}{2} $$ $$ y_p(t) = -\frac{1}{2} \, e^{2t} $$

This illustrates the simplest case: when the forcing term does not overlap with the complementary solution, a direct exponential guess works.

eg. Find a particular solution to \( \color{#00f0ff} y'' - 3y' - 4y = -8 e^t\cos(2t) \)

From the previous example, the complementary solution is

$$ y_c(t) = c_1 e^{-t} + c_2 e^{4t} $$

Since \( g(t) = -8 e^t \cos(2t) \) is not part of \( y_c(t) \), we guess

$$ y_p(t) = A e^t \cos(2t) + B e^t \sin(2t) $$

We must include both sine and cosine terms to remain closed under differentiation

$$ y_p'(t) = (A + 2B) \, e^t \cos(2t) + (B - 2A) \, e^t \sin(2t) $$ $$ y_p''(t) = (4B - 3A) \, e^t \cos(2t) + (-3B - 4A) \, e^t \sin(2t) $$

Substitute into the differential equation:

$$ (4B - 3A) \, e^t \cos(2t) + (-3B - 4A) \, e^t \sin(2t) $$ $$ -3\left( \, (A + 2B) \, e^t \cos(2t) + (B - 2A) \, e^t \sin(2t) \, \right) $$ $$ -4\left( \, A e^t \cos(2t) + B e^t \sin(2t) \, \right) = -8 e^t \cos(2t) $$

Grouping like terms and simplifying

$$ (-10A - 2B) \, e^t \cos(2t) + (2A - 10B) \, e^t \sin(2t) = -8 e^t \cos(2t) $$ $$ -10A - 2B = -8 $$ $$ 2A - 10B = 0 \, \Rightarrow \, A = 5B $$

Solve the system. From the second equation,

$$ -10(5B) - 2B = -8 $$ $$ -52B = -8 $$ $$ \Rightarrow \quad B = \frac{2}{13}, \quad A = \frac{10}{13} $$ $$ \therefore \quad y_p(t) = \frac{10}{13} \, e^t \cos(2t) + \frac{2}{13} \, e^t \sin(2t) $$

The key point here is that the structure of the guess is dictated entirely by \( g(t) \).

Mathematical Resonance

Resonance occurs when \( g(t) \) has the same form as the complementary solution.

In this case, the usual guess fails, and we multiply by \( t^k \) to obtain a valid trial solution.

eg. Find the general solution of \( \color{#00f0ff} y'' + 5y' + 4y = e^{-4t} \)

The characteristic equation is

$$ r^2 + 5r + 4 = 0 $$ $$ r = \frac{-5 \pm \sqrt{25 - 16}}{2} = \frac{-5 \pm 3}{2} $$ $$ r = -4, \quad r = -1 $$

Therefore,

$$ y_c(t) = c_1 e^{-4t} + c_2 e^{-t} $$

Since \( g(t) = e^{-4t} \) is part of \( y_c(t) \), we guess

$$ y_p(t) = At e^{-4t} $$

Differentiate:

$$ y_p'(t) = A e^{-4t} - 4At e^{-4t} $$ $$ y_p''(t) = -4A e^{-4t} - 4A e^{-4t} + 16At e^{-4t} = -8A e^{-4t} + 16At e^{-4t} $$

Substituting

$$ -8A e^{-4t} + 16At e^{-4t} + 5A e^{-4t} - 20At e^{-4t} + 4At e^{-4t} = e^{-4t} $$ $$ -3A e^{-4t} = e^{-4t} \quad \Rightarrow \quad A = -\frac{1}{3} $$

Hence,

$$ y_p(t) = -\frac{1}{3}t \, e^{-4t} $$

The general solution is

$$ y(t) = -\frac{1}{3}t e^{-4t} + c_1 e^{-4t} + c_2 e^{-t} $$

This shows how resonance forces us to adjust the structure of the guess.

The plot below illustrates the resonance example \( y''+5y'+4y=e^{-4t} \). Since \( e^{-4t} \) already appears in the complementary solution, the usual guess \( A e^{-4t} \) fails, and we instead use \( y_p(t)=At e^{-4t} \). The extra factor of \( t \) is the signature of resonance in the method of undetermined coefficients:


Resonance See plot code

eg. Find the general solution of \( \color{#00f0ff} y'' + 4y' + 4y = e^{-2t} \)

The characteristic equation is

$$ r^2 + 4r + 4 = 0 $$ $$ (r + 2)^2 = 0 $$

so \( r = -2 \) is a repeated root, therefore

$$ y_c(t) = c_1 e^{-2t} + c_2 t e^{-2t} $$

Since \( g(t) = e^{-2t} \) and \(t e^{-2t}\) are already part of \( y_c(t) \), we multiply by \( t^2 \) and guess

$$ y_p(t) = At^2 e^{-2t} $$ $$ y_p'(t) = 2At e^{-2t} - 2At^2 e^{-2t} $$ $$ y_p''(t) = 2A e^{-2t} - 4At e^{-2t} - 4At e^{-2t} + 4At^2 e^{-2t} $$ $$ y_p''(t) = 2A e^{-2t} - 8At e^{-2t} + 4At^2 e^{-2t} $$

Substituting

$$ (2A - 8At + 4At^2) \, e^{-2t} + 4(2At - 2At^2) \, e^{-2t} + 4At^2 e^{-2t} = e^{-2t} $$

Therefore,

$$ 2A = 1 \quad \Rightarrow \quad A = \frac{1}{2} $$

Hence

$$ y_p(t) = \frac{1}{2}t^2 e^{-2t} $$

The general solution is

$$ y(t) = \frac{1}{2}t^2 e^{-2t} + c_1 e^{-2t} + c_2 t e^{-2t} $$

Reduction of Order

If the differential equation does not have constant coefficients, we may use the method of reduction of order.

Consider

$$ \frac{d^2y}{dt^2} + p(t)\frac{dy}{dt} + q(t)y = g(t) $$

Suppose we know one solution \( y_1(t) \) of the homogeneous equation. We look for a solution of the form

$$ y_p(t) = u(t) \, y_1(t) $$

Differentiate:

$$ y_p'(t) = u y_1' + u' y_1 $$ $$ y_p''(t) = u y_1'' + 2u' y_1' + u'' y_1 $$

Substituting into the differential equation and using that \( y_1 \) satisfies the homogeneous equation, terms cancel, giving

$$ u''y_1 + (2y_1' + p y_1)u' = g $$

Divide by \( y_1 \):

$$ u'' + \frac{2y_1' + p y_1}{y_1}u' = \frac{g}{y_1} $$

This is a first-order equation in \( u' \), which can be solved using an integrating factor.

The integrating factor is

$$ \mu(t) = y_1^2(t) \, e^{\int p(t)\,dt} $$

Solving the first-order equation for \( \mu(t) \), we obtain

$$ \mu(t) = \frac{\int g(t) \, y_1(t) \, e^{\int p(t)\,dt} \, dt + c}{y_1^2(t) \, e^{\int p(t) \, dt}} $$

We then integrate this final expression to obtain \( u(t) \).

Since \( y_p(t) = y_1(t) \, u(t), \) we obtain

$$ y_p(t) = y_1(t)\int \left( \frac{\int g(t) \, y_1(t) \, e^{\int p(t)\,dt}\,dt}{y_1^2(t) \, e^{\int p(t)\,dt}} \right)dt + c\,y_1(t)\int \left( \frac{1}{y_1^2(t) \, e^{\int p(t)\,dt}} \right)dt + D\,y_1(t) $$

Where the first term is a particular solution of our differential equation, the second term is a second homogeneous solution of our differential equation, and the last term is the original homogeneous solution of our differential equation. In practice, this expression already contains the entire general solution.

eg. Find a particular solution of

$$ \color{#00f0ff} ty'' - 2ty' + 2y = 4t^2, \quad t > 0 $$

given that \( \color{#00f0ff} y_1(t) = t \) is a solution of the homogeneous problem.

Using reduction of order, let

$$ y(t) = y_1(t) \, u(t) = tu(t) $$

Then

$$ y'(t) = u + tu' $$ $$ y''(t) = 2u' + tu'' $$

Substitute

$$ t(2u' + tu'') - 2t(u + tu') + 2tu = 4t^2 $$ $$ 2tu' + t^2u'' - 2tu - 2t^2u' + 2tu = 4t^2 $$ $$ t^2u'' + 2tu' - 2t^2u' = 4t^2 $$ $$ u'' + \frac{2}{t}u' - 2u' = 4 $$ $$ u'' + 2\left(\frac{1}{t} - 1\right)u' = 4 $$

This is a first-order linear equation in \( u'(t) \). The integrating factor is

$$ \mu(t) = e^{\int 2\left(\frac{1}{t} - 1\right)\,dt} $$ $$ \mu(t) = e^{2(\ln t - t)} = e^{lnt^2} e^{-2t} $$ $$ \mu(t) = t^2 e^{-2t} $$ $$ \frac{d}{dt} (u't^2 e^{-2t}) = 4t^2 e^{-2t} $$

as we assume \(\displaystyle \frac{d}{dt} ( \, \mu(t)y(t) \, ) = \mu(t)g(t) \quad \) (here \(y(t) = u'\))

$$ \int d(u't^2 e^{-2t}) = 4\int t^2 e^{-2t}\,dt $$

We now compute the integral by parts \( \displaystyle \int uv' = uv - \int vu' \)

$$ u = t^2, \quad u' = 2t $$ $$ v = -\frac{1}{2} \, e^{-2t}, \quad v' = e^{-2t} $$ $$ \int t^2 e^{-2t}\,dt = -\frac{1}{2}t^2 e^{-2t} + \int t e^{-2t}\,dt $$

For the remaining integral, let

$$ u = t, \quad u' = 1 $$ $$ v = -\frac{1}{2} \, e^{-2t}, \quad v' = e^{-2t} $$ $$ \int t e^{-2t}\,dt = -\frac{1}{2}t e^{-2t} + \frac{1}{2}\int e^{-2t}\,dt $$ $$ \int t e^{-2t}\,dt = -\frac{1}{2}t e^{-2t} - \frac{1}{4} \, e^{-2t} $$

Therefore,

$$ \int t^2 e^{-2t}\,dt = -\frac{1}{2}t^2 e^{-2t} - \frac{1}{2}t e^{-2t} - \frac{1}{4} \, e^{-2t} $$

Hence

$$ 4\int t^2 e^{-2t}\,dt = -2t^2 e^{-2t} - 2t e^{-2t} - e^{-2t} $$

So

$$ u'(t)t^2 e^{-2t} = -2t^2 e^{-2t} - 2t e^{-2t} - e^{-2t} + c $$

To find one particular solution, set \( c_1 = 0 \). Then

$$ u'(t) = -2 - \frac{2}{t} - \frac{1}{t^2} $$

Integrating,

$$ u(t) = -2t - 2\ln t + \frac{1}{t} + c_2 $$

For one particular solution, set \( c_2 = 0 \). Then

$$ u(t) = -2t - 2\ln t + \frac{1}{t} $$

Therefore,

$$ y(t) = tu(t) $$ $$ y_p(t) = t\left(-2t - 2\ln t + \frac{1}{t}\right) $$ $$ y_p(t) = 1 -2t^2 - 2t\ln t $$

eg. Use reduction of order to find a second solution to

$$ \color{#00f0ff} y'' + 2by' + b^2y = 0 $$

given that \( \color{#00f0ff} y_1(t) = e^{-bt} \) is one solution.

The characteristic equation is

$$ r^2 + 2br + b^2 = 0 $$ $$ (r+b)^2 = 0 $$

so \(r = -b\) is a repeated root

Now use reduction of order. Let

$$ y_2(t) = u(t) \, y_1(t) = u(t) e^{-bt} $$

Differentiate

$$ y_2'(t) = u'(t) e^{-bt} - bu(t) e^{-bt} $$ $$ y_2''(t) = u''(t) e^{-bt} - 2bu'(t) e^{-bt} + b^2u(t) e^{-bt} $$

Substitute

$$ u'' e^{-bt} - 2bu' e^{-bt} + b^2u e^{-bt} + 2b\left(u' e^{-bt} - bu e^{-bt}\right) + b^2u e^{-bt} = 0 $$ $$ u'' e^{-bt} - 2bu' e^{-bt} + b^2u e^{-bt} + 2bu' e^{-bt} - 2b^2u e^{-bt} + b^2u e^{-bt} = 0 $$ $$ u'' e^{-bt} = 0 $$

Since \( e^{-bt} \neq 0 \), it follows that

$$ u'' = 0 $$ $$ \therefore \, u(t) = At + B $$

and so

$$ y_2(t) = (At + B) \, e^{-bt} $$

The term \( B e^{-bt} \) is already part of the first solution \( y_1(t) \), so we may take \( B = 0 \).

Thus a second solution is

$$ y_2(t) = At e^{-bt} $$

Since constant multiples do not matter, we usually write

$$ y_2(t) = t e^{-bt} $$