Ordinary Differential Equations

Ordinary Differential Equations
Henry Liu, 22 December 2008
An ordinary differential equation (ODE) is an equation which relates two variables, say,
dn y
dy d2 y d3 y
, dx2 , dx3 , . . . . If dx
x and y, and derivatives dx
n is highest ordered derivative, then the
ODE has nth order.
To solve an ODE means that we would like to find an equation linking y and x, without
derivatives. Whenever possible, one should try and get y explicitly in terms of x, although
this is sometimes not easy.
If we are asked for a “general solution”, then we have to determine the form of all
possible solutions, and we will have arbitrary constants (such as A, B, C, . . . ) involved.
If we are given more information (such as “y = ? when x = ?”), then we can determine
the solution more specifically, by determining the arbitrary constant(s) in the general
solution. Such a solution is called a “particular solution”.
We shall discuss five types of ODEs. Three of these types will be of first order, and
the other two types will be of second order.
1. First Order, Variable Separable ODEs
If it is possible to rearrange a given first ordered ODE so that terms involving x are on
one side, and terms involving y are on the other side, then the ODE is variable separable.
We may then solve such an ODE by integrating both sides, after rearranging.
Example 1. Find the general solution to
dy
= e3y sin x.
dx
Also, find the particular solution where y = 0 when x = π.
Solution. The given ODE can be rearranged to
e−3y dy = sin x dx.
Integrating both sides, we have
Z
Z
−3y
e dy =
sin x dx
1
− e−3y = − cos x + C
3
e−3y = 3 cos x + D
where D = −3C
−3y = ln(3 cos x + D)
1
y = − ln(3 cos x + D),
3
which is the general solution.
1
For the particular solution, we substitute y = 0 and x = π to find D. We have
1
0 = − ln(3 cos π + D)
3
0 = ln(−3 + D)
1 = −3 + D
4 = D.
The particular solution is y = − 13 ln(3 cos x + 4).
2. Solving First Order ODEs with the Integrating Factor Method
If we have an ODE in the form
dy
+ yP (x) = Q(x),
dx
(1)
where P (x) and
R Q(x) are given function of x, then we may solve the ODE (1) as follows.
P (x) dx
Let R(x)
=
e
, where we ignore the arbitrary constant in the integral. Note that
R
dR
P (x) dx
=e
P (x) = R(x)P (x). Now, observe that, by the product rule, we have
dx
⇒
d
dy
dR
[yR(x)] =
· R(x) + y
dx
dx
dx
dy
d
[yR(x)] =
· R(x) + yP (x)R(x).
dx
dx
(2)
So, if we multiply each term of (1) by R(x), and then applying (2), we find that
dy
· R(x) + yP (x)R(x) = Q(x)R(x)
dx
d
⇒
[yR(x)] = Q(x)R(x).
dx
(3)
Hence, if we integrate both sides of (3) with respect to
R x, and then divide by R(x),
we will have solved the ODE (1). The function R(x) = e P (x) dx is called the integrating
factor (IF), and this method is known as the “integrating factor method”.
So, to summarise in a more compact form, if we are given an ODE and we can rearrange
it to the form
dy
+ yP (x) = Q(x),
dx
then the procedure to solving it is as follows.
• Find the integrating factor (IF) R(x) = e
R
P (x) dx
(ignore the constant of integration).
• Then, write down the equation
d
[yR(x)] = Q(x)R(x).
dx
2
• Finally, integrate both sides with respect to x, and then divide by R(x).
Example 2. Find the general solution to
x
dy
− 2y = x3 + 1.
dx
Also, find the particular solution where y(1) = 32 .
Solution. The given ODE can be rearranged to
dy
2
1
− y = x2 + .
dx x
x
So, the IF is
R
R(x) = e
− x2 dx
= e−2 ln |x| = (eln |x| )−2 = |x|−2 = x−2 .
So, we have
1 −2
d
[yx−2 ] = x2 +
x = 1 + x−3
dx
x
Z
1
−2
yx = (1 + x−3 ) dx = x − x−2 + C
2
1
y = x3 − + Cx2 ,
2
which is the general solution.
For the particular solution, we substitute y =
3
1
= 13 − + C · 12
2
2
3
2
and x = 1 to find C. We have
⇒
C = 1.
The particular solution is y = x3 − 12 + x2 .
3. Homogeneous First Order ODEs
A first ordered ODE is called homogeneous if it is of the form
y
dy
=f
dx
x
for some function f .
For example, the ODE
dy
= 2y − x.
dx
is homogeneous, since it can be written as
(2x − y)
2( xy ) − 1
dy
=
.
dx
2 − xy
3
We can solve a homogeneous ODE as follows. Making the substitution y = vx and
using the product rule, we have
f (v) =
dv
dy
= x + v,
dx
dx
which is now a variable separable ODE between v and x. Indeed, we have
Z
Z
1
1
dv =
dx + C.
f (v) − v
x
We can then find v in terms of x, and substituting v =
gives y in terms of x.
y
x
back into the solution then
Example 3. Find the general solution to
(2x − y)
dy
= 2y − x.
dx
Solution. As we have already seen, we can re-write the ODE as
2( xy ) − 1
dy
=
.
dx
2 − xy
so that it is homogeneous. So, let y = vx, so that
dy
dx
dv
= x dx
+ v. Hence,
2v − 1
dv
+v =
dx
2−v
dv
2v − 1
2v − 1 − v(2 − v)
v2 − 1
x
=
−v =
=
dx
2−v
2−v
Z2 − v
Z
1
2−v
dv =
dx
2
v −1
x
x
We can find the integral on the left by the usual partial fractions method: write
2−v
A
B
=
+
,
2
v −1
v−1 v+1
and solve for A and B. We find that A = 12 and B = − 32 . So,
Z
Z
Z
2−v
1
1
3
1
dv
=
dv
−
dv
v2 − 1
2
v−1
2
v+1
1
3
= ln |v − 1| − ln |v + 1|
2
Z2
1
3
1
⇒
ln |v − 1| − ln |v + 1| =
dx = ln |x| + C
2
2
x
|v − 1|
ln
= 2 ln |x| + 2C = ln(Dx2 ),
where 2C = ln D
|v + 1|3
|v − 1|
= Dx2 .
|v + 1|3
4
So, replacing v with
y
x
gives
| xy − 1|
= Dx2 ,
| xy + 1|3
3
y
2 y
or − 1 = Dx + 1 .
x
x
We cannot really simplify much further, but if we were given that y ≥ x, then the
two terms inside the modulus signs are non-negative, and we can tidy up slightly to
y − x = D(y + x)3 .
There are some further examples of ODEs which can be solved by this method, if one
makes a ‘change of coordinates’.
Example 4. Find the general solution to the ODE
x+y−1
dy
=
.
dx
3x − y + 5
Solution. For this, we cannot quite use the previous method directly. We consider
the simultaneous equations
x + y − 1 = 0,
3x − y + 5 = 0.
These represent two lines in the (x, y)-plane which are not parallel, and hence they
meet at a point. Solving the system, we easily find that x = −1 and y = 2. So, we make
the substitution X = x + 1 and Y = y − 2. This gives us
1+
dy
x+y−1
(X − 1) + (Y + 2) − 1
X +Y
dY
=
=
=
=
=
dX
dx
3x − y + 5
3(X − 1) − (Y + 2) + 5
3X − Y
3−
Y
X
Y
X
.
From here, we can proceed as before. Letting Y = vX, we again have
dv
1+v
1 + v − v(3 − v)
1 − 2v + v 2
(v − 1)2
=
−v =
=
=
dX
3−v
3−v
3−v
Z3 − v
Z
3−v
1
dv =
dX.
(v − 1)2
X
X
Again, we must split
3−v
(v−1)2
into partial fractions. Writing
3−v
A
B
=
+
2
(v − 1)
v − 1 (v − 1)2
and solving for A and B, we have A = −1 and B = 2. So,
Z
Z
Z
3−v
1
2
dv = −
dv +
dv = − ln |v − 1| − 2(v − 1)−1
2
(v − 1)
v−1
(v − 1)2
5
⇒
−1
− ln |v − 1| − 2(v − 1)
−2(v − 1)−1
2
−1
X
2X
−
Y −X
2(x + 1)
−
(y − 2) − (x + 1)
2(x + 1)
−
y−x−3
−Y
Z
1
dX = ln |X| + C
X
= ln |X| + ln D + ln |v − 1|
= ln(D|X||v − 1|)
= ln(D|Xv − X|),
where C = ln D
=
= ln(D|Y − X|)
= ln(D|Y − X|)
= ln(D|(y − 2) − (x + 1)|)
= ln(D|y − x − 3|),
which is very much as simple as possible.
What if the simultaneous equations have no solutions? That is, what if the corresponding lines are parallel? This turns out to be fairly straightforward. We just make a
slightly different substitution.
Example 5. Find the general solution to the ODE
dy
3x + 2y + 1
=
.
dx
3x + 2y + 6
Solution. The lines 3x + 2y + 1 = 0 and 3x + 2y + 6 = 0 are parallel, so we cannot
use the same method as in the previous example. But, we can just substitute z for either
dy
dz
= 3 + 2 dx
, and then substituting
3x + 2y + 1 or 3x + 2y + 6. Say, z = 3x + 2y + 1. Then, dx
the given ODE into this will give us a variable separable equation. We have,
3x + 2y + 1
2z
3(z + 5) + 2z
5z + 15
dz
= 3 + 2.
=3+
=
=
dx
3x + 2y + 6
z+5
z+5
z+5
Z
Z
z+5
dz =
dx = x + C.
5z + 15
We can write
z+5
1z + 5 1
2 =
=
1+
,
5z + 15
5 z+3
5
z+3
so that
1
5
Z 1+
2 dz = x + C
z+3
1
(z + 2 ln |z + 3|) = x + C
5
z + ln[(z + 3)2 ] = 5x + D,
where D = 5C
3x + 2y + 1 + ln[(3x + 2y + 1 + 3)2 ] = 5x + D
−2x + 2y + ln[(3x + 2y + 4)2 ] = E,
6
where E = D − 1.
4. Second Order ODEs with Constant Coefficients
We shall describe the method of how to solve an ODE of the form
a
d2 y
dy
+ cy = f (x),
+
b
dx2
dx
(4)
where a, b and c are given, real constants, with a 6= 0, and f (x) is a given function of x,
called the forcing function of the ODE.
We first consider the case f (x) ≡ 0. That is,
a
d2 y
dy
+ cy = 0.
+
b
dx2
dx
(5)
In this case, the ODE is said to be homogeneous. To solve (5), we write out the
auxiliary equation
aλ2 + bλ + c = 0,
(6)
and solve it (either by factorisation, or by the quadratic formula). There are then three
possible forms of the general solution to (5), depending on the solutions of (6)
• If the solutions of (6) are two distinct real roots λ1 and λ2 , then the general solution
to (5) is
y = Aeλ1 x + Beλ2 x .
• If the solution of (6) is one (repeated) real root λ1 , then the general solution to (5)
is
y = (Ax + B)eλ1 x .
• If the solutions of (6) are two complex conjugate roots p + iq and p − iq, then the
general solution to (5) is
y = epx (A sin qx + B cos qx).
In each case, A and B are arbitrary constants (as usual).
Example 6. The general solutions to
d2 y
dy
− 2 − 3y = 0,
2
dx
dx
9
d2 y
dy
+ 6 + y = 0,
2
dx
dx
d2 y
dy
− 4 + 13y = 0
2
dx
dx
are, respectively
y = Ae3x + Be−x ,
y = (Ax + B)e−x/3 ,
y = e2x (A sin 3x + B cos 3x).
Now, we go back to the ODE (4). The solution will be made up of two parts. One
part, called the complementary function (CF), is obtained by solving the corresponding
ODE (5). The other part, called the particular integral (PI), is obtained by looking at
the function f (x) in (4). The PI takes a form rather similar to f (x), and we will have to
7
determine some unknown constants to find it.
We shall write yc and yp for the CF and PI respectively. The final solution to (4) is
then y = yc + yp .
The most well-known examples of f (x) are when it involves a polynomial, an exponential, a trig function: sine or cosine, or a combination of these. We now look at plenty
of examples.
Example 7. Find the general solution of
dy
d2 y
+ 2 − 8y = 2e3x .
2
dx
dx
2
dy
d y
Solution. For the CF, we solve dx
2 + 2 dx − 8y = 0, and as before, we find the solution
2x
−4x
yc = Ae + Be .
For the PI, we see the forcing function 2e3x on the right hand side of the ODE. So, we
try a solution of the form yp = αe3x , and determine α. To find α, we use the given ODE.
Firstly,
yp 0 = 3αe3x , and yp 00 = 9αe3x .
Substituting these into the ODE, we get
9αe3x + 2 · 3αe3x − 8αe3x = 2e3x
⇒
7α = 2
⇒
2
α= .
7
So, yp = 27 e3x . The final, general solution, is
2
y = Ae2x + Be−4x + e3x .
7
In general, we try yp = αekx and solve for α, if we have the forcing function cekx . But,
cekx must not be part of the CF. In Example 7, this method would fail if 2e3x is replaced
by a function of the form ce2x , or de−4x . We will come back to this problem in Examples
10 and 11.
Example 8. Find the general solution of
d2 y
dy
−
10
+ 25y = 3 sin 2x.
dx2
dx
Solution. For the CF, same as before. We find that yc = (Ax + B)e5x .
For the PI, seeing the forcing function 3 sin 2x on the right, we try yp = α sin 2x +
β cos 2x, and determine α and β. We do the same thing as before.
yp 0 = 2α cos 2x − 2β sin 2x,
yp 00 = −4α sin 2x − 4β cos 2x.
Substituting these into the ODE, we get
−4α sin 2x − 4β cos 2x − 10(2α cos 2x − 2β sin 2x) + 25(α sin 2x + β cos 2x) = 3 sin 2x.
8
We balance out the sin and cos terms. Collecting up the sin terms, we find
−4α + 20β + 25α = 3, or, 21α + 20β = 3
(7)
Collecting up the cos terms, we find
−4β + 20α + 25β = 0, or, 20α + 21β = 0
(8)
and β = − 60
.
Now, solve the simultaneous equations (7) and (8). We find that α = 63
41
41
For example, we can do this by subtracting (8) from (7), which gives α − β = 3. Hence,
63
20α − 20β = 60. Adding this to (7) gives 41α = 63, so α = 41
. Then, β = α − 3 =
63
60
− 3 = − 41 .
41
60
sin 2x − 41
cos 2x. The final, general solution, is
So, yp = 63
41
y = (Ax + B)e5x +
63
60
sin 2x −
cos 2x.
41
41
In general, if we see the forcing function c sin kx + d cos kx, we try yp = α sin kx +
β cos kx, and find α and β as above. But, there is an exception: If the auxiliary equation
gives the complex roots ±iq, giving the CF A sin qx + B cos qx, and the forcing function
contains sin qx or cos qx. We need to use something else for the PI in this case. We will
see an example of this situation in Example 12.
Example 9. Find the general solution of
dy
d2 y
− 8 + 17y = 34x2 + 2x − 5.
2
dx
dx
Solution. For the CF, again same as before. We find that yc = e4x (A sin x + B cos x).
For the PI, we see the forcing function 34x2 + 2x − 5 on the right, a polynomial of
degree 2. We try yp = αx2 + βx + γ, another polynomial of degree 2, and determine α, β
and γ. We use a procedure similar to the last example.
yp 0 = 2αx + β,
and yp 00 = 2α.
Substituting these into the ODE, we get
2α − 8(2αx + β) + 17(αx2 + βx + γ) = 34x2 + 2x − 5.
We equate the coefficients of x2 , x, and the constant terms. Collecting up the x2 terms,
we find
17α = 34 ⇒ α = 2.
Collecting up the x terms, we find
−16α + 17β = 2
⇒
17β = 2 + 16α = 34
⇒
β = 2.
Equating the constants, we find
2α − 8β + 17γ = −5
⇒
17γ = −5 − 2α + 8β = −5 − 4 + 16 = 7
9
⇒
γ=
7
.
17
So, yp = 2x2 + 2x +
7
.
17
The final, general solution, is
y = e4x (A sin x + B cos x) + 2x2 + 2x +
7
.
17
In general, if we see a polynomial an xn + an−1 xn−1 + · · · + a1 x + a0 for the forcing
function, we try yp = αn xn + αn−1 xn−1 + · · · + α1 x + α0 , and find αn , αn−1 , . . . , α1 , α0 with
the above method.
Example 10. Find the general solution of
2
d2 y
dy
− 6y = 2e2x .
−
2
dx
dx
3
Solution. As in Example 7, the CF is yc = Ae2x + Be− 2 x .
For the PI, we cannot try yp = αe2x , because this is in the form of the CF. Instead,
we simply multiply by an extra x, and use yp = αxe2x . We then just carry on as before.
By the product rule,
yp 0 = αe2x + 2αxe2x ,
yp 00 = 2αe2x + 2αe2x + 4αxe2x = 4αe2x + 4αxe2x .
Substituting these into the ODE, and then cancelling out e2x from every term, we get
2(4α + 4αx) − (α + 2αx) − 6αx = 2 ⇒ 8α + 8αx − α − 2αx − 6αx = 2
2
⇒ 7α = 2 ⇒ α = .
7
So, yp = 27 xe2x . The final, general solution, is
3
2
y = Ae2x + Be− 2 x + xe2x .
7
In general, we try yp = αxekx and solve for α, if we see the forcing function cekx , and
ce clashes with the CF like in this example.
kx
Example 11. Find the general solution of
d2 y
dy
− 8 + 16y = 3e4x .
2
dx
dx
Solution. As before, the CF is yc = (Ax + B)e4x .
For the PI, we cannot try yp = αe4x , and not even yp = αxe4x . Both of these are in
the form of the CF. So, we simply try yp = αx2 e4x . As before,
yp 0 = 2αxe4x + 4αx2 e4x ,
yp 00 = 2αe4x + 8αxe4x + 8αxe4x + 16αx2 e4x = 2αe4x + 16αxe4x + 16αx2 e4x .
10
Substituting these into the ODE and cancelling e4x , we get
2α + 16αx + 16αx2 − 8(2αx + 4αx2 ) + 16αx2 = 3
⇒
2α = 3
⇒
3
α= .
2
So, yp = 32 x2 e4x . The final, general solution, is
3
y = (Ax + B)e4x + x2 e4x .
2
In general, we try yp = αx2 ekx and solve for α, if we see the forcing function cekx , and
cekx clashes with the CF like in this example.
Example 12. Find the general solution of
d2 y
+ 9y = 2 cos 3x.
dx2
Solution. As before, the CF is yc = A sin 3x + B cos 3x.
For the PI, we cannot try yp = α sin 3x + β cos 3x, because this is in the form of the
CF. Instead, we simply multiply by an extra x, and use yp = x(α sin 3x + β cos 3x). We
then just carry on as before. By the product rule,
yp 0 = α sin 3x + β cos 3x + x(3α cos 3x − 3β sin 3x),
yp 00 = 3α cos 3x − 3β sin 3x + 3α cos 3x − 3β sin 3x + x(−9α sin 3x − 9β cos 3x)
= 6α cos 3x − 6β sin 3x − 9x(α sin 3x + β cos 3x).
Substituting these into the ODE, and collecting the sin terms, we get
−6β − 9xα + 9xα = 0 ⇒ β = 0.
Collecting the cos terms, we get
1
6α − 9xβ + 9xβ = 2 ⇒ β = .
3
So, yp = 31 x cos 3x. The final, general solution, is
1
y = A sin 3x + B cos 3x + x cos 3x.
3
In general, we try yp = x(α sin 3x + β cos 3x) and solve for α and β, if we see the
forcing function c sin kx + d cos kx, and this clashes with the CF like in this example.
Example 13. Find the general solution of
3
d2 y
dy
+ 11 − 4y = e2x (150x3 + 11x).
2
dx
dx
1
Solution. As before, the CF is yc = Ae−4x + Be 3 x .
For the PI, we see the forcing function e2x (150x3 + 11x). This is an exponential
11
multiplied by a polynomial, and we can proceed as follows. We make the substitution
y = e2x z, and we will find an ODE relating z and x. By the product rule, we have
dz
dy
= 2e2x z + e2x ,
dx
dx
2
2
2
dy
2x dz
2x d z
2x d z
2x
2x dz
2x
2x dz
+ 2e
+e
+e
= 4e z + 2e
= 4e z + 4e
.
dx2
dx
dx
dx2
dx
dx2
Substituting these into the ODE, we find that all the e2x terms will cancel. We get
d2 z dz dz
− 4z = 150x3 + 11x
3 4z + 4 + 2 + 11 2z +
dx dx
dx
d2 z
dz
3 2 + 23 + 30z = 150x3 + 11x.
dx
dx
(9)
Now, we go on to find the PI of the ODE (9), just like in Example 9 (We do not need
to worry about finding the CF of this ODE). So, try zp = αx3 + βx2 + γx + δ. Then
and zp 00 = 6αx + 2β.
zp 0 = 3αx2 + 2βx + γ,
Substituting into (9), and equating the coefficients of x3 , we get
30α = 150
⇒
α = 5.
Equating the coefficients of x2 , we find
23.3α + 30β = 0
⇒
30β = −69α = −69.5 = −345
⇒
β=−
345
23
=− .
30
2
Equating the coefficients of x, we find
23 3.6α + 23.2β + 30γ = 11 ⇒ 30γ = 11 − 18α − 46β = 11 − 18.5 − 46 −
= 450
2
450
⇒ γ=
= 15.
30
Equating the constants, we find
23 3.2β + 23γ + 30δ = 0 ⇒ 30δ = −6β − 23γ = −6 −
− 23.15 = −276
2
46
276
⇒ δ=−
=− .
30
5
This gives yp = e2x zp = e2x (5x3 −
23 2
x
2
+ 15x −
46
).
5
The final, general solution, is
1
23
46 y = Ae−4x + Be 3 x + e2x 5x3 − x2 + 15x −
.
2
5
In general, if we see a forcing function of the form ekx × (polynomial in x), then we use
this method of substituting y = ekx z to find the PI.
12
Example 14. Find the general solution of
d2 y
dy
+ 2y = 2x + cosh x.
−
3
dx2
dx
Solution. As before, the CF is yc = Aex + Be2x .
With a combination of functions for the forcing function, we simply try a PI which
is a combination. We have 2x + cosh x = 2x + 12 ex + 12 e−x . For 2x, we try αx + β. For
1 x
e , we try γxex (since γex clashes with the CF). For 12 e−x we try δe−x . So, for the PI,
2
we try yp = αx + β + γxex + δe−x . We use the same procedure to find α, β, γ and δ, by
comparing the like terms. We have
yp 0 = α + γex + γxex − δe−x ,
yp 00 = γex + γex + γxex + δe−x = 2γex + γxex + δe−x .
We substitute these into the ODE and compare the like terms. Comparing the coefficients of x, we find that 2α = 2, so α = 1. Then, comparing the constant terms, we find
that −3α + 2β = 0, so that 2β = 3α = 3, so β = 23 . Now, comparing the ex terms, we
find that
1
2
2γ + γx − 3(γ + γx) + 2γx =
1
2
⇒
⇒
δ=
⇒
−γ =
6δ =
1
2
1
γ=− .
2
Comparing the e−x terms, we find that
δ − 3(−δ) + 2δ =
So, yp = x + 32 − 21 xex +
1 −x
e .
12
1
2
⇒
1
.
12
The final, general solution, is
y = Aex + Be2x + x +
3 1 x
1
− xe + e−x .
2 2
12
Finally, as before, we can find the particular solution of a second order ODE, if we
are given more information. We will need two pieces of information if we want to find a
particular solution exactly, since there are two arbitrary constants in the general solution.
Example 15. Find the particular solution of the ODE of Example 7:
dy
d2 y
+ 2 − 8y = 2e3x ,
2
dx
dx
if y(0) = 1 and y 0 (0) = −2.
Solution. We have already seen that the general solution is y = Ae2x + Be−4x + 72 e3x .
Using y(0) = 1, we have 1 = A + B + 27 , so A + B = 57 . Now, y 0 = 2Ae2x − 4Be−4x + 67 e3x
(by differentiating the general solution), so y 0 (0) = −2 gives −2 = 2A − 4B + 76 , so
2A − 4B = − 20
, so A − 2B = − 10
. So, solving
7
7
5
A+B = ,
7
A − 2B = −
13
10
7
simultaneously, we find that A = 0 and B = 57 . Hence, the particular solution is
5
2
y = e−4x + e3x .
7
7
5. Second Order ODEs with Variable Coefficients
We now look at some second ordered ODEs with variable coefficients. We will specifically
consider those of the form
ax2
d2 y
dy
+ bx + cy = f (x),
2
dx
dx
(10)
where a, b and c are given, real constants, with a 6= 0, and again f (x) is a given function
of x, the forcing function of the ODE.
Again, the final solution to (10) will consist of a complementary function (CF) and
a particular integral (PI). The CF again comes from the solution to the case f (x) ≡ 0,
namely,
dy
d2 y
(11)
ax2 2 + bx + cy = 0.
dx
dx
To solve (11), we let yc = xλ . This gives yc 0 = λxλ−1 and yc 00 = λ(λ − 1)xλ−2 .
Substituting into (11) and cancelling xλ then gives aλ(λ − 1) + bλ + c = 0, leading to the
auxiliary equation
aλ2 + (b − a)λ + c = 0.
(12)
Solving (12) again leads to three possible forms of the general solution of yc .
• If the solutions of (12) are two distinct real roots λ1 and λ2 , then the general solution
to (11) is
y = Axλ1 + Bxλ2 .
• If the solution of (12) is one (repeated) real root λ1 , then the general solution to
(11) is
y = (A ln x + B)xλ1 .
• If the solutions of (12) are two complex conjugate roots p + iq and p − iq, then the
general solution to (11) is
y = xp (A sin(q ln x) + B cos(q ln x)).
Example 16. The general solutions to
x2
dy
d2 y
+ 4x − 4y = 0,
2
dx
dx
4x2
d2 y
dy
− 8x + 9y = 0,
2
dx
dx
x2
d2 y
dy
− 7x + 20y = 0
2
dx
dx
are, respectively
y = Ax + Bx−4 ,
y = (A ln x + B)x3/2 ,
14
y = x4 (A sin(2 ln x) + B cos(2 ln x)).
For instance, in the first case, we solve the auxiliary equation λ2 + 3λ − 4 = 0 to get
λ1 , λ2 = 1, −4.
Now, we go back to the ODE (10). Here, we shall only consider forcing functions of
the form f (x) = cxk . Note that k may not necessarily be an integer. We would like to
find the PI yp again, and our final solution will again be y = yc + yp . We first consider
the case where cxk does not clash with the CF.
Example 17. Find the general solution of
2
2d y
4x
dx2
+ 5x
dy
− 3y = 2x3 .
dx
Solution. As before, the CF is yc = Ax3/4 + Bx−1 .
For the PI, with the forcing function 2x3 , which does not clash with the CF, we just
try yp = αx3 . This gives
yp 0 = 3αx2 , and yp 00 = 6αx.
Substituting these into the ODE, we find that we can cancel x3 . This gives
4.6α + 5.3α − 3α = 2
So, yp =
1 3
x.
18
⇒
36α = 2
⇒
α=
1
.
18
The final, general solution, is
y = Ax3/4 + Bx−1 +
1 3
x.
18
In general, if the forcing function is of the form cxk and it does not clash with the CF,
then we try yp = αxk and solve for α.
Now, we consider the case where the forcing function f (x) = cxk clashes with the CF.
Example 18. Find the general solution of
2x
2d
2
y
dy
− 7x + 4y = 4x1/2 .
2
dx
dx
Solution. As before, the CF is yc = Ax1/2 + Bx4 .
For the PI, we see that the forcing function 4x1/2 does clash with the CF. In this case,
we try yp = αx1/2 ln x. This gives
1
1
1 −1/2
αx
ln x + αx1/2 . = αx−1/2 ln x + αx−1/2 ,
2
x
2
1 −3/2
1 −1/2 1 1 −3/2
1
= − αx
ln x + αx
. − αx
= − αx−3/2 ln x.
4
2
x 2
4
yp 0 =
yp 00
Substituting these into the ODE, we find that we can cancel x1/2 . This gives
1
1
4
2 − α ln x − 7 α ln x + α + 4α ln x = 4 ⇒ −7α = 4 ⇒ α = − .
4
2
7
15
So, yp = − 47 x1/2 ln x. The final, general solution, is
4
y = Ax1/2 + Bx4 − x1/2 ln x.
7
In general, we try yp = αxk ln x and solve for α, if we see the forcing function cxk , and
this clashes with the CF like in this example.
There is one further possible clash. If the forcing function is cxk , and the CF is of the
form (A ln x + B)xk . This can happen if the auxiliary equation has equal real roots. The
method in Example 18 does not quite work.
Example 19. Find the general solution of
x
2d
2
y
dy
+ 5x + 4y = x−2 .
2
dx
dx
Solution. As before, the CF is yc = (A ln x + B)x−2 .
For the PI, we see the forcing function x−2 . We cannot try yp = αx−2 , and not even
yp = αx−2 ln x, as both of these clash with the CF. We try yp = αx−2 (ln x)2 . This gives
2 ln x
= −2αx−3 (ln x)2 + 2αx−3 ln x,
x
2
ln
x
1
= 6αx−4 (ln x)2 − 2αx−3 .
− 6αx−4 ln x + 2αx−3 .
x
x
= 6αx−4 (ln x)2 − 10αx−4 ln x + 2αx−4 .
yp 0 = −2αx−3 (ln x)2 + αx−2 .
yp 00
Substituting these into the ODE, we find that we can cancel x−2 . This gives
6α(ln x)2 − 10α ln x + 2α + 5(−2α(ln x)2 + 2α ln x) + 4α(ln x)2 = 1
1
⇒ 2α = 1 ⇒ α = .
2
So, yp = 12 x−2 (ln x)2 . The final, general solution, is
1
y = (A ln x + B)x−2 + x−2 (ln x)2 .
2
In general, we try yp = αxk (ln x)2 and solve for α, if we see the forcing function cxk ,
and this clashes with the CF like in this example.
16