Non-Homogeneous Equations
We now turn to nding solutions of a non-homogeneous second order linear equation.
1. Non-Homogeneous Equations
2. The Method of Undetermined Coecients
3. The Method of Variation of Parameters
1 Non-Homogeneous Equations
Consider the following non-homogeneous, second order linear dierential equation:
y
+ p(t)y
+ q(t)y = g(t)
Associated with each non-homogeneous equation there is a corresponding homoge-
neous equation:
y
+ p(t)y
+ q(t)y = 0
Let us suppose that y
1
(t) and y
2
(t) are both solutions to the non-homogeneous equa-
tion. Then we note that y
1
(t) y
2
(t) is a solution to the homogeneous equation:
(y
1
y
2
)
+ p(t)(y
1
y
2
)
+ q(t)(y
1
y
2
) =
y
1
y
2
+ p(t)y
1
p(t)y
2
+ q(t)y
1
q(t)y
2
= (y
1
+ p(t)y
1
+ q(t)y
1
) (y
2
+ p(t)y
2
+ q(t)y
2
)
= g(t) g(t)
= 0
In other words, the dierence between any two solutions to a non-homogeneous equa-
tion is a solution to the homogeneous equation.
This gives us a useful approach to solving non-homogeneous equations:
1. Solve the corresponding homogeneous equation. This solution is sometimes
referred to as the complementary solution, and denoted y
c
.
2. Find (any) particular solution to the non-homogeneous equation. We will denote
this particular solution y
p
(t).
1
Then any solution to the non-homogeneous equation is of the form
y(t) = y
c
(t) + y
p
(t).
Example:
Find the general solution to
y
2y
3y = e
2t
,
given that y
p
(t) =
1
3
e
2t
is a particular solution to the equation.
First we nd the complementary solution to the corresponding homogeneous equation:
y
2y
3y = 0. The characteristic equation is r
2
2r 3 = 0, which has roots
r = 1 and r = 3. So the complementary solution is
y
c
(t) = c
1
e
t
+ c
2
e
3t
.
Therefore the general solution is
y(t) = y
c
(t) + y
p
(t) = c
1
e
t
+ c
2
e
3t
1
3
e
2t
.
The diculty is in attempting to nd one solution to the non-homogeneous equation.
We will be discussing two methods to do this. The technique we will discuss today is
called the method of undetermined coecients.
2 The Method of Undetermined Coecients
The method of undetermined coecients requires us to guess the general form for a
specic solution, but with undetermined coecients. We then try to solve for the
required coecients by plugging our proposed solution into the dierential equation.
1. Multiples and Sums
2. Duplicated Solutions
Example:
Let us attempt to solve y
+ 3y
+ 2y = 5e
2t
. We rst note that the homogeneous
equation
y
+ 3y
+ 2y = 0
has characteristic equation r
2
+ 3r + 2 = 0, which has roots r = 2 and r = 1, so
the complementary solution is
y
c
(t) = c
1
e
t
+ c
2
e
2t
.
2
Now we attempt to guess a particular solution to the non-homogeneous equation.
Since the exponential function does not change much under dierentiation, we will
guess a solution of the form
y
p
(t) = Ae
2t
where A is our undetermined coecient.
Now y
p
(t) = 2Ae
2t
and y
p
(t) = 4Ae
2t
, so when we plug y
p
into the non-homogeneous
equation, we get
y
p
+ 3y
p
+ 2y
p
= 5e
2t
which becomes
4Ae
2t
+ 6Ae
2t
+ 2Ae
2t
= 5e
2t
or
e
2t
(4A + 6A + 2A) = 5e
2t
This equation will be true if we have (4A+6A+2A) = 12A = 5, so A = 5/12. Thus,
we have found a particular solution y
p
(t) =
5
12
e
2t
, so the general solution is
y(t) = y
c
(t) + y
p
(t) = c
1
e
t
+ c
2
e
2t
+
5
12
e
2t
.
The method of undetermined coecients will only work with a small selection of
non-homogeneous terms. If we have
y
+ p(t)y
+ q(t)y = g(t)
then we can use the method in the following cases, if we choose the given form for
y
p
(t):
If g(t) is Try y
p
(t) =
c e
kt
(an exponential function) Ae
kt
(another exponential function)
c
n
t
n
+c
n1
t
n1
+ +c
0
(a polynomial
of degree n)
A
n
t
n
+ A
n1
t
n1
+ + A
0
(another
polynomial of degree n)
either c cos(bt) or c sin(bt) Acos(bt)+B sin(bt) (a linear combina-
tion of both sine and cosine)
A potential problem: If any term in our proposed solution y
p
(t) happens to be
a term in the complementary solution, then parts will vanish when plugged into the
left side of the dierential equation. We will discuss this situation later.
Example:
If our non-homogeneous term is g(t) = t
4
+t, our particular solution should be of the
form
y
p
(t) = At
4
+ Bt
3
+ Ct
2
+ Dt + E.
There are a lot of constants to solve for here. Note that in general an order n
polynomial will generate another order n polynomial as the particular solution. So
3
if our g(t) is quadratic, we will have three constants to solve for, and if g(t) is cubic,
there will be four.
Example:
Solve 3y
+ y
2y = 2 cos(t). The complementary solution is
y
c
(t) = c
1
e
2t
3
+ c
2
e
t
.
Our particular solution should be y
p
(t) = Acos(t) + B sin(t), so y
p
(t) = Asin(t) +
B cos(t) and y
p
(t) = Acos(t) B sin(t).
Plugging these in to the equation gives us
3y
p
+ y
p
2y
p
=
3(Acos(t) B sin(t)) + (Asin(t) + B cos(t)) 2(Acos(t) + B sin(t))
= (3A + B 2A) cos(t) + (3B A 2B) sin(t)
= (5A + B) cos(t) + (5B A) sin(t) = 2 cos(t)
Thus we must have 5A + B = 2 and 5B A = 0. Solving the second for A gives
A = 5B. Plugging back into 5A + B = 2 reveals that 26B = 2, or B = 1/13.
Then we have A = 5B = 5/13, so we have found a specic solution
y
p
(t) =
5
13
cos(t) +
1
13
sin(t)
and the general solution is
y(t) = y
c
(t) + y
p
(t) = c
1
e
2t
3
+ c
2
e
t
+
5
13
cos(t) +
1
13
sin(t).
3 Multiples and Sums
If we have a product of two of the types of functions listed above for our non-
homogeneous term (such as a polynomial times an exponential function, or an expo-
nential times a sine), simply use the product of our proposed particular solutions:
4
If g(t) is Use y
p
(t) =
(c
n
t
n
+ c
n1
t
n1
+ + c
0
)e
kt
(a polynomial times an exponential func-
tion)
(A
n
t
n
+ A
n1
t
n1
+ + A
0
)e
kt
(another polynomial times an exponential
function)
c sin(bt)e
at
or c cos(bt)e
at
(sines or cosines times exponential func-
tions)
e
at
(Acos(bt) + B sin(bt))
(a product of an exponential function times
a linear combination of sine and cosine)
(c
n
t
n
+ c
n1
t
n1
+ + c
0
) sin(bt) or
(c
n
t
n
+ c
n1
t
n1
+ + c
0
) cos(bt)
(a polynomial times sine or cosine)
(A
n
t
n
+ A
n1
t
n1
+ + A
0
) cos(bt) +
(B
n
t
n
+ B
n1
t
n1
+ + B
0
) sin(bt)
(a polynomial times sine and another times
cosine)
(c
n
t
n
+ c
n1
t
n1
+ + c
0
)e
at
sin(bt) or
(c
n
t
n
+ c
n1
t
n1
+ + c
0
)e
at
cos(bt)
(All three togetherwhoopee!)
(A
n
t
n
+ A
n1
t
n1
+ + A
0
)e
at
cos(bt) +
(B
n
t
n
+ B
n1
t
n1
+ + B
0
)e
at
sin(bt)
(what you would expect)
(See 3.8 on p. 163 of the text for a complete summary of which terms to use. Also
note that again, there will be a special case if part of your complementary solution
shows up in your proposed y
p
.)
Example:
If the non-homogeneous term is g(t) = t
3
e
5t
, we should try for a particular solution
of the form
y
p
(t) = (At
3
+ Bt
2
+ Ct + D)e
5t
.
What if we have a sum of non-homogeneous terms of the types already mentioned?
So assume g(t) = g
1
(t) +g
2
(t). Then if y
p1
is a solution to y
+py
+qy = g
1
and y
p2
is a solution to y
+ py
+ qy = g
2
, it is clear that
(y
p1
+ y
p2
)
+ p(t)(y
p1
+ y
p2
)
+ q(t)(y
p1
+ y
p2
) = g
1
(t) + g
2
(t) = g(t).
So we can either solve each problem separately, or we can string a sequence of forms
for y
p
(t) together into one long solution and attempt to solve for all the constants at
once.
Example:
If the non-homogeneous term is g(t) = te
2t
cos(3t) + e
t
sin(2t), then our particular
solution is of the form
y
p
(t) = (At + B)e
2t
cos(3t) + (Ct + D)e
2t
sin(3t) + Ee
t
sin(2t) + Fe
t
cos(2t).
Alternatively, we could rst nd out what constants A, B, C, and D would make
y
p1
(t) = (At + B)e
2t
cos(3t) + (Ct + D)e
2t
sin(3t)
a solution to our dierential equation, then solve for E and F separately to make
y
p2
(t) = Ee
t
sin(2t) + Fe
t
cos(2t)
5
a solution. Then our specic solution would be y
p
(t) = y
p1
(t) + y
p2
(t).
Example:
To solve y
+ by
+ cy = 7t
2
e
2t
+ 3 + 18 sin(5t), we would use the general form
y
p
(t) = (At
2
+ Bt + C)e
2t
+ Dcos(5t) + E sin(5t) + F
4 Duplicated Solutions
The method of undetermined coecients will fail to give us a solution if our proposed
particular solution contains elements of the complementary solution.
Example:
We will attempt to solve y
+3y
+2y = 5e
2t
using undetermined coecients. Note
that the complementary solution is c
1
e
t
+ c
2
e
2t
.
Our proposed non-homogeneous solution is of the form y
p
(t) = Ae
2t
, but this will
fail, as it contains a homogeneous solution:
y
p
+ 3y
p
+ 2y
p
= 4Ae
2t
6Ae
2t
+ 2Ae
2t
= 0
Since 5e
2t
= 0, we cannot solve this.
Whenever the proposed specic solution to the non-homogeneous equation duplicates
the homogeneous solution (or t
n
times one of those solutions), we will have to alter
our technique. Specically, if we were to guess a specic solution y
p
(t), alter this to
ty
p
(t). (If y
p
(t) still duplicates part of the complementary solution, multiply by t
2
instead.)
Example:
Solve y
+3y
+2y = 5e
2t
using undetermined coecients. The homogeneous solution
is again c
1
e
t
+ c
2
e
2t
.
Since Ae
2t
is one of the homogeneous solutions, we adjust our guess for the specic
solution to
y
p
(t) = Ate
2t
.
Then we have
y
p
(t) = Ae
2t
2Ate
2t
= Ae
2t
(1 2t)
y
p
(t) = 4Ae
2t
+ 4Ate
2t
= 4Ae
2t
(t 1)
Plugging these in to the dierential equation yields
y
p
+ 3y
p
+ 2y
p
= 4Ae
2t
(t 1) + 3Ae
2t
(1 2t) + 2Ate
2t
= Ae
2t
(4t 4 + 3 6t + 2t)
= Ae
2t
6
Setting this equal to 5e
2t
, we nally get A = 5, and we have the specic solution
y
p
(t) = 5te
2t
which gives us the general solution
y(t) = y
c
(t) + y
p
(t) = c
1
e
t
+ c
2
e
2t
5te
2t
.
Example:
Solve y
+ 4y
= t
2
+ te
4t
.
First solve the homogeneous equation: y
+ 4y
= 0 gives us characteristic equation
r
2
+ 4r = 0, so r = 0 or r = 4. Thus the complementary solution is
y
c
(t) = c
1
+ c
2
e
4t
.
We can look at each term of the non-homogeneous term separately. For the term
g
1
(t) = t
2
, we get a specic solution of the form y
p1
(t) = A
2
t
2
+ A
1
t + A
0
. Does this
duplicate our complementary solution?
Yes! It duplicates the constant term. So we adjust our rst guess to
y
p1
(t) = t(A
2
t
2
+ A
1
t + A
0
) = A
2
t
3
+ A
1
t
2
+ A
0
t
and try plugging in and solving for A
0
, A
1
, and A
2
:
y
p1
+ 4y
p
= t
2
which becomes
6A
2
t + 2A
1
+ 4(3A
2
t
2
+ 2A
1
t + A
0
) = t
2
or
12A
2
t
2
+ (8A
1
+ 6A
2
)t + (4A
0
+ 2A
1
) = t
2
which means that we have the equations
12A
2
= 1
8A
1
+ 6A
2
= 0
4A
0
+ 2A
1
= 0
The solution is A
2
= 1/12, A
1
= 1/16, and A
0
= 1/32, so
y
p1
(t) =
1
12
t
3
1
16
t
2
+
1
32
t
Then we can move on to the second part: g
2
(t) = te
4t
. Our proposed solution would
be (At+B)e
4t
. But this duplicates the e
4t
. So instead we try y
p2
(t) = (At
2
+Bt)e
4t
.
Then after taking derivatives and simplifying we have
y
p2
(t) = e
4t
(B + (2A 4B)t 4At
2
)
y
p2
(t) = 2e
4t
(A 4B + 8(B A)t + 8At
2
)
7
and plugging this into y
+ 4y
= te
4t
gives us
(2A 4B)e
4t
8Ate
4t
= te
4t
which means that 8A = 1, so A = 1/8, and 2A 4B = 0, so B = 1/16. Thus
y
p2
(t) =
_
1
8
t
2
1
16
t
_
e
4t
Thus, we have a general solution
y(t) = y
c
(t) + y
p1
(t) + y
p2
(t) = c
1
+ c
2
e
4t
+
1
12
t
3
1
16
t
2
+
1
32
t +
_
1
8
t
2
1
16
t
_
e
4t
5 The method of Variation of Parameters
We revisit non-homogeneous equations and develop a technique to nd a non-homogeneous
solution in terms of the homogeneous solution:
1. Cramers Rule
2. Variation of Parameters
3. Using Variation of Parameters
6 Cramers Rule
We start with a brief review of Cramers rule, which tells us how to solve a system
in terms of matrices. Cramers rule will be helpful in remembering how to carry out
variation of parameters.
In order to solve the system
ax + by = m
cx + dy = n
for x and y, we can do the following:
x =
m b
n d
a b
c d
, y =
a m
c n
a b
c d
In other words, to solve for x, we take the coecient matrix and replace the x column
with the result (the right hand side of the equations.) Then we take the determinant
and divide by the determinant of the coecient matrix.
8
To solve for y, we do the same thing, except we replace the y column with the result
column.
Example:
Solve
2x + 3y = 7
4x 8y = 3
Here we have
x =
7 3
3 8
2 3
4 8
=
56 9
16 12
=
65
28
and
y =
2 7
4 3
2 3
4 8
=
6 28
28
=
22
28
=
11
14
7 Variation of Parameters
Suppose we have found a set of fundamental solutions y
1
and y
2
for the homogeneous
equation
y
+ p(t)y
+ q(t)y = 0,
so that the solutions look like y(t) = c
1
y
1
(t) +c
2
y
2
(t). How can we nd a solution to
the non-homogeneous equation
y
+ p(t)y
+ q(t)y = g(t)?
Last time, we discussed the method of undetermined coecients which worked if
we actually had constant coecients, and if g(t) was a combination of exponential
functions, polynomials, or sines and cosines. Now we attempt to nd a more general
approach.
Let us consider what happens if we allow the parameters c
1
and c
2
in the comple-
mentary solution to vary; in other words, we replace the constants with functions u
1
and u
2
:
y(t) = u
1
(t)y
1
(t) + u
2
(t)y
2
(t)
9
We no longer have a solution to the homogeneous equation, but we may be able to
nd functions u
1
and u
2
for which this y will be a solution to the non-homogeneous
equation.
We calculate y
(t), and begin to run into trouble:
y
(t) = u
1
(t)y
1
(t) + u
1
(t)y
1
(t) + u
2
(t)y
2
(t) + u
2
(t)y
2
(t)
This is a mess and the second derivative will be much worse. Let us introduce the
following additional condition on u
1
and u
2
:
u
1
(t)y
1
(t) + u
2
(t)y
2
(t) = 0 (1)
We emphasize the following: We have chosen to add the above condition because it
simplies the equation. It is not added because of any feature of the original equation.
Now we continue:
y
(t) = u
1
(t)y
1
(t) + u
2
(t)y
2
(t)
y
(t) = u
1
(t)y
1
(t) + u
1
(t)y
1
(t) + u
2
(t)y
2
(t) + u
2
(t)y
2
(t)
Plugging these into the non-homogeneous equation yields the following:
y
+ p(t)y
+ q(t)y =
[u
1
(t)y
1
(t) + u
1
(t)y
1
(t) + u
2
(t)y
2
(t) + u
2
(t)y
2
(t)] +
p(t) [u
1
(t)y
1
(t) + u
2
(t)y
2
(t)] +
q(t) [u
1
(t)y
1
(t) + u
2
(t)y
2
(t)]
If we collect like terms on u
1
and u
2
, we get the following:
y
+ p(t)y
+ q(t)y =
u
1
(t) [y
1
(t) + p(t)y
1
(t) + q(t)y
1
(t)] +
u
2
(t) [y
2
(t) + p(t)y
2
(t) + q(t)y
2
(t)] +
u
1
(t)y
1
(t) + u
2
(t)y
2
(t)
But since y
1
and y
2
are solutions to the homogeneous equation, the coecients on u
1
and u
2
are zero, and in fact we have that if y(t) = u
1
(t)y
1
(t) + u
2
(t)y
2
(t), then
y
+ p(t)y
+ q(t)y = u
1
(t)y
1
(t) + u
2
(t)y
2
(t).
Thus we must have
u
1
(t)y
1
(t) + u
2
(t)y
2
(t) = g(t) (2)
Now equation (??) and equation (??) above form a set of two equations in the two
unknowns u
1
(t) and u
2
(t), which we can then attempt to solve. Cramers rule says
that the system
u
1
(t)y
1
(t) + u
2
(t)y
2
(t) = 0
u
1
(t)y
1
(t) + u
2
(t)y
2
(t) = g(t)
10
can be solved for u
1
and u
2
as follows:
u
1
(t) =
0 y
2
(t)
g(t) y
2
(t)
y
1
(t) y
2
(t)
y
1
(t) y
2
(t)
=
y
2
(t)g(t)
W(y
1
, y
2
)
and
u
2
(t) =
y
1
(t) 0
y
1
(t) g(t)
y
1
(t) y
2
(t)
y
1
(t) y
2
(t)
=
y
1
(t)g(t)
W(y
1
, y
2
)
This is ok, because the Wronskian is non-zero. (Why? Because y
2
and y
2
are a
fundamental set of solutions.)
So we nally have a specic solution, after performing some integrations:
Y (t) = y
1
(t)
_
y
2
(t)g(t)
W(y
1
, y
2
)
dt + y
2
(t)
_
y
1
(t)g(t)
W(y
1
, y
2
)
dt.
How wonderful! Sort of. . .
8 Using Variation of Parameters
Lets use variation of parameters to solve some non-homogeneous equations.
Example:
Solve
y
3y
+ 2y =
1
1 + e
t
.
Note that this could not have been done by the method of undetermined coecients.
First, we solve the homogeneous equation to nd the complementary solution:
y
3y
+ 2y = 0
So we get characteristic equation r
2
3r + 2 = (r 2)(r 1) = 0, so r = 2 or r = 1.
Thus the complementary solution is
y
c
(t) = c
1
e
t
+ c
2
e
2t
That is, we have y
1
(t) = e
t
and y
2
(t) = e
2t
.
Second, we set up our equations for variation of parameters. We have
u
1
y
1
+ u
2
y
2
= 0 or u
1
e
t
+ u
2
e
2t
= 0
11
and
u
1
y
1
+ u
2
y
2
=
1
1 + e
t
or u
1
e
t
+ u
2
2e
2t
=
1
1 + e
t
Thus, solving for u
1
and u
2
using Cramers rule, we get
u
1
=
0 e
2t
1
1+e
t
2e
2t
e
t
e
2t
e
t
2e
2t
=
_
e
2t
1+e
t
_
(e
3t
)
=
e
t
1 + e
t
and
u
2
=
e
t
0
e
t 1
1+e
t
e
t
e
2t
e
t
2e
2t
=
_
e
t
1 + e
t
_
e
3t
=
e
2t
1 + e
t
So now we integrate:
u
1
(t) =
_
e
t
1 + e
t
dt, so we let
u = 1 + e
t
du = e
t
dt
which gives us
u
1
(t) =
_
1
u
du = ln(1 + e
t
) + C
1
Now note: We do not need the C
1
! When we take u
1
(t)y
1
(t), we will get a Cy
1
(t)
term, which is a homogeneous solution, and thus will give zero when we plug this into
the dierential equation.
Therefore, we take u
1
(t) = ln(1 + e
t
).
Similarly,
u
2
(t) =
_
e
2t
1 + e
t
dt, so we so set
u = e
t
du = e
t
dt
Here we get
u
2
(t) =
_
e
t
(e
t
dt)
1 + e
t
=
_
u
1 + u
du
We can reduce this by division to
_
u
1 + u
du =
_
1
1
1 + u
du = u + ln |1 + u| + C = e
t
+ ln(1 + e
t
) + C
2
We discard the constant C
2
for the same reason we discarded the C
1
, and we get
u
2
(t) = ln(1 + e
t
) e
t
.
So nally, we have the particular solution
Y (t) = u
1
(t)y
1
(t) + u
2
(t)y
2
(t) = ln(1 + e
t
)e
t
+
_
ln(1 + e
t
) e
t
_
e
2t
.
12
So the general solution must be
y(t) = y
c
(t) + Y (t) = c
1
e
t
+ c
2
e
2t
+ ln(1 + e
t
)e
t
+
_
ln(1 + e
t
) e
t
_
e
2t
Notice by the way that if we had chosen to leave constants C
1
and C
2
after integrating
u
1
and u
2
, we would in fact have the general solution when we computed
y(t) = (u
1
(t) + C
1
)y
1
(t) + (u
2
(t) + C
2
)y
2
(t).
We could also simplify our answer algebraically to be much shorter, since several
terms will cancel or can be grouped together:
y(t) = c
1
e
t
+ c
2
e
2t
+ ln(1 + e
t
)e
t
+
_
ln(1 + e
t
) e
t
_
e
2t
= c
1
e
t
+ c
2
e
2t
+ ln(1 + e
t
)e
t
+ ln(1 + e
t
)e
2t
e
t
=
_
c
1
+ ln(1 + e
t
)
_
e
t
+
_
c
2
+ ln(1 + e
t
)
_
e
2t
(In the last step, we also renamed c
1
as c
1
1.)
Example:
Solve y
+ y = sec(t) tan(t).
First, we solve the homogeneous equation: The characteristic equation is r
2
+ 1 = 0,
so we get r =. Thus, our fundamental solutions are y
1
(t) = cos(t) and y
2
(t) = sin(t).
Second, we calculate our specic solution from variation of parameters. We need to
solve
u
1
y
1
+ u
2
y
2
= 0 or u
1
cos(t) + u
2
sin(t) = 0
and
u
1
y
1
+ u
2
y
2
= sec(t) tan(t) or u
1
sin(t) + u
2
cos(t) = sec(t) tan(t).
Thus, using Cramers rule we get
u
1
(t) =
and
u
2
(t) =
So we get
u
1
(t) =
13
and
u
2
(t) =
Finally, we have a particular solution
Y (t) =
and the general solution
y(t) =
14