You are on page 1of 200

Ordinary

Differential Equations

Ordinary
Differential Equations:
Methods and Applications

W. T. Ang and Y. S. Park

Universal Publishers
Boca Raton

Ordinary Differential Equations: Methods and Applications


Copyright 2008 W. T. Ang and Y. S. Park
All rights reserved.
No part of this book may be reproduced or transmitted in any form
or by any means, electronic or mechanical, including photocopying,
recording, or by any information storage and retrieval system,
without written permission from the publisher
Universal Publishers
Boca Raton, Florida USA
2008
ISBN-10: 1-59942-975-6/ISBN-13: 978-1-59942-975-5 (paper)
ISBN-10: 1-59942-974-8/ISBN-13: 978-1-59942-974-8 (ebook)
www.universal-publishers.com

Library of Congress Cataloging-in-Publication Data


Ang, W. T., 1961Ordinary differential equations : methods and applications / W.T.
Ang and Y.S. Park.
p. cm.
Includes bibliographical references and index.
ISBN 978-1-59942-975-5 (pbk. : alk. paper)
1. Differential equations. I. Park, Y. S., 1964- II. Title.
QA372.A598 2008
515'.352--dc22
2008026023

To our parents
Everywhere, we learn from those whom
we love Johann Wolfgang von Goethe

Preface
This introductory course in ordinary dierential equations
is intended for junior undergraduate students in applied mathematics, science and engineering. It focuses on methods of solutions and applications rather than theoretical analyses. Applications drawn mainly from dynamics, population biology and
electric circuit theory are used to show how ordinary dierential equations appear in the formulation of problems in science
and engineering.
The calculus required to comprehend this course is rather elementary, involving dierentiation, integration and power series
representation of only real functions of one variable. A basic
knowledge of complex numbers and their arithmetic is also assumed, so that elementary complex functions which can be used
for working out easily the general solutions of certain ordinary
dierential equations can be introduced. The pre-requisites just
mentioned aside, the course is mainly self-contained.
The course comprises six chapters.
Chapter 1 gives the basic concepts of ordinary dierential
equations, explaining what an ordinary dierential equation is
and what is involved in solving such an equation. It also illustrates how ordinary dierential equations can be derived from
physical laws or basic principles for two specific examples of
problems.
In Chapter 2, methods of solution are given for some first
order ordinary dierential equations. The equations studied
include those which can be written in separable form, those
which are linear, and the nonlinear Bernoulli dierential equation. Mathematical models which describe population growth
are given as examples of applications involving first order ordinary dierential equations.
v

In Chapter 3, the mathematical theory for constructing general solutions of second order linear ordinary dierential equations is studied. It is applied to obtain general solutions of second order linear ordinary dierential equations with constant
coecients and the Euler-Cauchy equations. Also discussed
is the extension of the theory to higher order linear ordinary
dierential equations.
Chapter 4 shows how linear ordinary dierential equations
with constant coecients arise in the formulation of problems
involving electric circuits and spring-mass systems. Specific
examples of problems are solved.
Chapter 5 introduces the power series method and the Frobenius method for deriving series solutions of rather general homogeneous second order linear ordinary dierential equations.
The methods studied can be applied to solve some well known
ordinary dierential equations in mathematical physics, such as
the Legendres equation and the Bessels equation, giving rise
to particular special functions, but those equations and the associated special functions are not examined in this course.
Chapter 6 describes some simple numerical methods for
solving first and second order ordinary dierential equations.
For a particular example of applications, the second order nonlinear ordinary dierential equation which governs the motion
of a swinging pendulum is solved numerically.
Exercises are set not only to test the understanding of students but sometimes also to impart additional insights into the
materials studied. Suggested solutions to all the exercises are
given at the end of the chapters. To promote the use of this
course for self-study, the solutions provided are by and large
complete with details.
W. T. Ang and Y. S. Park, Singapore, 2008

vi

Contents
1 Basic concepts
1.1 What is an ODE?
. . . . . . .
1.2 Solving an ODE . . . . . . . . . .
1.2.1 General solution . . . . . .
1.2.2 Particular solution . . . . .
1.2.3 Exact solution . . . . . . .
1.3 Exercise I . . . . . . . . . . . . . .
1.4 Why study ODEs? . . . . . . . . .
1.4.1 ODE for a body in motion
1.4.2 ODE for a pursuit problem
1.5 Exercise II . . . . . . . . . . . . . .
1.6 Solutions to Exercise I . . . . . . .
1.7 Solutions to Exercise II . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

10
10
11
12
12
12
13
14
14
18
20
22
24

2 First order ODEs


2.1 Preamble . . . . . . . . . . . . . . . . . . . . .
2.2 First order ODEs in separable form . . . . . . .
2.3 Linear 1st order ODEs . . . . . . . . . . . . . .
2.3.1 Homogeneous linear 1st order ODEs . .
2.3.2 Nonhomogeneous linear 1st order ODEs
2.4 Bernoulli dierential equation . . . . . . . . . .
2.5 Population dynamics . . . . . . . . . . . . . . .
2.5.1 Malthus theory of unlimited growth . .
2.5.2 Verhulst theory of limited growth . . . .
2.6 Exercise III . . . . . . . . . . . . . . . . . . . .
2.7 Solutions to Exercise III . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.

27
27
27
33
34
34
36
38
38
39
41
43

vii

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

3 Second order linear ODEs


3.1 Preamble . . . . . . . . . . . . . . . . . . . . . .
3.2 General solution of homogeneous 2nd order linear ODE . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Linearly independent functions . . . . . .
3.2.2 Construction of general solution . . . . .
3.3 Homogeneous 2nd order linear ODEs with constant coecients . . . . . . . . . . . . . . . . . .
3.4 Euler-Cauchy equations . . . . . . . . . . . . . .
3.5 Exercise IV . . . . . . . . . . . . . . . . . . . . .
3.6 Solving nonhomogeneous ODEs . . . . . . . . . .
3.6.1 Finding a particular solution by guesswork
3.6.2 Method of variation of parameters . . . .
3.7 Extension to higher order linear ODEs . . . . . .
3.7.1 General N -th order linear ODEs . . . . .
3.7.2 General solution of a homogeneous ODE .
3.7.3 General solution of a nonhomogeneous linear ODE . . . . . . . . . . . . . . . . . .
3.8 Exercise V . . . . . . . . . . . . . . . . . . . . . .
3.9 Solutions to Exercise IV . . . . . . . . . . . . . .
3.10 Solutions to Exercise V . . . . . . . . . . . . . .
4 Circuits and springs
4.1 Preamble . . . . . . . . . . . . . . . . . . . . .
4.2 Electric circuits . . . . . . . . . . . . . . . . . .
4.2.1 Basic electrical components . . . . . . .
4.2.2 Voltage across an electric component . .
4.2.3 ODEs in electric circuits . . . . . . . . .
4.3 Exercise VI . . . . . . . . . . . . . . . . . . . .
4.4 Spring-mass systems . . . . . . . . . . . . . . .
4.4.1 A simple spring-mass system . . . . . .
4.4.2 A more complicated spring-mass system
4.5 Exercise VII . . . . . . . . . . . . . . . . . . . .
4.6 Solutions to Exercise VI . . . . . . . . . . . . .
4.7 Solutions to Exercise VII . . . . . . . . . . . .

viii

.
.
.
.
.
.
.
.
.
.
.
.

49
49
50
50
52
55
64
70
71
72
78
81
81
81
82
83
85
89
96
96
96
96
98
99
109
109
109
115
118
119
124

5 Series solutions
5.1 Preamble . . . . . . . . . . . .
5.2 Review of power series . . . .
5.3 Power series method for ODEs
5.4 Exercise VIII . . . . . . . . . .
5.5 Frobenius method . . . . . . .
5.6 Exercise IX . . . . . . . . . . .
5.7 Solutions to Exercise VIII . . .
5.8 Solutions to Exercise IX . . . .

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.

128
. 128
. 128
. 131
. 146
. 147
. 161
. 162
. 167

6 Numerical methods
176
6.1 Preamble . . . . . . . . . . . . . . . . . . . . . . 176
6.2 Eulers method for 1st order ODEs . . . . . . . . 176
6.3 Second order ODEs . . . . . . . . . . . . . . . . . 183
6.4 Oscillation of a pendulum . . . . . . . . . . . . . 187
6.4.1 Nonlinear ODE . . . . . . . . . . . . . . . 187
6.4.2 ODE for very small oscillation . . . . . . 188
6.4.3 Numerical solution for larger oscillation 189
6.5 Numerical prudence . . . . . . . . . . . . . . . . 191
6.6 Exercise X . . . . . . . . . . . . . . . . . . . . . . 191
6.7 Solutions to Exercise X . . . . . . . . . . . . . . 194

ix

Chapter 1

Basic concepts
1.1

What is an ODE?

An equation which contains the derivative(s) of a yet to be


determined function y(x) (a function of one variable) is called
an ordinary dierential equation (ODE) in y(x).
Below are some examples of ODEs in y(x):
(1)
(2)
(3)
(4)

dy
2x = 0
dx
dy
d2 y
2y(x) = x5
+3
2
dx
dx
d3 y
d2 y
x3 3 + 6x2 2 3xy(x) = sin(2x)
dx
dx
4y
d
d2 y
2x2 (y(x))10 4 + 3x 2 = xy(x)
dx
dx

An ODE in y(x) is said to be of order N if dN y/dxN is the


highest order derivative of y(x) present in the ODE.
In the examples above, (1) is an ODE of order 1 (or 1st
order ODE); (2) is of order 2; (3) is of order 3; and (4) is of
order 4.
It may be sometimes convenient to use the notation
y0 (x) =

dy 00
d2 y
d3 y
dN y
, y (x) = 2 , y 000 (x) = 3 , , y (N) (x) = N .
dx
dx
dx
dx
10

Thus, we may write the 4th order ODE in (4) above as


2x2 (y(x))10 y 0000 (x) + 3xy 00 (x) = xy(x),
or even more simply as
2x2 y 10 y 0000 + 3xy 00 = xy
if it is already understood that y is a function of x. Note that
y 10 above refers to y raised to the power 10, not to be mistaken
as the 10th order derivative y(10) = d10 y/dx10 .
More generally, we may regard an ODE in y(x) as an equation of the general form
F (x, y, y 0 , y00 , y 000 , , y (N1) , y (N) ) = 0.
Here F denotes a mathematical expression involving x, y, y 0 ,
y00 , y 000 , , y (N1) and y (N) .

1.2

Solving an ODE

Given an ODE in y(x), we are interested in finding functions


y(x) that satisfy the equation, that is, we are interested in
solving the ODE.
For the purpose of illustration, let us now consider solving
the ODE
y 00 6x = 0
which may be rewritten as
d2 y
= 6x.
dx2
We may solve the ODE above by directly integrating it twice
with respect to x, that is,
Z
dy
= 6xdx = 3x2 + C
dx
Z
y = (3x2 + C)dx = x3 + Cx + D.
11

Here C and D are constants which may have any values (arbitrary constants).
Thus, we find that y(x) = x3 + Cx + D (where C and D
are arbitrary constants) satisfies the ODE y00 6x = 0.
Not all ODEs may be easily solved by direct integration like
in the example above. In subsequent chapters, we will look at
various methods for solving ODEs.

1.2.1

General solution

From the example above, it appears that solving an ODE is


really undoing the derivatives in the ODE.
Roughly speaking, if an ODE is of order N, we are required
to integrate it N times in order to solve it. Consequently, N
arbitrary constants appear in the solution obtained.
For our purpose, we regard any function y(x) with N arbitrary constants in it as a general solution of an N -th order
ODE, if the function satisfies the ODE.
Thus, we may regard y(x) = x3 + Cx + D as a general
solution of the ODE y 00 6x = 0.

1.2.2

Particular solution

If some or all of the arbitrary constants in a general solution of


an ODE assume specific values, we obtain a particular solution
of the ODE.
Examples of particular solutions of the ODE y 00 6x = 0
are y(x) = x3 + x + D, y(x) = x3 + Cx 2 and y(x) = x3 3x.

1.2.3

Exact solution

We regard a solution of an ODE as exact if the solution can be


directly expressed in terms of elementary functions1 .
Thus, the general solution y(x) = x3 + Cx + D of the ODE
00
y 6x = 0 is exact. If the values of C and D are given, we
1

For our purpose, a function is regarded as elementary if it can be


calculated directly using the function keys of an ordinary scientific hand
calculator. Thus, cos(x), sin(x), exp(x) and g(x) = x3 1 are elementary.

12

may readily evaluate y(x) = x3 + Cx + D for any value of x by


using an ordinary hand calculator.
We may not be able to find exact solutions of some ODEs.
For example, take the ODE
dy
sin(x)
=
dx
x
whose solution is theoretically given by
Z
sin(x)
dx.
y=
x
It is, however, not possible to express the integral (on the right
hand side) in terms of elementary functions. Thus, the ODE
does not have an exact solution.

1.3

Exercise I

1. Check by direct substitution whether y(x) = ex + 2ex is


a solution of each of the following ODEs in y(x) or not.
(Substitute y(x) = ex + 2ex into the left hand side of a
given ODE and simplify to see if it is possible to obtain
the right hand side.)
(a)
(b)
(c)
(d)

y 00 y = 0

y 000 + 3y 00 2y0 = 2ex 4ex

2y00 + 2y 0 3y = e2x + 5ex


y 000 + 3y 00 y0 3y = 0

2. Find out whether each of the following functions is a solution of the ODE p0000 (x) 5p00 (x) 36p(x) = 0 or not.
(a)

p(x) = 2 sinh(3x)

(b)

p(x) = cosh(2x)

(c)

p(x) = cos(3x) sin(3x)

(d)

p(x) = 2 sin(2x) + 3 cos(2x)

13

3. If y(x) = sin(2x) + cos(2x) is a solution of the ODE


y 00 + 4y 0 + 3y = 3 sin(2x), find the constants and .
(Hint. Substitute y(x) = sin(2x) + cos(2x) into the
ODE and choose the constants and in such a way
that the equation is satisfied for all x.)
4. If y (x) = + x + x2 is a solution of the ODE x3 y 000 +
x2 y 00 y = x2 + 2x + 1, find the constants , and .
5. Each of the following ODEs in y(x), if rewritten in an appropriate form, can be solved by direct integration. Find
general solutions of these ODEs.
0
(a)
xy = x6 + 5x
(b)

y 0 ex = 5

(c)

y 00 + 6x2 2 = 0

(d)

xy 0 + y = 4x3 + 2x (Hint.

d
dy
(xy) = x
+ y)
dx
dx

6. Verify that
y(x) =

5
2 cos(x) + 4 sin(x) + 10e2x

is a solution of the ODE y0 + y y 3 sin(x) = 0. (Hint.


Dierentiate the solution with respect to x to obtain
y 0 = (sin(x) 2 cos(x) 10e2x )y 3 /5. You may do this
by squaring both sides of the solution first.)

1.4

Why study ODEs?

Some problems in science and engineering may be formulated


in terms of ODEs. Below are two examples of such problems.
More examples will be given in later chapters.

1.4.1

ODE for a body in motion

Consider the motion of a body which is dropped at some height


above the ground.
14

We assume that the body, which is pulled by gravity towards the earth, moves along a straight line which is perpendicular to the surface of the earth (that is, it moves along a
vertical path). In addition to gravity, the body is also acted
upon by a force due to air resistance.
A sketch of the situation is given in Figure 1.1. Let s(t)
be the vertical downward displacement (in meter) of the body
from a fixed point P (which may lie on the path of motion)2 .
We are interested in finding s(t), that is, the position of the
body at time t.

Figure 1.1
All motion obeys Newtons law which may be stated as
follows.
If the mass of a moving body is constant, then the
total force (in newton) acting on the body is equal
to the product of the mass (in kilogram) and the
2

We define s(t) to be the downward displacement of the object from P


at time t. This means that s(t) > 0 if the object is below P at time t, and
s(t) < 0 if it is above P. It is, of course, possible to choose P in such a way
that s(t) > 0 at all time t during which the object is falling.

15

acceleration (in meter per second per second) of the


body.
Force and acceleration are vectors. In simple terms, a
vector is a quantity which has a magnitude and a direction.
Thus, Newtons law as stated above implies that the force and
the acceleration are in the same direction.
For the situation depicted in Figure 1.1, Newtons law is
simply:
(total downward force acting on body)
= (mass of body) (downward acceleration of body).
As mentioned above, we assume that there are only two
types of forces acting on the body, namely gravity and air resistance.
The gravitational force has a magnitude given by mg, where
m is the mass of the body and g is the acceleration due to
gravity (that is, g ' 9.81 meter per second per second near
planet earth). The gravitational force acts downward.
The magnitude of the force due to air resistance is taken
to be given by k|s0 (t)|. Here k is a positive coecient which
depends on, among other things, the shape of the body. The
derivative s0 (t) is the downward velocity3 of the body. In this
case, s0 (t) is always greater than zero at any time t during the
motion as the body is always moving towards the ground. The
force due to air resistance acts upward against the motion of
the body.
It is obvious that
(total downward force on body)

= mg k|s0 (t)|
= mg ks0 (t)

(since s0 (t) > 0).

The downward acceleration of the body is given by s00 (t).


Newtons law now becomes
mg ks0 (t) = ms00 (t).
Downward velocity implies that s0 (t) > 0 if the object is moving
downward, and s0 (t) < 0 if it is moving upward.
3

16

The above equation is an ODE in s(t) which may be rewritten as


s00 (t) +

k 0
s (t) g = 0.
m

If we can solve the ODE for s(t), we can predict the position
of the body at any time t during which it is moving towards
the earth. For the case in which k is a non-zero constant, the
ODE may be solved using methods of solution in later chapters
(see Problem 3 in Exercise V on page 84).
For now, let us consider the special case in which the eect
of air resistance on the motion is so small that it may be ignored, that is, we take k/m in the ODE to be zero. For such a
case, the ODE which describes Newtons law of motion reduces
to
s00 (t) g = 0 or s00 (t) = g.
This simpler ODE may be solved by directly integrating it
twice with respect to t. Bearing in mind that g is a constant,
we obtain
Z
ds
= gdt = gt + C
dt
Z
1
s(t) = (gt + C)dt = gt2 + Ct + D.
2
Here C and D are arbitrary constants.
To calculate the position of the body, we need to know the
values of the constants C and D. The values of these constants
may be determined if the displacement and velocity of the body
are known at a certain time.
For example, if we are told that s0 (t) = 3 (meter per second)
when t = 0 (second) then
3 = g 0 + C C = 3.
Furthermore, if s(t) = 2 (meter) at t = 0, we obtain
1
2 = g 02 + 3 0 + D D = 2.
2
17

Thus, if there is no air resistance, and if the displacement


and velocity at t = 0 are 2 and 3 (in the appropriate units)
respectively, then the displacement of the body is given by
1
s(t) = gt2 + 3t + 2
2
at any time t during which the body is falling towards the
ground.

1.4.2

ODE for a pursuit problem

With reference to a Cartesian coordinate system denoted by


Oxy, consider the following pursuit problem. At time t = 0, a
navy ship is at (a, 0), where a > 0, and it spots a small boat
at (0, 0). The boat moves with a constant speed u along the
positive y axis. The navy ship decides to chase after the boat
by moving at a constant speed v and in a direction that is
always directed at the boat. We are interested in finding the
path of the navy ship.

Figure 1.2
A geometrical sketch of the problem is given in Figure 1.2.
Let the path be given by the curve y = p(x), where p(x) is an
18

unknown function yet to be determined. The position of the


boat at time t is B (0, ut) (along the y axis). At time t, the
navy ship is located at N (x, p(x)). Now the line NB (dotted
line in Figure 1.2) is tangential to the path y = p(x) at N
because the navy ship is always directed at the boat. Thus, the
gradient of N B is equal to the gradient of the tangent to the
curve y = p(x) at the point N (x, p(x)), that is,
p(x) ut
x
xp0 (x) = p(x) ut.
p0 (x) =

Since the ship is moving, x and y are functions of t. Let us


dierentiate the above equation once with respect to t. Using
the chain rule for dierentiation, we obtain
xp00 (x)

dx
dx
dx
+ p0 (x)
= p0 (x)
u
dt
dt
dt

which simplifies to
xp00 (x)

dx
= u.
dt

Note that dx/dt and dy/dt are the x and y components of


the velocity of the navy ship. Since its speed is v, we may write
r
dx
dy
( )2 + ( )2 = v.
dt
dt
From y = p(x) and the chain rule for dierentiation, we find
that
dy
dx
= p0 (x) .
dt
dt
Thus,
r

dx 2
) (1 + (p0 (x))2 ) = v
dt
v
dx
= p
.
dt
1 + (p0 (x))2
(

19

From Figure 1.2, it is clear that dx/dt < 0 as the x-coordinate


of the ship decreases during the pursuit of the boat. Thus, we
take
dx
v
.
= p
dt
1 + (p0 (x))2
Substituting the above expression for dx/dt into the equation xp00 (x)dx/dt = u, we obtain the 2nd order ODE in p(x)
given by
up
xp00 (x)
1 + (p0 (x))2 = 0
v
If we can solve this ODE for p(x), we obtain a formula for the
path taken by the navy ship when it chases after the small boat.
The two arbitrary constants in the general solution of the ODE
may be determined from the conditions p(a) = 0 and p0 (a) = 0.
(Can you see how the conditions come about?)
The ODE may be converted into a 1st order ODE and solved
as explained in Chapter 2 (on page 30).

1.5

Exercise II

1. An extremely thin wire lies along the x-axis from x = 0


to x = ` (` is the length of the wire). The temperature
in the wire varies from one point to the next along the
wire, that us, it is a function of x. If it is denoted by
T (x), then that under certain conditions T (x) satisfies
the simple 2nd order ODE
d2 T
= 0.
dx2
If temperature is given by T0 and T` at x = 0 and x = `
respectively, find the temperature throughout the whole
wire.
2. The tangent to a curve at the point (x, y) has gradient
given by x3 + 2x + 1. If the equation of the curve is given
by y = p(x), write down an ODE in p(x). Find the curve
given that (1, 2) is a point on it.
20

3. The tangent to a curve at the point (x, y) has gradient


given by (x y)/x. If the equation of the curve is given
by y = p(x), write down an ODE in p(x). Find the curve
given that (1, 1) is a point on it. (Hint. Use the formula
d
dp
(xp(x)) = x
+ p(x) to help you to solve the ODE.)
dx
dx

4. A body is moving to the right along a horizontal line. Its


speed at time t 0 is given by 8t3 + 3t2 + 1. If w(t) is
the distance of the body from a fixed point P on the line,
write down an ODE in w(t) for the motion of the body.
Where is the body at time t = 2 given that it is a unit
distance away from P at time t = 0?
5. A body of 1 kilogramme is moving to the right along a
horizontal line. It is acted upon by a rightward force
given by F (t) = 1 + e2t (in newton) at time t (in second). If s(t) is the rightward displacement (in meter) of
the body from a fixed point P on the line, use Newtons
law of motion to write down an ODE in s(t). Find the
displacement of the body at time t = 1 given that it is at
rest at the point P at time t = 0.
6. The uniform temperature of a body at time t is given by
T (t). The rate of change of the body temperature per unit
time is given by c(T (t) Tambient ), where Tambient is the
constant temperature of the surrounding atmosphere and
c is a constant. Express the statement in the last sentence
by writing down an ODE in T (t). What can you say
about the constant c? (Hint. To find out something about
c, ask whether the body should be gaining or losing heat
to its surrounding when T (t) > Tambient . What about
when T (t) < Tambient ?)

21

1.6

Solutions to Exercise I

1. From y = ex + 2ex , we have y 0 = ex 2ex , y00 =


ex + 2ex = y and y 000 = ex 2ex = y0 . Thus:
(a)

y 00 y = 0 (from y 00 = y).

Yes. (y = ex + 2ex is a solution of the ODE.)


(b)

y 000 + 3y 00 2y0 = 2ex + 8ex 6= 2ex 4ex .

No. (y = ex + 2ex is not a solution of the ODE.)


(c)
(d)

2y00 + 2y 0 3y = ex 6ex

6= e2x + 5ex . No.

y 000 + 3y 00 y0 3y

= y 0 + 3y y 0 3y = 0. Yes.
2. (a) p = 2 sinh(3x), p0 = 6 cosh(3x), p00 = 18 sinh(3x) =
9p, p000 = 9p0 and p0000 = 9p00 = 81p. Thus,
p0000 5p00 36p = 81p 45p 36p = 0.
Yes, p = 2 sinh(3x) is a solution of the given ODE.
(b) p = cosh(2x), p0 = 2 sinh(2x), p00 = 4 cosh(2x) = 4p,
p000 = 4p0 and p0000 = 16p. Thus,
p0000 5p00 36p = 16p 20p 36p 6= 0.
No, p = 2 cosh(2x) is not a solution of the given ODE.
(c) p(x) = cos(3x) sin(3x) is not a solution.
(d) p(x) = 2 sin(2x) + 3 cos(2x) is a solution.
3. Substitute y = sin(2x) + cos(2x) into ODE, we obtain
( 8) sin(2x) + ( + 8) cos(2x) = 3 sin(2x).
Thus, for the ODE to be satisfied for all x, we require
+ 8 = 3 and 8 = 0. This gives = 3/65 and
= 24/65.
22

4. Substitute y = + x + x2 into ODE to obtain


x + x2 = x2 + 2x + 1.
This gives = 1, = 2 and = 1.
5. (a) Rewrite ODE as
dy
= x11/2 + 5x1/2
dx
and integrate directly once to obtain
y=

2 13/2 10 3/2
+ x + C.
x
13
3

(b) Rewrite ODE as


y 0 = 5ex
and integrate to obtain
y = 5ex + C.
(c) Rewrite ODE as
d2 y
= 6x2 + 2
dx2
and integrate twice to obtain
1
y = x4 + x2 + Cx + D.
2
(d) Rewrite ODE as
d
(xy) = 4x3 + 2x.
dx
Integrate once to obtain
xy

x4 + x2 + C

y = x3 + x +
23

C
.
x

6. It may be very tedious to proceed by directly dierentiating


s
5
y(x) =
.
2 cos(x) + 4 sin(x) + 10e2x
Instead, rewrite the above as
y2

5
(2 cos(x) + 4 sin(x) + 10e2x )
y 2 (2 cos(x) + 4 sin(x) + 10e2x ) = 5
=

and dierentiate both sides with respect to x to obtain


5
) + y2 (2 sin(x) + 4 cos(x) + 20e2x ) = 0
y2
10y0 = y3 (2 sin(x) + 4 cos(x) + 20e2x )
2yy 0 (

10y0 + 10y 10y3 sin(x)


5(2 sin(x) 4 cos(x) 20e2x )
= y[
+ 10
2 cos(x) + 4 sin(x) + 10e2x
50 sin(x)
+
]
2 cos(x) + 4 sin(x) + 10e2x
= 0 y 0 + y y 3 sin(x) = 0 (as required).

1.7

Solutions to Exercise II

1. The conditions are T (0) = T0 and T (`) = T` . Solving the


ODE, we find that
d2 T
dT
=0
= C T = Cx + D.
2
dx
dx
Applying the conditions, we obtain
T (0) = T0 = D
T (`) = T` = C` + T0 C =
Thus, the required temperature is
T (x) =

T` T0
x + T0 .
`
24

T` T0
.
`

2. The ODE giving the tangent of the curve is


dp
= x3 + 2x + 1.
dx
Integrating, we obtain
1
p(x) = x4 + x2 + x + C.
4
From the point (1, 2), we know p(1) = 2. Thus,
1
1
+1+1+C =2C = .
4
4
The required curve is
1
1
y = x4 + x2 + x .
4
4
3. The ODE is
dp
dx

xp
x

xp0 + p = x

d
(xp) = x.
dx

Integrating, we obtain
1
1
C
xp = x2 + C p = x + .
2
2
x
From the point (1, 1), we have p(1) = 1, that is, C =
1/2. Thus, the required curve is
1
1
y = x
(for x > 0).
2
2x
4. The ODE is
dw
= 8t3 + 3t2 + 1
dt
which can be integrated to obtain
w = 2t4 + t3 + t + C.
From w(0) = 1, we find that C = 1. Thus, w(2) = 42+1 =
43.
25

5. The ODE is
d2 s
= 1 + e2t .
dt2
Integrating, we find that
1
1
1
ds
= t e2t + C s = t2 + e2t + Ct + D.
dt
2
2
4
Now, the body is at rest at t = 0. This gives s0 (0) = 0,
hence C = 1/2. Also, s(0) = 0. This gives D = 1/4.
Thus, the rightward displacement at t = 1 is
s(1) =

1 1 2 1 1
3
1
+ e + = e2 + .
2 4
2 4
4
4

6. We have
dT
= c(T (t) Tambient )
dt
If T (t) > Tambient , the body should be losing heat, that
is, dT /dt < 0. This implies c < 0. Likewise, if T (t) <
Tambient , the body should be gaining heat, that is, dT /dt >
0 and hence c < 0 (as deduced earlier). (Note. This ODE
can be solved as a 1st order ODE in separable form as
explained in Chapter 2.)

26

Chapter 2

First order ODEs


2.1

Preamble

We will consider 1st order ODEs in y(x) which are of the form
dy
= G(x, y)
dx
where G(x, y) denotes a given mathematical expression involving x and y.
For cases in which G(x, y) assumes certain specific forms,
methods for solving the ODEs may be obtained. We will look
at some of these cases in this chapter.

2.2

First order ODEs in separable form

A 1st order ODE given by


dy
= P (x) Q(y)
dx
is said to be in separable form. Here P (x) and Q(y) are given
functions.
The ODE may be rewritten as
1
dy

= P (x).
Q(y) dx
27

If we perform an indefinite integration with respect to x on


both sides, we obtain
Z
Z
dy
1

dx = P (x)dx.
Q(y) dx
This may be rewritten as
Z
Z
dy
= P (x)dx.
Q(y)
The formula above provides us with a method for solving
the ODE, if we can work out the indefinite integrals on both
sides of the equation. Note that the integration on the left hand
side is carried out with respect to y and that on the right hand
side with respect to x.
Examples
1. Solve the ODE
y 0 (x) = (y + 1)2 (2x + 1)
subject to y(0) = 1.
We are required to find the particular solution y(x) of the
ODE which is such that y(0) = 1.
The ODE is 1st order and in separable form.
We rewrite it as
Z
Z
dy
=
(2x + 1)dx.
(y + 1)2
This leads to the general solution of the form
(y + 1)1 = x2 + x + C
where C is an arbitrary constant. The general solution as given
above is said to be in implicit form1 .
1
If we can rearrange the implicit solution to express y explicitly in terms
of x, we obtain a general solution in explicit form. An explicit solution (if it
can be easily obtained) may be preferable to an implicit one as the former
may be readily used to evaluate y at any suitably chosen value of x.

28

We are given y(0) = 1, that is, y = 1 when x = 0. Applying


this in the general solution above, we find that
1
(1 + 1)1 = 02 + 0 + C C = .
2
Thus, the required particular solution in implicit form is
1
(y + 1)1 = x2 + x .
2
Solving for y, we obtain the required particular solution in
explicit form given by
y=

1 2x2 2x
.
2x2 2x + 1

2. Find the general solution of the ODE


x3 (7y6 + 3y 2 )y0 (x) = (y 7 + y 3 + 3).

This 1st order ODE is in separable form. It may be rewritten as


Z
Z
(7y 6 + 3y2 )
dy = x3 dx.
(y7 + y 3 + 3)
Finding the integrals on both sides, we obtain the general
solution
1
ln |y7 + y 3 + 3| = x2 + C
2
7
3
1/(2x2 )
|y + y + 3| = Be
(B = eC )
2)

y 7 + y 3 + 3 = Ae1/(2x

(A = B)

where A, B and C are arbitrary constants. The constant B


which is related to C by B = eC is positive. The constant A
which is related to B by A = B can either be positive or
negative.
The general solution as given above is in implicit form. In
this case, it is dicult, if not impossible, to find the general
solution in explicit form.
29

3. Consider now the ODE for the pursuit problem on page


18 (Chapter 1), that is,
up
1 + (p0 (x))2 = 0.
xp00 (x)
v
Use the substitution q(x) = p0 (x) to convert it into a 1st
order separable ODE. Hence, solve the ODE to determine
p(x) for the pursuit problem.

With q(x) = p0 (x), the 2nd order ODE in p(x) becomes


x
which is separable.
Thus,

dq
up
1 + q2
=
dx
v

Z
u
dx
p
=
2
v
x
1+q
Z
u
dq
p
= ln |x| + E.

2
v
1+q
dq

Note that u and v are positive constants giving the speed of


the boat and the navy ship respectively and E is an arbitrary
constant of integration.
To deal with the integral on the left hand side, we use the
substitution q = sinh and dq = cosh d. Noting that 1 +
sinh2 = cosh2 , we find that
Z
Z
dq
p
= d = + D.
1 + q2
Note that D is an arbitrary constant of integration.
It follows that
=

u
ln |x| + C
v

where C = E D is an arbitrary constant.


From q = sinh , we find that
30

u
q = sinh( ln |x| + C)
v
C (u/v) ln |x|
eC e(u/v) ln |x|
2q = e e
1
1
q = A|x|u/v A1 |x|u/v
2
2
where A = eC is an arbitrary constant.
In the pursuit problem, we note that 0 < x a when the
navy ship is chasing the small boat. Thus, |x| = x and
1
1 u/v
p0 (x) = Axu/v
x
2
2A
x1
u
Ax+1

+ B if = 6= 1,
p(x) =
2( + 1) 2A(1 )
v
+1
Ax
1
u
or p(x) =

ln(x) + B if = = 1,
2( + 1) 2A
v
where B is an arbitrary constant.
To determine the arbitrary constants A and B in the general
solution, we apply the conditions p(a) = 0 and p0 (a) = 0.
Using p0 (a) = 0, we obtain
Aau/v

1
1
= 0 A = u/v .
u/v
Aa
a

From Figure 1.2 on page 18, it is clear that p0 (x) 0 for


0 < x a as the curve giving the path of the navy ship has a
non-positive slope. If we take A = 1/au/v , we find that
p0 (x) =

1 (x/a)2u/v
0 for 0 < x a.
2(x/a)u/v

Thus, for the problem under consideration, we reject A =


1/au/v . We take A = 1/au/v . The value of B can then be
determined from p(a) = 0. (We leave this to readers who are
interested in working out the algebraic details.)

31

4. Certain 1st order ODEs may be reduced to separable form


through the use of suitable substitutions. Consider 1st
order ODEs of the form
y
dy
= G( ),
dx
x
where G(y/x) denotes a well defined expression containing y/x in it. (The variables x and y cannot appear in
the expression separately but always together in the ratio
y/x.) If y(x) = x u(x), show that the ODE above can be
reduced to the following 1st order separable ODE in u(x):
du
1
= (G(u) u).
dx
x
If we dierentiate the substitution y = x u(x) with respect
to x, we obtain
dy
= x u0 (x) + u(x).
dx
Substituiting the above into the given ODE in y(x) and
noting that u = y/x, we find that
x u0 (x) + u = G(u)

du
1
= (G(u) u).
dx
x

5. Solve the ODE


y0 =

x
y
+ ( )3
x
y

subject to y(1) = 1.
We let y = xu(x). This gives y 0 = xu0 (x)+u. Substituting
into the given ODE, we find that
1
du
1
= ( )3 .
x u0 (x) + u = u + ( )3 x
u
dx
u
32

We obtain a separable ODE in u(x) which may be rewritten


as
Z

u3 du =

dx
.
x

The above can be integrated to give


u4
= ln |x| + C
4
where C is an arbitrary constant.
Replacing u back by y/x, we obtain
1 y 4
( ) = ln |x| + C y 4 = 4x4 ln |x| + 4Cx4 .
4 x
The above gives rise to two general solutions, namely
y(x) = (4x4 ln |x| + 4Cx4 )1/4 .
Of the two general solutions, which one should we use?
Since we are given y(1) = 1 > 0, we reject the general solution y(x) = (4x4 ln |x| + 4Cx4 )1/4 , as it implies that y < 0.
Substituting y(1) = 1 into the appropriate general solution
given by y(x) = (4x4 ln |x| + 4Cx4 )1/4 , we find that
1
1 = (4(1)4 ln |1| + 4C(1)4 )1/4 C = .
4
Thus, the required particular solution is given by
y(x) = (4x4 ln |x| + x4 )1/4 .

2.3

Linear 1st order ODEs

A linear 1st order ODE in y(x) has the form


dy
+ f (x)y = r(x).
dx
Here f (x) and r(x) are given functions.
33

2.3.1

Homogeneous linear 1st order ODEs

The above linear ODE is said to be homogeneous if r(x) 0


(that is, r(x) is identically zero over the interval of interest).
Thus, a homogeneous 1st order linear ODE is of the form
dy
+ f(x)y = 0.
dx
This ODE is separable and may be rewritten as
Z
Z
dy
= f (x)dx.
y
It follows that the general solution of the homogeneous linear 1st order ODE is given by
Z
R
ln |y| = f (x)dx + C y = Be f (x)dx .
Here B = eC and C are arbitrary constants.

2.3.2

Nonhomogeneous linear 1st order ODEs

If the linear ODE


dy
+ f (x)y = r(x)
dx
is such that the function r(x) has non-zero values for at least
some values of x (within the interval of interest) then the ODE
is said to be nonhomogeneous.
Here we discuss a method known as the variation of parameter for solving the nonhomogeneous ODE. The method involves
two steps as described below.
Firstly, we solve the corresponding homogeneous ODE, that
is,
dY
+ f (x)Y = 0
dx
for any particular solution Y (x) (except the trivial solution
Y (x) = 0).
34

Secondly, to solve the nonhomogeneous ODE, we make the


substitution
y(x) = Y (x) v(x).
Here v(x) is an unknown function.
We substitute y(x) = Y (x) v(x) into the nonhomogeneous
ODE to obtain a separable 1st order ODE in v(x). If v(x) can be
determined with an arbitrary constant in it, the general solution
of the nonhomogeneous ODE is given by y(x) = Y (x) v(x).
Example
Solve
y 0 + xy = (x + 1)ex
subject to y(0) = 2.

The ODE is nonhomogeneous, 1st order and linear.


Firstly, let us find a particular solution of the homogeneous
ODE
Y 0 + xY = 0,
The homogeneous ODE is separable and may be solved to
give
Z
Z
dY
1
2
= xdx ln |Y | = x2 Y = ex /2 .
Y
2
In deriving Y above, we ignore the arbitrary constant of integration as we are only interested in finding a particular solution
of the homogeneous ODE.
To find the general solution of the original nonhomogeneous
ODE, we let
2 /2

y = ex

35

v(x).

It follows that
2 /2

y 0 = ex

2 /2

v 0 xex

v.

Substituting into the original ODE, we obtain


2 /2

ex

2 /2

v 0 xex

2 /2

v + x ex

v(x) = (x + 1)ex

which simplifies to give


2

ex /2 v 0 = (x + 1)ex
dv
2

= (x + 1)e(x /2)+x
Zdx
Z

2 /2)+x

(x + 1)e(x

dv =

2 /2)+x

v(x) = e(x

dx

+C

where C is an arbitrary constant.


We obtain
2 /2

y(x) = ex

2 /2)+x

(e(x

2 /2

+ C) = ex + Cex

as the required general solution.


Now, since y(0) = 2, we find that
2 = 1 + C C = 1.
Thus, the required particular solution is given by
2 /2

y(x) = ex + ex

2.4

Bernoulli dierential equation

An example of a nonlinear 1st order ODE is the Bernoulli differential equation


dy
+ f(x)y = r(x)y p (p constant, p 6= 0, 1).
dx

36

The Bernoulli dierential equation can be converted into a


1st order linear ODE if we use the substituition
u(x) = (y(x))1p .
Dierentiating the above with respect to x, we find that
u0 = (1 p)y p y 0 y 0 =

yp 0
u.
1p

The Bernoulli dierential equation now becomes


yp 0
1 du
u + f (x)y p u = r(x)y p
+ f (x)u = r(x).
1p
1 p dx
The linear 1st order ODE may be solved as described in earlier
sections for u(x) (and hence y(x)).
Example
Solve
y 0 + 9y = y5 e32x .

Let u = y4 . This gives u0 = 4y 5 y 0 . From the given ODE,


we find that
1
y 5 u0 + 9y5 u = y5 e32x u0 36u = 4e32x .
4
The method of variation of parameter may be used to solve
the above ODE in u(x).
Firstly, we look for a particular solution of the corresponding homogeneous ODE
dU
36U = 0.
dx

37

Separating the variable U and x, we find that a particular solution is given by


U = e36x .
Secondly, for the solution of the linear ODE in u(x), we
proceed as follows:
u(x) = e36x v(x)
u0 = e36x v + 36e36x v 0

e36x v 0 + 36e36x v 36e36x v = 4e32x


dv
= 4e4x v(x) = e4x + C (C arbitrary constant).

dx
Thus, the solution of y 0 + 9y = y 5 e32x is given implicitly by
y 4 = (e4x + C)e36x .

2.5

Population dynamics

First order ODEs in separable form may be found in theories


which are concerned with predicting the growth of a population.
The population may be a colony of bacteria thriving on an agar
culture or cancerous cells in a biological organ or people living
in a particular community.

2.5.1

Malthus theory of unlimited growth

According to Malthus theory, the rate of change of a growing


population is proportional to its size. If the population size P
can be described using a continuous and dierentiable function
of time t then Malthus theory can be expressed using the 1st
order ODE
dP
= kP (t),
dt
where the coecient k is a positive constant. If k has a larger
magnitude, the population grows faster.
38

The above ODE is separable and can be easily solved as


follows.
Z
Z
dP
= k dt
P
ln |P | = kt + C (C is an arbitrary constant)
|P | = Bekt (B = eC is an arbitrary constant)

P (t) = Aekt (A = B).

If we let t = 0 in the solution P (t) = Aekt , we obtain


A = P (0), that is, A can be interpreted as the population size
at time t = 0. Thus, we can write
P (t) = P (0)ekt .
From the above formula for the population size for k > 0,
it is obvious that Malthus theory predicts a population explosion, that is, an unlimited growth at an exponential rate.

2.5.2

Verhulst theory of limited growth

At first glance, the assumption behind Malthus theory may appear plausible. It seems not unreasonable to think that a larger
population is favourable to the rate of a growing population.
On careful thought, however, we realize that a larger population is favorable to growth only if the population does not
have to compete with one another for resources (such as food)
to survive, that is, if the resources for survival are inexhaustible.
In fact, if the resources are limited, a larger population leads
to a stier competition for survival which does not favor population growth.
To take the competitive factor into account, mathematical
biologists modify the ODE in Malthus theory by taking the
coecient k as a decreasing function of the population size. In
Verhulst theory, k is taken to be of the form
k = P (t),
39

where and are positive constants.


With k as given above, the ODE for population dynamics
is modified to the nonlinear ODE
dP
= P (t) (P (t))2 .
dt
The modified ODE is known as Verhulst equation or sometimes
the logistic equation of population dynamics.
The positive constant gives an indication of the intensity
of competition among members of the population for resources.
In an ideal situation, such as a paradise where food and other
resources are abundant and living population does not have to
compete with one another for survival, the constant has the
value zero and Malthus theory is applicable. The more severe
the competition for survival is, the larger the value of is.
Can we solve Verhulst equation?
Rewriting it as
dP
P (t) = (P (t))2 ,
dt
we recognise that it is really a Bernoulli dierential equation.
To solve it, we let u(t) = (P (t))1 . This gives
du
+ u =
dt
which can be easily solved as a separable 1st order ODE, that
is,
Z
Z
du
= dt
u
1

ln |u | = t + C

u = Det (D = eC )
P
= Det

P
F et
1
P (t) =
(F = ).
t
1 + F e
D
Here C, D and F are arbitary constants.
40

We may express F in terms of the initial population size as


follows:
P (0) =

F
P (0)
F =
.
1 + F
P (0)

From the solution of the Verhulst equation, we can see that


P / as t . As discussed above, a larger value of indicates that the population has to compete harder for survival.
On the other hand, a higher value of implies that the population has a high rate of reproduction. Thus, it is interesting
to note that the population size in the long run is limited by
the ratio /.

2.6

Exercise III

1. Find general solutions of the following ODEs in y(x):


(a)
(b)
(c)
(d)

2x
y
0
y = (y 2)(x + 1)

y0 =

y 0 = xy 3y

y 0 = (1 y)1 cot(x)

2. Water is pumped into a tank at a constant rate of 10


meter3 per second. It is sucked out of the tank through
a small hole at a rate given by 2V (t) meter3 per second,
where V (t) is the volume of water (in meter3 ) present in
the tank at time t 0 (in second). If the volume of water
in the tank at time t = 0 second is 20 meter3 , how much
water does the tank hold at time t = 1 second? If the
situation described is allowed to go on indefinitely, will
the tank eventually dry up? What will happen? Explain.
3. The gradient of the tangent to a curve at the point (x, y)
is given by (x3 + 1)/(y 4 + 1). Express this information
using a 1st order ODE. Find the equation of the curve if
it is known that (1, 1) is a point lying on the curve.
41

4. The gradient of the normal to a curve at the point (x, y)


is given by y/(2x). Express this information using a 1st
order ODE. Find the equation of the curve if it is known
that (0, 1) is a point lying on the curve.
5. With reference to a Cartesian coordinate frame, the shape
of a hanging cable is given by yp
= s(x), where s(x) is
found to satisfy the ODE s00 (x) = 1 + (s0 (x))2 . By making an appropriate substitution, convert the 2nd order
ODE into a lower order one. Given that the cable has
endpoints at (0, 0) and (1, 0), find its shape. (Note. The
working on page 30 may be of help here.)
6. Solve the ODE
y 0 (x) =

xy
.
x+y

(Hint. Rewrite the ODE as


x(1 (y/x))
1 (y/x)
dy
=
=
.)
dx
x(1 + (y/x))
1 + (y/x)

7. Find general solutions of of the following ODEs in y(x):


(a)

y 0 + (2x + 1)y = 2x + 1

(b)

xy 0 + y = 2x6
(Hint. Rewrite in the form y 0 + f(x)y = r(x).)

(c) 2xy 0 + y = 2x6 y 3

(Hint. Bernoulli dierential equation.)

8. The growth of a tumor may be described using the Gompertz equation which is a 1st order separable ODE of the
form
dV
= ( ln(V ))V
dt
where and are positive constants and V (t) is the volume of the tumor at time t. Solve the Gompertz equation.
Find the limiting volume of the tumor as t .
42

2.7

Solutions to Exercise III

1. (a) Rewrite ODE as ydy = 2xdx and integrate to obtain


y 2 = 2x2 + C.
(b) Separate the variables and integrate as follows.
dy
y2

(x + 1)dx
Z
Z
dy

= (x + 1)dx
y2
1
ln |y 2| = x2 + x + C.
2
1 2
y = 2 + Ae 2 x +x .

(c) Rewrite ODE as y0 = y(x 3). It follows that


Z
Z
dy
=
(x 3)dx
y
1 2
3x

y = Ae 2 x

(d) Separate the variables and integrate as follows.


Z
Z
cos(x)
dx
(1 y)dy =
sin(x)
1
y y2 = ln | sin(x)| + C.
2
2. For the volume of water in the tank, we find that
Total rate of change of volume per unit time
=

Rate of volume into the tank per unit time

Rate of volume out of the tank per unit time


dV
dV

= 10 2V
+ 2V = 10.
dt
dt
If we regard the ODE as a nonhomogeneous 1st order
linear ODE, we first solve the corresponding homogeneous
ODE, that is,
dW
+ 2W = 0 W (t) = e2t .
dt
43

To solve for V (t), we let V (t) = u(t)e2t . Substitute into


the nonhomogeneous ODE, we obtain
du
= 10e2t u = 5e2t + C.
dt
This gives V (t) = 5 + Ce2t . We are given V (0) = 20.
Thus, C = 15. So, volume at time t = 1 is given by
V (1) = 5 + 15e2 ' 7. 03 meter3 . As t , we find that
V (t) 5 (since e2t 0 as t ). The tank will not
dry up if the current situation prevails. (Note. The ODE
V 0 +2V = 10 may also be treated as a 1st order separable
ODE.)
3. The ODE is given by
dy
x3 + 1
= 4
dx
y +1
which can be easily solved as a separable ODE to obtain
1 5
1
y + y = x4 + x + C.
5
4
To work out C, substitute the point (x, y) = (1, 1) into
the equation above. We find that C = 1/20. Thus, the
required curve is
1 5
1
1
y + y = x4 + x .
5
4
20
4. Since
(gradient of normal) (gradient of tangent) = 1,
the ODE to solve is
dy
2x
= .
dx
y
The above ODE is separable and can be integrated to
obtain
1 2
y = x2 + C.
2
44

Use the point (0, 1) to obtain C = 1/2. The required curve


is thus given by
y 2 = 2x2 + 1.
5. To convert the 2nd order ODE to a 1st order one, let
s0 (x) = p(x). Thus,
dp p
= 1 + p2 .
dx
The ODE above is separable and can be solved as follows.
Z
Z
dp
p
= dx.
1 + p2
The integral on the left hand side can be evaluated as
explained on page 30 by letting p = sinh . This leads to
= x + C.
From p = sinh and s0 (x) = p(x), it follows that
p(x)

sinh(x + C)

s0 (x) = sinh(x + C)

s(x) = cosh(x + C) + F.
From the endpoints (0, 0) and (1, 0), we know that s(0) =
0 and s(1) = 0. This gives
eC + eC + 2F
C

1 C

ee +e

+ 2F

= 0
= 0.

Eliminating F, we obtain
(1 e)eC +

(1 e1 )
=0
eC

which gives
e2C

e1 1
1
e1 1
C = ln(
)
1e
2
1e
1
F = (eC + eC )
2
1 e1 1 1/2
e1 1 1/2
F = [(
].
) +(
)
2 1e
1e
=

45

Thus, the shape of the cable is given by y = s(x), that is,


y =

1 e1 1 1/2 x
e1 1 1/2 x
e ]
[(
) e +(
)
2 1e
1e
1 e1 1 1/2
e1 1 1/2
[(
].
) +(
)
2 1e
1e

Note. In the above, we use eln(x) = x.


6. Rewrite ODE as
1 (y/x)
dy
=
.
dx
1 + (y/x)

Let y = xu(x). (Refer to page 32.) This gives


du
1u
+u =
dx
1+u
1u
du
=
u
x
dx
1+u
du
1 2u u2
x
=
(separable ODE)
dx
1+u
Z
Z
dx
(1 + u)du
=
2
1 2u u
x
1
ln |u2 + 2u 1| = ln |x| + ln |C| = ln(|Cx|)
2
(C is an arbitrary constant)
x

|u2 + 2u 1| = C 2 x2
y
y
( )2 + 2( ) 1 = Ex2 (E = C 2 ).
x
x
7. (a) Regard ODE as 1st order linear. Solve corresponding
homogeneous ODE first, that is,
Y 0 + (2x + 1)Y = 0.
2

A particular solution is Y = ex x . To solve the original


2
ODE, let y = ex x v(x). This gives
dv
dx

2 +x

(2x + 1)ex

2 +x

v(x) = ex
46

+ C.

Thus, the required general solution is


2 x

y = 1 + Cex

Note. Alternatively, treat the ODE as separable by writing it as


dy
= (2x + 1)(1 y).
dx
(b) This is a 1st order linear ODE. First solve
Y0+

1
Y =0
x

for a particular solution. We obtain Y = x1 . For the


general solution of the original ODE, let y = x1 v(x).
This gives
dv
2
= 2x6 v(x) = x7 + C.
dx
7
Thus, the required general solution is
2
y = x6 + Cx1 .
7
(c) To solve this Bernoulli equation, let u = y2 . Thus,
u0

2y3 y 0
1
y 0 = y 3 u0 .
2
If we subsitute the above into the Bernoulli equation, we
obtain
du
+ u = 2x6
x
dx
which may be solved as a 1st order linear ODE (see part
(b) above) to obtain
=

2
u(x) = x6 + Cx1 .
7
The required general solution is
2
y 2 = x6 + Cx1 .
7
47

8. The Gompertz equation is 1st order separable. Separating the variables, we find that
Z
Z
dV
= dt
V ( ln(V ))
1
ln | ln(V )| = t + C

ln(V ) = Aet (A = eC )
A
V (t) = exp(/) exp( et )

exp(/) exp(0) (as t ) (since > 0).


Thus, V (t) e/ as t . (Note. To work out
the indefinite integral involving V, use the substitution
W = ln(V ).)

48

Chapter 3

Second order linear


ODEs
3.1

Preamble

Here we will look at 2nd order linear ODEs. These are ODEs
which can be written in the form
y 00 + f (x)y 0 + g(x)y = r(x)
where f (x), g(x) and r(x) are given functions of x. The ODE
above is said to be homogeneous if r(x) 0. Otherwise, it is
nonhomogeneous.
Below are some examples of 2nd order linear ODEs in y(x):
(1)

y 00 (x) + 2y 0 (x) + 3y(x) = 0

(2)

y 00 (x) + xy(x) = 0

(3)

y 00 (x) + 2xy 0 (x) + (x + 1)y(x) = x2 2

(4)

y 00 (x) + x3 sin(x)y 0 (x) + 2x5 y(x) = x2 cos(x)

The first two ODEs in the examples above are homogeneous,


while the other two are nonhomogeneous.
We will examine how general solutions can be constructed
for 2nd order linear ODEs. Methods of solution for solving
certain 2nd order linear ODEs are then given. As we will see
in Chapter 4, 2nd order linear ODEs are of interest in practical
49

engineering problems involving electric circuits and spring-mass


systems.

3.2

General solution of homogeneous 2nd


order linear ODE

If two linearly independent solutions of a homogeneous 2nd order linear ODE can be found, they can be used to construct
the general solution of the ODE.

3.2.1

Linearly independent functions

Two functions f (x) and g(x) are said to be linearly independent


over the interval [a, b] (that is, over the interval a x b), if
and only if we cannot find constants and , other than and
both being zero, such that
f (x) + g(x) = 0 for all x in [a, b].
Examples
1. If f (x) = 2x2 and g(x) = x, then f(x) + g(x) =
2x2 + x. Now if and are both not zero, we can
find at most two values of x such that 2x2 + x = 0. We
cannot find constants and , other than and both
being zero, such that 2x2 + x = 0 for all values of x.
Thus, the functions f (x) = 2x2 and g(x) = x are linearly
independent over the interval (, ).
2. The functions f (x) = 3ex and g(x) = ex are not linearly
independent as f (x) = 3g(x) (hence f (x) 3g(x) = 0
for all x). In general, for any two functions f(x) and
g(x), if f(x)/g(x) is a constant (over a given interval),
then the functions are not linearly independent (over the
interval). Otherwise, if f (x)/g(x) is not a constant, then
the functions are linearly independent.
3. The functions f(x) = 0 and g(x) are not linearly independent as we can write f (x) = 0 g(x), that is, we can
write f (x) 0 g(x) = 0 (no matter what g(x) is).
50

Theorem 1
Let f (x) and g(x) be dierentiable functions over
the interval [a, b]. The functions f(x) and g(x) are
not linearly independent over [a, b] if and only if
f (x)g 0 (x) g(x)f 0 (x) = 0 for all x in [a, b].
The above theorem can be proven as follows.
Let
f (x) + g(x) = 0 for all x in [a, b],

(1)

where and are constants.


It follows that
f 0 (x) + g 0 (x) = 0 for all x in [a, b].

(2)

If we multiply (1) and (2) above by g 0 (x) and g(x) respectively and take the dierence between the two resulting equations, we find that
[f (x)g 0 (x) g(x)f 0 (x)] = 0 for all x in [a, b].

(3)

We may proceed in a similar manner to obtain


[f(x)g 0 (x) g(x)f 0 (x)] = 0 for all x in [a, b].

(4)

If the functions f (x) and g(x) are not linearly independent,


then it is possible to find either or (or both) which is
not zero. From (3) and (4) above, it immediately follows that
f(x)g 0 (x)g(x)f 0 (x) = 0 for all x in [a, b]. Thus, if the functions
f(x) and g(x) are not linearly independent, then f (x)g 0 (x)
g(x)f 0 (x) = 0 for all x in [a, b].
If f (x)g 0 (x) g(x)f 0 (x) = 0 for all x in [a, b], then it is
obvious that and do not have to be zero in (3) and (4).
This implies that f (x) and g(x) are not linearly independent.

51

3.2.2

Construction of general solution

Consider the homogeneous 2nd order linear ODE in y(x) given


by
y 00 + f (x)y 0 + g(x)y = 0.

(5)

Lemma 1
If y1 (x) and y2 (x) are solutions of (5) then y(x) =
Ay1 (x) + By2 (x), where A and B are any arbitrary constants, is also a solution of (5).
The lemma above can be proven as follows.
If y1 (x) and y2 (x) are solutions of (5) then
y100 + f (x)y10 + g(x)y1 = 0

(6)

y200

(7)

+ f (x)y20

+ g(x)y2 = 0.

If we substitute y = Ay1 + By2 into the left hand side of


(5), we find that
y 00 + f (x)y 0 + g(x)y
d2
d
=
(Ay1 (x) + By2 (x)) + f (x) (Ay1 (x) + By2 (x))
dx2
dx
+g(x) (Ay1 (x) + By2 (x))

= A y100 + f (x)y10 + g(x)y1 + B y200 + f (x)y20 + g(x)y2


= A 0 + B 0 = 0 (that is, the right hand side of (5)).

Thus, y(x) = Ay1 (x) + By2 (x) is also a solution of (5).


Lemma 2
If y1 (x) and y2 (x)
R are any two solutions of (5) then
y2 y10 y1 y20 = De f (x)dx , where D is a constant.
Lemma 2 can be proven as follows.
If y1 (x) and y2 (x) are solutions of (5) then (6) and (7) above
hold.
52

Multiplying (6) by y2 and (7) by y1 , we obtain


y2 y100 + f (x)y2 y10 + g(x)y2 y1 = 0
y1 y200 + f (x)y1 y20 + g(x)y1 y2 = 0.
The dierence between the two equations gives
00

y2 y1 y1 y200 + f(x) y2 y10 y1 y20 = 0.

If we define z(x) = y2 y10 y1 y20 , then


dz
dx

d 0
y2 y1 y1 y20
dx
= y2 y100 + y20 y10 y1 y200 y20 y10
=

= y2 y100 y1 y200 .

Thus, we obtain the 1st order linear ODE


dz
+ f (x)z = 0.
dx
The 1st order ODE is a separable one and may be rewritten
as
Z

dz
=
z

f (x)dx

to give
ln |z| + C =

f (x)dx, that is, z = De

f (x)dx

where C and D = eC are constants.


R
Thus, we show that y2 y10 y1 y20 = De f (x)dx .
Theorem 2
If y1 (x) and y2 (x) are two linearly independent solutions
of the homogeneous 2nd order linear ODE in (5) then
the general solution of (5) is given by y(x) = Ay1 (x) +
By2 (x), where A and B are arbitrary constants.
53

From Lemma 1 above, we know that y(x) = Ay1 (x)+By2 (x)


is a solution of (5), but is it the general solution?
To prove the theorem, we have to show that any solution
Y (x) of (5) can be written in the form Ay1 (x)+By2 (x), if y1 (x)
and y2 (x) are linearly independent solutions of (5).
Since y1 (x) and y2 (x) are solutions of (5), Lemma 2 tells
us that
y2 y10 y1 y20 = De

f (x)dx

where D is a constant.
Similarly, since y1 (x) and Y (x) are solutions of (5), Lemma
2 gives
Y y10 y1 Y 0 = Ee

f (x)dx

where E is a constant. Note that we should allow for the possibility that E and D are dierent constants.
Also, as y2 (x) and Y (x) are solutions of (5), we may write
Y y20 y2 Y 0 = F e

f (x)dx

where F is a constant.
The last two equations above may be used to obtain
Y y10 y2 y1 y2 Y 0 = y2 Ee

Y y20 y1 y2 y1 Y 0 = y1 F e

f (x)dx
f (x)dx

If we take the dierence of the two equations above, we


obtain
Y y10 y2 Y y20 y1 = y1 F e
Y =

y1 F e

f (x)dx
+ y2 Ee
R
Ee f (x)dx

f (x)dx

y2 y10

+ y2
y1 y20

Using y2 y10 y1 y20 = De


written in the form

f (x)dx ,

Y = Ay1 + By2
54

f (x)dx

we find that Y can be

where A = F/D and B = E/D are constants, provided that


D 6= 0.
Can we guarantee that D 6= 0? If D =R 0 then y2 y10 y1 y20 is
identically zero, since y2 y10 y1 y20 = De f (x)dx . According to
Theorem 1, this will then imply that y1 and y2 are not linearly
independent. Now, in Theorem 2, we are given that solutions y1
and y2 are linearly independent. Thus, the constant D cannot
be zero.
Summarizing, we show that if y1 (x) and y2 (x) are linearly
independent solutions of the homogeneous 2nd order linear
ODE
y 00 + f (x)y 0 + g(x)y = 0,
then any solution Y (x) of the ODE can be written in the
form Ay1 + By2 , where A and B are constants, that is, we
can construct the general solution of the ODE to be given by
y(x) = Ay1 (x) + By2 (x).

3.3

Homogeneous 2nd order linear ODEs


with constant coecients

A homogeneous 2nd order linear ODE with constant coecients


is given by
ay 00 (x) + by 0 (x) + cy(x) = 0.

(8)

Here a 6= 0, b and c are given real constants.


We can rewrite (8) in the form of (5) (on page 52) as
b
c
y00 (x) + y0 (x) + y(x) = 0.
a
a
According to Theorem 2, we can construct the general solution of (8) by finding two linearly independent solutions.
To find a solution of (8), let us try
y(x) = ex
where is a constant.
55

Dierentiating, we obtain
y 0 (x) = ex
y 00 (x) = ex = 2 ex .
Substituting into (8), we find that
a2 ex + bex + cex = 0

ex a2 + b + c = 0

The ODE in (8) is satisfied for all x if


a2 + b + c = 0.
We consider the following cases.

Case I: b2 4ac > 0


Now if b2 4ac > 0, then the quadratic equation in has
two distinct real solutions given by

b + b2 4ac
= 1
2a
b b2 4ac
= 2
2a
and we obtain two solutions of (8) as given by
y1 = e1 x

and

y2 = e2 x .

Since y2 /y1 = e2 x /e1 x = e[2 1 ]x is not a constant as


1 6= 2 , the two solutions y1 and y2 are linearly independent.
If b2 4ac > 0, then Theorem 2 tells us the general solution
of (8) is given by
y = Ae1 x + Be2 x
where A and B are arbitrary constants and 1 and 2 are the
two distinct real solutions of the quadratic equation a2 + b +
c = 0.

56

Case II: b2 4ac = 0


For this particular case, the quadratic equation a2 + b +
c = 0 has only one real solution given by = 1 b/(2a).
Hence, in seeking a solution of the form y = ex , we obtain
only one solution of (8), that is, y1 = ebx/(2a) .
To construct the general solution of (8), another solution
which is linearly independent to y1 is needed. To find another
solution, we let
y = u(x) e1 x
where u(x) is a function to be determined.
Dierentiating, we obtain
y 0 = 1 u(x) e1 x + u0 (x) e1 x

y 00 = 21 u(x) e1 x + 21 u0 (x) e1 x + u00 (x)e1 x .


Substituting into (8), we find that
a[21 u(x) e1 x + 21 u0 (x) e1 x + u00 (x)e1 x ]

+b 1 u(x) e1 x + u0 (x) e1 x + cu(x)e1 x = 0

which may be rewritten as

[(a21 + b1 + c)u(x) + (21 a + b)u0 (x) + au00 (x)]e1 x = 0.


Since a21 + b1 + c = 0 and 1 = b/(2a), the equation
above reduces to
au00 (x)e1 x = 0.
Since a 6= 0 and e1 x 6= 0, we obtain the ODE
u00 (x) = 0.
A solution of this simple ODE is u(x) = x.
Summarizing, if b2 4ac = 0, two particular solutions of (8)
are given by
y1 = ebx/(2a) and y2 = x ebx/(2a) .
57

Since y2 /y1 = x (not a constant), the two solutions above


are linearly independent. From Theorem 2, the required general
solution of the ODE is
y = Aebx/(2a) + Bx ebx/(2a)
where A and B are arbitrary constants.
Case III: b2 4ac < 0
For this case, the quadratic equation a2 + b + c = 0
does not have any real solutions. It has two distinct complex
solutions given by
p
|b2 4ac|
b
= 1 + i
2a
p 2a
|b2 4ac|
b
= 2 i
2a
2a

where i = 1.
If we ignore the fact that 1 and 2 are complex and proceed
as in Case I above, the general solution of (8) is given by
y = Ae1 x + Be2 x
where A and B are arbitrary constants.
The only question that arises here is, How can we evaluate
ex for complex ? The general solution given above is useless
if we cannot evaluate e1 x and e2 x . A proper interpretation
of ex for complex may be found in the theory of complex
functions as explained below.
In calculus of real functions, ex can be represented by its
Taylor series about x = 0, that is, we can write
ex =

X
xn

n=0

n!

A brief review of power series is given in Chapter 5 (Section 5.2


on page 128).

58

We extend the above to define ex+iy (for real x and y) as


x+iy

X
(x + iy)n

n!

n=0

(9)

If we let x = 0 in (9) and formally regroup the terms in the


series for eiy into even and odd powers of iy, we find that
eiy =
=

X
(iy)n

n=0

X
k=0

=
=

n!

(iy)2k X (iy)2k+1
+
(2k)!
(2k + 1)!
k=0

X
(i2 )k y 2k
k=0

X
k=0

(2k)!

+i

X
(i2 )k y 2k+1
k=0

(1)k y 2k
+i
(2k)!

(2k + 1)!

k=0

(1)k y2k+1
.
(2k + 1)!

Knowing that cos(x) and sin(x) can be given by their Taylor


series about x = 0 as
cos(x) =

X
(1)k x2k

(2k)!

k=0

and sin(x) =

X
(1)k x2k+1
k=0

(2k + 1)!

we obtain the so called Eulers formula.


eiy = cos(y) + i sin(y) for real y.
Substituting the binomial formula
(x + iy)n =

n
X

n!
xm (iy)nm
m!(n

m)!
m=0

into (9), we find that


x+iy

=
=

X
(x + iy)n

n=0

n!

n
X

xm (iy)nm
.
m!(n m)!
n=0 m=0
59

(10)

In the double summation above, for a fixed n which runs


from 0 to , we sum over m from 0 to n. All the values of n
and m which we carry out the double summation are plotted
as points (n, m) in Figure 3.1.

Figure 3.1
Let us now interchange the order of the double summation,
that is, we fix m first and sum over n. To cover all the points
in Figure 3.1, we find that we have to let m run from 0 to ,
and for a fixed m, we sum over n from m to . (For example,
when m = 3, we sum over n from 3 to .) Interchanging the
order of the double summation, we find that
e

x+iy

=
=
=

X
xm (iy)nm
m!(n m)!
n=m

m=0

X
X

xm (iy)k
(if we let k = n m)
m!k!

m=0 k=0

m X
X
m=0

x
m!

(iy)k
k!

k=0
x+iy

= ex eiy .

60

(11)

With (10) and (11), ex+iy can be evaluated in terms of real


exponential, cosine and sine functions, that is,
ex+iy = ex eiy = ex (cos(y) + i sin(y)).
Examples
1. Solve the ODE y00 + y0 6y = 0 subject to the conditions
y(0) = 1 and y 0 (0) = 7.

This is a homogeneous 2nd order linear ODE with constant


coecients. Thus, we use
y = ex ,

y 0 = ex

and y 00 = 2 ex .

Substituting into the ODE, we find that


2 ex + ex 6ex = 0

ex 2 + 6 = 0

2 + 6 = 0

( + 3)( 2) = 0 = 3, = 2.

Two linearly independent solutions of the ODE are given


by
y1 = e3x

and

y2 = e2x .

The general solution is


y = Ae3x + Be2x
where A and B are arbitrary constants.
We use the given conditions y(0) = 1 and y0 (0) = 7 to
determine A and B.
Dierentiating the general solution, we obtain
y 0 = 3Ae3x + 2Be2x .

61

It follows that
y(0) = 1 A + B = 1

y0 (0) = 7 3A + 2B = 7.
Solving for A and B, we obtain A = 1 and B = 2.
Thus, the required particular solution of the ODE is
y = e3x + 2e2x .
2. Solve the ODE y 00 + 6y 0 + 9y = 0 subject to the conditions
y(0) = 1 and y0 (0) = 1.
This is a homogeneous 2nd order linear ODE with constant
coecients. Thus, we use
y = ex ,

y 0 = ex

and y 00 = 2 ex .

Substituting into the ODE, we obtain


2 + 6 + 9 = 0
( + 3)2 = 0 = 3.
Since = 3 is the only solution of the quadratic equation,
the general solution of the ODE is given by
y = Ae3x + Bx e3x
where A and B are arbitrary constants.
Dierentiating the general solution, we obtain
y0 = 3Ae3x 3Bx e3x + Be3x .
Using the given conditions, we find that
y(0) = 1 A = 1

y 0 (0) = 1 3 + B = 1, that is, B = 4.


Hence the required particular solution is
y = e3x + 4x e3x .

62

3. Solve the ODE y 00 4y0 +13y = 0 subject to the conditions


y(0) = 1 and y0 (0) = 2. What is the value of y at x =
/2?
This is a 2nd order linear homogeneous ODE with constant
coecients. We use
y = ex ,

y 0 = ex

and y 00 = 2 ex .

Substituting into the ODE, we find that


2 4 + 13 = 0

= 2 + 3i, = 2 3i.
Thus, the general solution is given by
y = Ae(2+3i)x + Be(23i)x
where A and B are arbitrary constants.
It is useful to rewrite the general solution as
y = Ae(2+3i)x + Be(23i)x
= e2x (Aei(3x) + Bei(3x) )
= e2x (A [cos(3x) + i sin(3x)] + B [cos(3x) i sin(3x)])

= e2x ([A + B] cos(3x) + i [A B] sin(3x)) .


Thus, we obtain
y = e2x [C cos(3x) + D sin(3x)]

where C = A + B and D = i[A B] are arbitrary constants.


Dierentiating, we obtain
y 0 = e2x [3C sin(3x) + 3D cos(3x)]
+2e2x [C cos(3x) + D sin(3x)] .
Using the given conditions, we find that
y(0) = 1 C = 1

y 0 (0) = 2 3D + 2C = 2, that is, D = 0.


63

Thus, the required particular solution is


y = e2x cos(3x).
The value of y at x = /2 is given by
3

y( ) = e cos( ) = 0.
2
2

3.4

Euler-Cauchy equations

An Euler-Cauchy equation is given by


ax2 y 00 (x) + bxy 0 (x) + cy(x) = 0

(12)

where a 6= 0, b and c are given constants.


Note that (12) can be rewritten in the form of (5) (on page
52) as
y 00 (x) +

b 0
c
y (x) + 2 y(x) = 0.
ax
ax

We can use Theorem 2 to construct the general solution of


(12) if we can find two linearly independent solutions.
To find linearly independent solutions of (12), let
y = x
where is a constant yet to be determined.
Dierentiating, we obtain
y0 = x1 and y 00 = ( 1)x2 .
Substitution into (12) gives
ax2 ( 1)x2 + bx x1 + cx = 0

x (a( 1) + b + c) = 0 (for all x)

a( 1) + b + c = 0

a2 + (b a) + c = 0.
We consider the following cases.
64

Case I: (b a)2 4ac > 0


For this particular case, we find two distinct real values for
as given by
p
(b a) + (b a)2 4ac
= 1
p2a
(b a) (b a)2 4ac
.
= 2
2a
Thus, we obtain two solutions of (12) as given by
y1 = x1 ,

y2 = x2 .

These solutions are linearly independent as y2 /y1 = x2 /x1


= x2 1 is not a constant, since 1 6= 2 .
For this particular case, the general solution of the EulerCauchy ODE in (12) is given by
y = Ax1 + Bx2
where A and B are arbitrary constants.
Case II: (b a)2 4ac = 0
For this case, the quadratic equation a2 + (b a) + c = 0
has only one solution, that is,
= 1

(b a)
.
2a

Thus, only one solution is found for (12). Two linearly independent solutions are needed to construct the general solution
of the ODE. To find another solution, we let
y(x) = x1 u(x)
where u(x) is a function yet to be determined.
Dierentiating, we obtain
y 0 (x) = 1 x1 1 u(x) + x1 u0 (x)

y 00 (x) = 1 (1 1)x1 2 u(x)

+21 x1 1 u0 (x) + x1 u00 (x).


65

Substitution into (12) gives

x1 u(x) [a1 (1 1) + b1 + c]

x1 +1 u0 (x) [2a1 + b] + ax1 +2 u00 (x) = 0.

Since a1 (1 1) + b1 + c = 0 and 1 = (b a)/(2a), the


above equation reduces to
u0 (x) + xu00 (x) = 0.
To solve for u(x), let v(x) = u0 (x) to obtain a 1st order
ODE in separable form, that is,
v+x

dv
= 0.
dx

Solving the 1st order ODE, we find that


Z
Z
dx
dv
=
v
x

1
ln(v) = ln(x) = ln( )
x
1
v=
x
1
du
=

dx
x
u = ln(x).

Note that we ignore the arbitrary constants in the integrations


as we are only looking for a particular solution.
Another solution of the Euler-Cauchy equation is thus given
by y = x1 ln(x). The solutions y = x1 and y = x1 ln(x)
are linearly independent.
To summarize, if the quadratic equation a2 +(ba)+c =
0 has only one solution given by 1 = (b a)/(2a), the EulerCauchy equation in (12) has the general solution
y = Ax1 + Bx1 ln(x)
where A and B are arbitrary constants.

66

Case III: (b a)2 4ac < 0


For this case, the quadratic equation a2 + (b a) + c = 0
has two complex solutions given by
p
|(b a)2 4ac|
(b a)
+i
= 1
2a
2a
p
|(b a)2 4ac|
(b a)
i
.
= 2
2a
2a
The general solution of the Euler-Cauchy equation is
y = Ax1 + Bx2
where A and B are arbitrary constants.
To compute x for complex , we turn to the theory of
complex functions again. We use the results
xz+w = xz xw for complex z and w
and
xiy = eiy ln(x)
= cos(y ln(x)) + i sin(y ln(x)) for x > 0 and real y.

Examples
1. Solve the ODE x2 y 00 + 4xy 0 + 2y = 0 subject to y(1) =
y 0 (1) = 1.
This is an Euler-Cauchy equation. We use
y = x ,

y 0 = x1 ,

y 00 = ( 1)x2 .

Substituting into the ODE, we find that


( 1) + 4 + 2 = 0

2 + 3 + 2 = 0

( + 1)( + 2) = 0 = 1,
67

= 2.

Thus, the general solution of the ODE is


y = Ax1 + Bx2
where A and B are arbitrary constant.
Dierentiating the general solution gives
y0 = Ax2 2Bx3 .
Use of y(1) = y 0 (1) = 1 gives
y(1) = 1 A + B = 1

y 0 (1) = 1 A 2B = 1.
Solving for A and B, we obtain A = 3 and B = 2.
The required particular solution is
y = 3x1 2x2 .

2. Solve the ODE x2 y 00 + 3xy 0 + y = 0 subject to y(1) = 1


and y(e) = 2.

This is an Euler-Cauchy equation. We use


y = x ,

y 0 = x1 ,

y 00 = ( 1)x2 .

Substitution into the ODE gives


( 1) + 3 + 1 = 0

2 + 2 + 1 = 0

( + 1)2 = 0 = 1 is the only solution.

Thus, the general solution of the ODE is


y = Ax1 + Bx1 ln(x)
where A and B are arbitrary constants.
68

Using the given conditions, we find that


y(1) = 1 A = 1

y(e) = 2 e1 + Be1 ln(e) = 2 B = 2e 1.

The required particular solution is given by y = x1 +


(2e 1) x1 ln(x).
3. Solve the ODE x2 y 00 (x) + 3xy 0 (x) + 2y(x) = 0 subject to
y(1) = y0 (1) = 1.

This is an Euler-Cauchy equation. We use


y = x ,

y 0 = x1 ,

y 00 = ( 1)x2 .

Substituting into the ODE, we find that


( 1) + 3 + 2 = 0

2 + 2 + 2 = 0 = 1 + i, 1 i.
The general solution of the ODE is
y = Ax1+i + Bx1i
where A and B are arbitrary constants.
We may rewrite the above general solution as
y = Ax1+i + Bx1i
= x1 [Axi + Bxi ]
= x1 [Aei ln(x) + Bei ln(x) ]
= x1 [A (cos(ln(x)) + i sin(ln(x)))
+B (cos(ln(x)) i sin(ln(x)))]

= x1 [C cos(ln(x)) + D sin(ln(x))]
where C = A + B and D = i(A B) are arbitrary constants.

69

Dierentiating, we obtain

y 0 = x1 Cx1 sin(ln(x)) + Dx1 cos(ln(x))


x2 [C cos(ln(x)) + D sin(ln(x))] .

Using y(1) = y 0 (1) = 1, we find that


y(1) = 1 C = 1

y 0 (1) = 1 D C = 1 D = 2.
Thus, the required particular solution is
y = x1 [cos(ln(x)) + 2 sin(ln(x))] .

3.5

Exercise IV

1. Find the general solution of each of the following ODEs


in y(x):
(a) y 00 y 0 30y = 0
(b) 9y 00 30y0 + 25y = 0
(c) y 00 6y0 + 25y = 0

(d) x2 y 00 + 5xy0 + 3y = 0

(e) x2 y00 5xy 0 + 9y = 0


(f) x2 y00 + 5xy 0 + 8y = 0
2. Solve each of the following ODEs in y(x) subject to the
given conditions:
(a) 3y 00 + 5y0 + 2y = 0, y(0) = 1, y 0 (0) = 3
(b) x2 y 00 + 5xy0 + 4y = 0, y(1) = 1, y(e) = 2
3. If y = yp is a non-trivial solution of the 2nd order linear
ODE
y 00 + f (x)y 0 + g(x)y = 0
70

verify that another solution is given by


Z F (x)
Z
e
dx with F (x) = f (x)dx.
y = yp (x)
[yp (x)]2
4. Find the constant p such that y = xp is a solution of the
ODE
1
3
y 00 + xy0 + ( 2 )y = 0.
2 4x
Use the result in Problem 3 above to find another solution
of the ODE. Write down the general solution of the ODE.
5. Show that Riccati equation in u(x) given by the 1st order
nonlinear ODE
u0 = p(x)u2 + q(x)u + r(x)
can be converted into the homogeneous 2nd order linear
ODE in y(x) given by
y00 (

p0 (x)
+ q(x))y 0 + p(x)r(x)y = 0
p(x)

by letting
u(x) =

3.6

y0 (x)
.
y(x)p(x)

Solving nonhomogeneous ODEs

Consider the nonhomogeneous 2nd order linear ODE


y 00 + f (x)y 0 + g(x)y = r(x)

(13)

where r(x) is not identically zero.


Let yp (x) be any particular solution of the nonhomogeneous
ODE in (13). Thus,
yp00 + f (x)yp0 + g(x)yp = r(x).
71

To solve (13), let


y = yp (x) + Y (x).
Substituting into (13), we find that

00
yp + f (x)yp0 + g(x)yp + Y 00 + f (x)Y 0 + g(x)Y
00

= r(x)

r(x) + Y + f (x)Y + g(x)Y = r(x)


Y 00 + f (x)Y 0 + g(x)Y = 0.

(14)

In (14), we obtain a homogeneous 2nd order linear ODE in


Y (x).
If the general solution of the homogeneous ODE in Y (x) is
given by Y = Yg then the general solution of the nonhomogeneous ODE is given by
y = yp (x) + Yg (x).
If two linearly independent solutions of the homogeneous
ODE in Y (x) can be obtained, the method of variation of parameters may be used to construct a particular solution of
the nonhomogeneous ODE. Particular solutions of nonhomogeneous ODE may, however, be also found by guesswork, especially for cases in which the coecients f (x), g(x) and r(x)
assume relatively simple forms.

3.6.1

Finding a particular solution by guesswork

Below are examples of how guesswork may be used to find particular solutions of some nonhomogeneous ODEs.
Examples
1. Solve the ODE y00 + 3y0 + 2y = 2e5x subject to y(0) =
y 0 (0) = 0.
Firstly, let us solve the corresponding homogeneous ODE,
that is,
Y 00 + 3Y 0 + 2Y = 0.
72

This is a 2nd order linear ODE with constant coecients.


Let us use
Y = ex ,

Y 0 = ex

and Y 00 = 2 ex .

Substitution into the homogeneous ODE gives


2 + 3 + 2 = 0
( + 1)( + 2) = 0 = 1, 2.
The general solution of the homogeneous ODE is
Yg = Aex + Be2x
where A and B are arbitrary constants.
To write down the general solution of the nonhomogeneous
ODE y 00 + 3y 0 + 2y = 2e5x , a particular solution of the ODE is
required.
The right hand side of the ODE given by the term 2e5x
suggests that we seek a particular solution of the form
yp = e5x
where is a constant to be determined.
Dierentiating, we obtain
yp0 = 5e5x ,

yp00 = 25e5x .

Substitution into the ODE gives


25e5x + 15e5x + 2e5x = 2e5x
1
42e5x = 2e5x = .
21
Hence, we obtain
yp =

1 5x
e
21

as a particular solution of the nonhomogeneous ODE.

73

The general solution of the nonhomogeneous ODE is


y=

1 5x
e + Aex + Be2x
21

where A and B are arbitrary constants.


Dierentiating, we obtain
y0 =

5 5x
e Aex 2Be2x .
21

Using y(0) = y 0 (0) = 0, we find that


1
21
5
0
y (0) = 0 A + 2B = .
21

y(0) = 0 A + B =

Solving for A and B, we obtain B = 2/7 and A = 1/3.


Thus, the required particular solution is
y=

1 5x 1 x 2 2x
e e + e .
21
3
7

2. Find the general solution of the ODE y00 y0 = cos(2x).


As before, let us first solve the corresponding homogeneous
ODE, that is,
Y 00 Y 0 = 0.
To find the general solution, use
Y = ex ,

Y 0 = ex

and Y 00 = 2 ex .

This gives
2 = 0 = 0, 1.
The general solution of the homogeneous ODE is
Yg = A + Bex
74

where A and B are arbitrary constants.


A particular solution of the nonhomogeneous ODE y 00 y 0 =
cos(2x) is required. The right hand side of the ODE given by
the term cos(2x) suggests that we seek a particular solution
of the form1
yp = sin(2x) + cos(2x)
where and are constants to be determined.
Dierentiating, we obtain
yp0 = 2 cos(2x) 2 sin(2x)

yp00 = 4 sin(2x) 4 cos(2x).


Substituting into the nonhomogeneous ODE, we obtain
4 sin(2x) 4 cos(2x) 2 cos(2x) + 2 sin(2x) = cos(2x)
which may be rewritten as
(4 + 2) sin(2x) (2 + 4) cos(2x) = cos(2x).
The equation above is satisfied for all x if
4 + 2 = 0

2 + 4 = 1.

Solving for and , we obtain = 1/10 and = 1/5.


The required general solution of the nonhomogeneous ODE
is thus given by
y=

1
1
sin(2x) + cos(2x) + A + Bex
10
5

where A and B are arbitrary constants.


1

If we seek a particular solution having the simpler form of either yp =


sin(2x) or yp = cos(2x), we find that the nonhomogeneous ODE cannot
be satisfied, no matter how we choose the constant .

75

3. Find the general solution of the ODE y 00 y = 3ex .


Firstly, let us solve the corresponding homogeneous ODE
Y 00 Y = 0.
Proceeding as usual, we find that the general solution of the
homogeneous ODE is given by
Yg = Aex + Bex
where A and B are arbitrary constants.
A particular solution of the nonhomogeneous ODE is required. We seek one of the form2
yp = xex
where is a constant to be determined.
Dierentiating, we obtain
yp0 = ex + xex
yp00 = 2ex + xex .
Substituting into the nonhomogeneous ODE, we find that
2ex + xex xex = 3ex
3
2ex = 3ex = .
2
Thus, a particular solution of the nonhomogeneous ODE is
3
yp = xex .
2
The required general solution of the nonhomogeneous ODE
is
3
y = xex + Aex + Bex
2
where A and B are arbitrary constants.
2
Looking at the term on the right hand side of the ODE, that is, 3ex , we
may be tempted to seek a particular solution of the simpler form yp = ex .
However, this will not lead to success, as y = ex is a particular solution
of the corresponding homogeneous ODE.

76

4. Find the general solution of the ODE x2 y 00 + 4xy 0 + 2y =


3x2 + 1.
Firstly, let us solve the corresponding homogeneous ODE
x2 Y 00 + 4xY 0 + 2Y = 0.
We use
Y = x , Y 0 = x1 , Y 00 = ( 1)x2 .
Substituting into the homogeneous ODE, we find that
2 + 3 + 2 = 0 ( + 1)( + 2) = 0 = 1, 2.
Thus, the general solution of the homogeneous ODE is
Yg = Ax1 + Bx2
where A and B are arbitrary constants.
A particular solution of the nonhomogeneous ODE is required. The right hand side of the ODE suggests that we seek
one of the form
yp = x2 + x + ,
where , and are constants to be determined.
It follows that
yp0 = 2x + , yp00 = 2.
Substituting into the nonhomogeneous ODE, we find that
12x2 + 6x + 2 = 3x2 + 1.
For the nonhomogeneous ODE to be satisfied, we take 12 =
3, 6 = 0 and 2 = 1, that is, = 1/4, = 0 and = 1/2.
Thus, a particular solution of the nonhomogeneous ODE is
1
1
yp = x2 + .
4
2
The required general solution is
1
1
y = x2 + + Ax1 + Bx2
4
2
where A and B are arbitrary constants.
77

3.6.2

Method of variation of parameters

The method of variation of parameters gives a systematic approach for finding a particular solution of the nonhomogeneous
2nd order linear ODE in (13). Let us examine the method from
a general view point before applying it to a specific example.
Assume that we can find two linearly independent solutions
Y1 (x) and Y2 (x) of the corresponding homogeneous ODE in
(14). The two solutions may be used to construct a particular
solution yp of (13) as follows.
Let yp take the form
yp = u(x)Y1 (x) + v(x)Y2 (x)
where u(x) and v(x) are functions to be determined.
Dierentiating, we obtain
yp0 = uY10 + u0 Y1 + vY20 + v 0 Y2
yp00 = uY100 + 2u0 Y10 + u00 Y1 + vY200 + 2v0 Y20 + v00 Y2 .
Substitution into (13) gives

0 0
2u Y1 + u00 Y1 + 2v 0 Y20 + v 00 Y2 + f (x) u0 Y1 + v 0 Y2 = r(x)
since Y1 and Y2 are solutions of (14).
The ODE above may be rewritten as

d 0
u Y1 + v0 Y2 + u0 Y10 + v0 Y20 + f (x) u0 Y1 + v0 Y2 = r(x)
dx
which is satisfied if
u0 Y1 + v0 Y2 = 0
u0 Y10 + v0 Y20 = r(x).
Multiplying the first equation above by Y20 and the second
by Y2 gives
u0 Y1 Y20 + v0 Y2 Y20 = 0
u0 Y10 Y2 + v0 Y2 Y20 = r(x)Y2 (x).
78

The dierence between the two equations above yields


du
r(x)Y2 (x)
=
dx
(Y1 Y20 Y10 Y2 )
which may be integrated directly to give
Z
r(x)Y2 (x)
dx.
u(x) =
(Y1 Y20 Y10 Y2 )
Similarly, we obtain
dv
r(x)Y1 (x)
=
dx
(Y1 Y20 Y10 Y2 )
and
v(x) =

r(x)Y1 (x)
dx.
(Y1 Y20 Y10 Y2 )

The formulae above for u and v break down if Y1 Y20 Y10 Y2


is identically zero. Theorem 1 (page 51), however, guarantees
us that Y1 Y20 Y10 Y2 is not identically zero as Y1 and Y2 are
linearly independent.
As Y1 and Y2 are assumed known, the functions u and v
required in finding a particular solution of the nonhomogeneous
ODE can be determined at least in theory.
Example
Solve the nonhomogeneous ODE y 00 y = 3ex using the
method of variation of parameters.

In the previous section, through guesswork, we find that the


general solution of the ODE is given by
3
y = xex + Aex + Bex
2
where A and B are arbitrary constants.
79

Here we use the method of variation of parameters to find


a particular solution for the ODE.
Note that the corresponding homogeneous ODE Y 00 Y = 0
has two linearly independent solutions given by Y1 = ex and
Y2 = ex . Hence
Y1 Y20 Y10 Y2 = ex ex (ex )ex = 2.
According to the method of variation of parameters, a particular solution of the nonhomogeneous ODE is given by yp =
u(x)ex + v(x)ex with
Z
3
3ex ex
dx = e2x
u(x) =
2
4
and
v(x) =

3ex ex
3
dx = x.
2
2

Note that the constants of integration are ignored as we are


only interested in a particular solution.
Thus,
yp = u(x)ex + v(x)ex
3
3
3
3
= e2x ex + xex = ex + xex .
4
2
4
2
The required general solution of the nonhomogeneous ODE
is
3
3
y = ex + xex + Cex + Dex
4
2
where C and D are arbitrary constants.
The general solution above may be rewritten as
3
y = xex + Aex + Bex (as before)
2
where A = C and B = D 3/4 are arbitrary constants.
80

3.7

Extension to higher order linear ODEs

Much of the discussion above for 2nd order linear ODEs can
be extended to higher order linear ODEs. The extension is
indicated below.

3.7.1

General N-th order linear ODEs

An N -th order linear ODE in y(x) may be written in the form


y(N) + fN1 (x)y (N 1) + + f1 (x)y (1) + f0 (x)y = r(x) (15)
where f0 , f1 , , fN2 , fN1 and r are given real functions of
x.
If r(x) 0, the N -th order linear ODE is said to be homogeneous. Otherwise, it is nonhomogeneous.

3.7.2

General solution of a homogeneous ODE

Theorem 2 (page 53) for the general solution of 2nd order linear
ODEs can be generalized as follows.
If y1 , y2 , , yN1 and yN are linearly independent solutions of the homogeneous N-th order linear ODE
y (N) + fN 1 (x)y (N1) + + f1 (x)y(1) + f0 (x)y = 0
(16)
then the general solution of the ODE is
y = A1 y1 + A2 y2 + + AN 1 yN 1 + AN yN
where A1 , A2 , , AN1 and AN are arbitrary constants.
The functions y1 , y2 , , yN1 and yN are linearly independent if we cannot find any constants k1 , k2 , , kN 1 and
kN , other than k1 , k2 , , kN1 and kN all being zero, such
that
k1 y1 + k2 y2 + + kN 1 yN 1 + kN yN 0.
81

The functions y1 = x2 , y2 = x and y3 = 1 are linearly


independent because k1 x2 + k2 x + k3 cannot be identically zero
for any constants k1 , k2 and k3 other than k1 = k2 = k3 = 0.
The functions y1 = x2 + x + 1, y2 = x + 1, y3 = 2x2 and
y4 = 3x5 are not linearly independent as we can find constants
k1 , k2 , k3 and k4 (other than k1 = k2 = k3 = k4 = 0) such that
k1 y1 + k2 y2 + k3 y3 + k4 y4 0. For example, k1 = 2, k2 = 2,
k3 = 1 and k4 = 0.

3.7.3

General solution of a nonhomogeneous linear ODE

If yp is a particular solution of the nonhomogeneous linear ODE


in (15) and Yg is the general solution of the corresponding homogeneous linear ODE in (16), then the general solution of (15)
is given by
y = yp + Yg .
Examples
1. Find the general solution of the ODE in y(x) given by
y 000 2y 00 5y0 + 6y = 0.

This is a homogeneous linear ODE with constant coecients. Let


y = ex , y 0 = ex , y 00 = 2 ex , y000 = 3 ex .
Substituting into the ODE, we obtain

ex 3 22 5 + 6 = 0

that is,

( 1)( + 2)( 3) = 0
= 1, = 2, = 3.
82

We obtain three linearly independent solutions, namely


y1 = ex , y2 = e2x and y3 = e3x .
The required general solution is
y = Aex + Be2x + Ce3x
where A, B and C are arbitrary constants.

2. Find the general solution of the ODE in y(x) given by


y000 2y 00 5y 0 + 6y = 12.

It is easy to see that a particular solution of this nonhomogeneous ODE is yp = 2. The general solution of the corresponding
homogeneous ODE is found in the example above. Thus the
required general solution is
y = 2 + Aex + Be2x + Ce3x
where A, B and C are arbitrary constants.

3.8

Exercise V

1. Find the general solution of each of the following ODEs


in y(x):
(a) y 00 y 0 30y = 3e3x
(b) 9y 00 30y0 + 25y = x3 + 3x + 2
(c) y 00 y0 30y = 3e5x
(d) y 00 y 0 = cos(2x)
2. Solve each of the following ODEs in y(x) subject to the
given conditions:
83

(a) y 00 + 3y = 3x2 + 2x 1, y(0) = 1, y0 (0) = 2


(b) y 00 y 0 20y = x + ex , y(0) = 1, y0 (0) = 0
(c) x2 y00 + 5xy 0 + 8y = 5, y(1) = 0, y0 (1) = 1
(d) y 000 2y 00 y 0 + 2y = 0, y(0) = y0 (0) = y00 (0) = 1
(e) y 000 2y 00 y0 + 2y = e3x , y(0) = y 0 (0) = y 00 (0) = 1
(f) y 0000 y = 0, y(0) = 0, y0 (0) = y00 (0) = y 000 (0) = 1
3. In Chapter 1 (Figure 1.1, page 15), we show that the
motion of an object falling under the influence of gravity
with air resistance is governed by the 2nd order ODE
s00 (t) +

k 0
s (t) = g
m

where s(t) is the vertical distance of the object at time


t from a fixed point P along the path of the motion,
m is the mass of the object, k is a positive coecient
associated with air resistance and g is the acceleration
due to gravity. If k/m = 1/5 per second and g = 10
meter per second per second, the object is released from
rest at the point P at time t = 0, and it takes 5 seconds
to hit the ground, find the height of P above the ground.
If there is no air resistance, how long will it take the
object to hit the ground? Is your answer what you would
expect to get? Explain. (Note. There are two ways to
solve the ODE above. One way is to solve it directly as
an nonhomogeneous 2nd order linear ODE with constant
coecients using the appropriate method given in this
chapter; the other is to convert it into a 1st order ODE
by making an appropriate substitution and proceed as in
Chapter 2.)
4. Consider the N -th order ODE in y(x) given by
a0 y + a1 y (1) + + aN1 y (N1) + aN y (N) = 0
84

where an are constants such that aN 6= 0 and such that


the polynomial function defined by
P () = a0 + a1 + a2 2 + + aN1 N1 + aN N
can be written in the form
P () = ( c)2 Q()
where Q() is a polynomial function of order N 2 and
c is a given real constant. (Assume that N 2.)
(a) Show that y = ecx is a solution of the ODE above.
(b) Show that y = xecx is also a solution of the ODE.
(c) Use parts (a) and (b) above together with the generalization of Theorem 2 (as given on page 81) to solve
y 0000 7y000 + 16y 00 12y 0 = 0
subject to
y(0) = y0 (0) = y00 (0) = y 000 (0) = 1.

3.9

Solutions to Exercise IV

1. In parts (a), (b) and (c), we have homogeneous 2nd order


linear ODEs with constant coecients. To find two linearly independent solutions, try y = ex . For the EulerCauchy equations in parts (d), (e) and (f), try y = x .
In each case, find value(s) of from a quadratic equation in . Final general solutions are given below. (The
arbitrary constants are A and B.)
(a) = 5 and = 6. General solution is
y = Ae5x + Be6x .
(b) Only = 5/3. General solution is
y = Ae5x/3 + Bxe5x/3 .
85

(c) = 3 4i. General solution is


y = e3x (A cos(4x) + B sin(4x)).
(d) = 1 and = 3. General solution is
y = Ax1 + Bx3 .
(e) Only = 3. General solution is
y = Ax3 + Bx3 ln(x).
(f) = 2 2i. General solution is
y = x2 [A cos(2 ln(x)) + B sin(2 ln(x))].
2. (a) General solution of the ODE is
y(x) = Ae2x/3 + Bex .
Applying given conditions gives
A + B = 1
2
AB = 3
3
which may be solved to give A = 6 and B = 7. Thus,
required solution is
y(x) = 6e2x/3 7ex .
(b) General solution of the ODE is
y(x) = x2 (A + B ln(x)).
Applying given conditions gives
y(1)

A=1

y(e)

e2 (A + B) = 2

B = 2e2 1.
Thus, required solution is
y(x) = x2 (1 + [2e2 1] ln(x)).
86

3. Since yp is a solution, we can write:


yp00 + f (x)yp0 + g(x)yp = 0.
We have:
y = yp
y

yp0

eF (x)
dx
yp2

eF (x)
eF (x)
dx + yp0
2
yp
yp2

y 00 = yp00

eF (x)
eF (x)
dx
+
yp2
yp

f (x)eF (x) yp + yp0 eF (x)


yp2
Z F (x)
e
eF (x)
= yp00
dx

f(x)
.
yp2
yp

It follows that
y 00 + f (x)y 0 + g(x)y
=

(yp00

+ f (x)yp0

f(x)
= 0

+ g(x)yp )

eF (x)
dx
yp2

eF (x)
eF (x)
+ f (x)
yp
yp

eF (x)
dx + 0 = 0.
yp2

Thus, we verify that


y = yp

eF (x)
dx
yp2

is another solution of y 00 + f(x)y 0 + g(x)y = 0.


4. Substituting y = xp into the ODE, we find that
3
1
(p + )[xp + (p )xp2 ] = 0.
2
2
87

Thus, y = xp is a solution of the ODE for p = 1/2.


(The above equation is true for all x only if p = 1/2.)
According to Problem 3, another solution is given by
y

1/2

ex /2
dx
x1
1 2

y = x1/2 e 2 x .
Since the given ODE is homogeneous 2nd order linear
ODE, we may use Theorem 2 to write down the general
solution
1 2

y = Ax1/2 Bx1/2 e 2 x .
5. Let
u(x) =

y0 (x)
.
y(x)p(x)

It follows that
u0 =

ypy00 + y0 (y 0 p + yp0 )
.
(yp)2

Substituting into the Ricatti equation, we find that


ypy 00 + y 0 (y 0 p + yp0 )
y0 2
y0

p(
+
q
)
r =0
(yp)2
yp
yp
Multiplying the above by py, we obtain
ypy 00 + y 0 (y 0 p + yp0 ) p(y 0 )2
+ qy0 rpy = 0
yp
which may be simplified to give
p0 0
y + qy0 rpy = 0
p
p0
y 00 ( + q)y 0 + pry = 0.
p
y00 +

88

3.10

Solutions to Exercise V

1. (a) The corresponding homogeneous ODE has general solution


Y (x) = Ae5x + Be6x .
For a particular solution of the nonhomogeneous ODE,
let
yp = e3x .
Substituting yp into the nonhomogeneous ODE, we obtain
1
18 = 3 = .
6
Thus, required general solution is
1
y = e3x + Ae5x + Be6x .
6
(b) The corresponding homogeneous ODE has general solution
5

Y (x) = (A + Bx)e 3 x .
For a particular solution of the nonhomogeneous ODE,
let
yp = x3 + x2 + x + .
Substituting yp into nonhomogeneous ODE, we obtain
25x3 + (90 + 25)x2
+(54 60 + 25)x + (18 30 + 25)

= x3 + 3x + 2
Thus,

1
, 90 + 25 = 0
25
54 60 + 25 = 3, 18 30 + 25 = 2
=

which can be solved to obtain = 18/125, = 237/625


and = 1348/3125.
89

Required general solution is


y (x) =

1348 237
18 2
+
x+
x
3125 625
125
5
1
+ x3 + (A + Bx)e 3 x .
25

(c) The corresponding homogeneous ODE has general solution


Y (x) = Ae5x + Be6x .
For a particular solution of the nonhomogeneous ODE,
let
yp = cxe5x .
Substituting yp into nonhomogeneous ODE gives c =
3/11. Thus, required general solution is
y=

3 5x
xe
+ Ae5x + Be6x .
11

(d) The corresponding homogeneous ODE has general solution


Y (x) = A + Bex .
For a particular solution of the nonhomogeneous ODE,
let
yp = sin(2x) + cos(2x).
Substituting yp into nonhomogeneous ODE gives =
1/10 and = 1/5. Thus, required general solution is
y=

1
1
sin(2x) + cos(2x) + A + Bex .
10
5

2. (a) The corresponding homogeneous ODE has general solution

Y (x) = A cos( 3x) + B sin( 3x).


90

For a particular solution of the nonhomogneous ODE, let


yp = x2 + x + .
Substituting yp into nonhomogeneous ODE, we find that
= 1, = 2/3 and = 1. Thus, general solution of the
nonhomogeneous ODE is

2
y = x2 + x 1 + A cos( 3x) + B sin( 3x).
3
Applying the condition y(0) = 1, we obtain A 1 =
1, that is,
y 0 (0) = 2 gives

A = 2. The other condition


2/3 + B 3 = 2, that is, B = 4 3/9. Thus, required
soliution is

2
4 3
2
sin( 3x).
y = x + x 1 + 2 cos( 3x) +
3
9
(b) The corresponding homogeneous solution has general
solution
Y (x) = Ae4x + Be5x .
For a particular solution, let
yp = x + + ex .
We find that = 1/20, = 1/400 and = 1/20.
General solution of the nonhomogeneous ODE is
y=

1
1
1
x+
ex + Ae4x + Be5x .
20
400 20

Applying the given conditions y(0) = 1 and y 0 (0) = 0, we


obtain A + B = 419/400 and 4A + 5B = 1/10 which
can be solved to obtain A = 137/240 and B = 143/300.
Thus, required solution is
y (x) =

1
137 4x 143 5x
1
1
+
x+
ex +
e
e .
20
400 20
240
300

91

(c) The corresponding homogeneous solution has general


solution
Y (x) = [A cos(2 ln(x)) + B sin(2 ln(x))]x2 .
It is easy to see that a particular solution of the nonhomogeneous ODE is y = 5/8. General solution of nonhomogeneous ODE is
y(x) =

5
+ [A cos(2 ln(x)) + B sin(2 ln(x))]x2 .
8

Applying the given conditions y(1) = 0 and y 0 (1) = 1, we


obtain
y(x) =

5
1
5
+ [ cos(2 ln(x)) sin(2 ln(x))]x2 .
8
8
8

(d) Try y = ex . Substituting into the given ODE, we


obtain
3 22 + 2 = 0 = 1, 1, 2.
General solution of ODE is y(x) = Aex + Bex + Ce2x .
Applying the given conditions y(0) = y 0 (0) = y 00 (0) = 1,
we obtain A = 1 and B = C = 0. Thus, required solution
y = ex .
(e) Try Y = ex to obtain the general solution of the
corresponding homogeneous ODE as in part (d) above.
We obtain Y (x) = Aex + Bex + Ce2x . For a particular
solution of the nonhomogeneous ODE, try y = e3x .
Substituting into ODE, we find that = 1/40. The
general solution of the nonhomogeneous ODE is
y(x) =

1 3x
+ Aex + Bex + Ce2x .
e
40

Applying the given conditions, we obtain A = 7/8, B =


1/12 and C = 1/15. Required solution of the nonhomogeneous ODE is
y(x) =

1
1
1 3x 7 x
+ e + ex + e2x .
e
40
8
12
15
92

(f) Try y = ex . This gives


4 1

0 2 = 1, 2 = 1

= 1, = i.

It follows that the general solution can be written as


y(x) = Aex + Bex + C cos(x) + D sin(x).
Applying the given conditions gives the required solution
1
1
3
y(x) = ex ex cos(x).
4
4
2
3. The ODE to solve is
1
s00 (t) + s0 (t) = 10.
5
The corresponding homogeneous ODE is
1
S 00 (t) + S 0 (t) = 0.
5
Try S(t) = et . This gives 2 +/5 = 0, that = 0, 1/5.
Thus, the general solution of the homogeneous ODE is
S(t) = A + Bet/5 .
For a particular solution of the original nonhomogeneous
ODE, try s(t) = t + . This gives = 50. We can let
= 0. Thus, the general solution of the nonhomogeneous
ODE is
s(t) = 50t + A + Bet/5 .
The conditions to use are s(0) = 0 and s0 (0) = 0 (the
body is at rest at the point P at time t = 0 and s(t)
is the distance from P ). Applying the conditions gives
A = 250 and B = 250. Thus, the distance s(t) is given
by
s(t) = 50t 250 + 250et/5 .
93

The height of P from the ground is given by


s(5) = 250e1 meter.
If there is no air resistance, k/m = 0. The ODE becomes
s00 (t) = 10. This can be easily solved to give the general
solution s(t) = 5t2 + Ct + D. Applying the conditions
s(0) = 0 and s0 (0) = 0, we obtain s(t) = 5t2 . If there is
no air resistance, the time t taken to reach the ground is
obtained by solving 5t2 = 250e1 ,that is, t ' 4.3 second.
The body hits the ground quicker than when there is air
resistance. This is expected.
4. (a) If y(x) = ecx then y 0 (x) = cecx , y 00 (x) = c2 ecx , ,
y (N) (x) = cN ecx . The LHS of the given ODE can then be
written as
LHS of ODE
= a0 y + a1 y(1) + a2 y (2) + + aN1 y (N1) + aN y (N)
= (a0 + a1 c + a2 c2 + + aN1 cN 1 + aN cN )ecx
= P (c)ecx

= (c c)2 Q(c)ecx = 0 = RHS of ODE.


Thus, y = ecx is a solution of the given ODE.
(b) From y = xecx , we find that
y 0 = cxecx + ecx = ecx (1 + cx)
y 00 = c2 xecx + cecx + cecx = ecx (2c + c2 x)
y000 = c3 xecx + c2 ecx + 2c2 ecx = ecx (3c2 + c3 x)
..
.
y (N) = ecx (N cN1 + cN x).
Substitute into the LHS of ODE gives
LHS of ODE
= xecx (a0 + a1 c + a2 c2 + + aN xN )

+ecx (a1 + 2ca2 + 3c2 a3 + + N cN1 aN )

= xecx P (c) + ecx P 0 (c)


94

From P () = ( c)2 Q(), we find that P (c) = 0 and


P 0 ()

2( c)Q() + ( c)2 Q0 ()

P 0 (c) = 0.
It follows that
LHS of ODE

= xecx P (c) + ecx P 0 (c)


= 0 = RHS of ODE.

Thus, y = xecx is also a solution of the ODE.


(c) To solve y 0000 7y000 + 16y 00 12y 0 = 0, try y = ex .
This gives
4 73 + 162 12 = 0

(3 72 + 16 12) = 0
( 3) ( 2)2 = 0

= 0, = 2 (twice), = 3.

Thus, we obtain 4 particular solutions: y = e0x (or y = 1),


y = e2x , y = xe2x and y = e3x . We form the general
solution
y = A + Be2x + Cxe2x + De3x .
Applying the conditions y(0) = y0 (0) = y 00 (0) = y000 (0) =
1, we find that A = 1/6, B = 1/2, C = 1 and D = 1/3.
Thus, required solution is
y (x) =

1 1 2x
1
+ e xe2x + e3x .
6 2
3

95

Chapter 4

Circuits and springs


4.1

Preamble

In earlier chapters, we show how ODEs arise in the formulation


of various problems, such as the motion of bodies and population growth.
In this chapter, we examine two specific problems in physical and engineering sciences which are governed by linear ODEs
with constant coecients. One concerns the flow of electric current in circuits and the other vibrational motion in spring-mass
systems. In both problems, we state the laws of physics governing the behaviors of the systems and show how they may be
mathematically formulated in terms of ODEs.

4.2
4.2.1

Electric circuits
Basic electrical components

Basic components which may be found in an electric circuit include resistor, inductor and capacitor. The resistor is a device
which restricts the flow of electric current to within a safe level
in the circuit. The inductor is essentially a coil of wire (usually
copper) which stores energy in a magnetic field. The capacitor stores energy in an electric field in between two oppositely
charged plates. In addition to the components just mentioned,
96

an external source voltage (for example, a battery) may also be


present in the circuit. The external source voltage provides an
input voltage which helps to initiate the flow of electric current
in the circuit.

Figure 4.1
The symbols which we use to represent external source voltage, resistor, inductor and capacitor are shown in Figure 4.1.
A simple circuit which contains each of the basic components
mentioned, that is, the so called LCR circuit, is shown at the
bottom of Figure 4.1. Circuits may contain less components
than the LCR circuit shown in Figure 4.1 or they may be more
complicated being made up of many simple circuits joined together to form a network.

97

4.2.2

Voltage across an electric component

The voltage across a resistor or inductor or capacitor may be


measured by using a voltmeter. Relations between the voltage
and the electric current flowing across these components are
well established.
If there is a current I (in ampere) flowing through a resistor,
then the voltage across the resistor, VR (in volt), is related to
the current by
VR = RI
where R 0 is the resistance (in ohm). The coecient R is
a measure of the resistance put up by the resistor against the
flow of current. If a resistor is made up of a material which
conducts electricity better, it has a lower value of R. In theory,
it is possible for R to be zero. In practice, however, all materials
show some resistance (even if only an extremely small amount)
to the flow of current.
In general, the current I flowing in a circuit varies with
time t, that is, I is a function of t. The voltage across the
inductor, VL , is related to the time rate of change of current
flowing through it by
VL = L

dI
dt

where L 0 is the inductance (in henry).


The voltage across a capacitor, VC , is related to the current
passing through it by
1
dVC
= I(t)
dt
C
where C > 0 is the capacitance (in farad).
It is useful to rewrite the above relation as
Z
1 t
VC (t) =
I( )d + VC (0).
C 0
Note that VC (0) is the voltage across the capacitor at time t =
0. If the capacitor is not charged at time t = 0 then VC (0) = 0.
For our purpose here, we take L, C and R as constants.
98

4.2.3

ODEs in electric circuits

The flow of current in an electric circuit may be described in


terms of ODEs. ODEs for electric circuits are obtained from
the Kirchos voltage law which may be stated as follows.
For any closed loop of circuit (such as the simple
LCR circuit shown in Figures 4.1) where the current flows in only one direction (that is, either clockwise or counter-clockwise direction), the total sum
of the voltages across all resistors, inductors and capacitors present is equal to the total input voltages
supplied by external sources.
Kirchos voltage law is applicable for any closed loop of
circuits, no matter how many components they contain. We
now apply the law to some electric networks.
Another law known as Kirchos current law is also useful
in circuit analysis. This law implies the conservation of charge
and may be stated as follows.
Let P be any point or node in an electric circuit. If
Iin and Iout denote respectively the electric current
entering and leaving the point P then Iin = Iout .
Thus, according to the Kirchos current law, the electric
current in a simple circuit (such as the ones in Figures 4.1 and
4.2) is the same at all points (in every part of the circuit).
Examples
1. Consider the simple LR circuit in Figure 4.2. The resistance of the resistor is R = 2 ohm and the inductance of
the inductor is 3 henry. The input voltage supplied by the
external source at time t (in second) is V (t) = 2 + et
volt. If the current at time t = 0 is 1 ampere, find the
current at t = 2 second (correct to 3 significant places).
Predict what happens to the current in the circuit in the
long run.
99

Figure 4.2
As mentioned earlier on, the electric current is the same in
every part of the circuit. If we denote the electric current by
I(t) then
dI
.
dt
According to Kirchos voltage law, VR + VL equals the
input voltage supplied by the external source. Thus,
VR = 2I

and VL = 3

dI
+ 2I = 2 + et .
dt
This is a 1st order nonhomogeneous linear ODE. We solve
it now by the method of variation of parameter.
Firstly, we find a particular solution of the corresponding
homogeneous ODE
3

dJ
+ 2J = 0.
dt
Solving the ODE, we obtain
Z
Z
2
dJ
=
dt
J
3
2
ln(J) = t
3
J = e2t/3 .
3

100

Note that the constant of integration is ignored as we are only


interested in finding a particular solution. A particular solution
of the homogeneous ODE is J = e2t/3 .
To find the general solution of the original nonhomogeneous
ODE, we use
I = u(t)e2t/3
dI
2

= u(t)e2t/3 + u0 (t)e2t/3 .
dt
3
Substituting into the nonhomogeneous ODE, we obtain
2u(t)e2t/3 + 3u0 (t)e2t/3 + 2u(t)e2t/3 = 2 + et .
Rearranging, we find that
Z
Z
3 du = [2e2t/3 + et/3 ]dt
u = e2t/3 et/3 + C

where C is an arbitrary constant.


The required general solution is
I(t) = (e2t/3 et/3 + C)e2t/3
= 1 et + Ce2t/3 .

We are given I(0) = 1. Thus,


1 = 1 e0 + Ce0 C = 1.
The current flowing in the circuit is thus given by
I(t) = 1 et + e2t/3 .
The current at t = 2 second is given by
I(2) = 1 e2 + e4/3 ' 1.128 ampere.
To find out what happens to the current in the long run,
we let t in I(t), that is, we examine the limit
lim I(t) = lim [1 et + e2t/3 ] = 1.

Thus, in the long run, we expect the current to get closer and
closer to a constant value of 1 ampere.

101

2. Consider the LCR circuit in Figure 4.1. If the resistance,


inductance and capacitance are respectively R = 3 ohm,
L = 1 henry and C = 12 farad and the input voltage
supplied by the external source is V (t) = sin(t) volt, write
down a 2nd order ODE to describe the flow of current in
the circuit. At time t = 0, the current is 2 ampere and
the capacitor is not charged (that is, VC (0) = 0). Find
the current at any time t 0.
The voltages across the resistor, inductor and capacitor are
respectively
Z t
dI
VR = 3I, VL =
I( )d .
and VC = 2
dt
0
According to Kirchos voltage law, VR + VL + VC = sin(t).
Thus
Z t
dI
I( )d = sin(t).
+ 3I + 2
dt
0
Such an equation is called an integro-dierential equation.
The integro-dierential equation may be easily converted
into a 2nd order ODE by dierentiating it with respect to t
once and using Liebnitzs rule1 , that is,
Z t
d
d dI
[ + 3I + 2
[sin(t)]
I( )d ] =
dt dt
dt
0
I 00 (t) + 3I 0 (t) + 2I(t) = cos(t).
The 2nd order ODE is nonhomogeneous. To solve it, let us
solve the corresponding homogeneous ODE first, that is,
J 00 (t) + 3J 0 (t) + 2J(t) = 0.
1

In a nutshell, the Leibnitzs rule says:


Z x
d
f (u)du = f (x).
dx 0

102

Let us use
J = et , J 0 = et , J 00 = 2 et .
This leads to
2 + 3 + 2 = 0
( + 1)( + 2) = 0 = 1, 2.
The general solution of the homogeneous ODE is
J = Aet + Be2t
where A and B are arbitrary constants.
Let us now find a particular solution of the original nonhomogeneous ODE. The right hand side of the ODE suggests
that we try
I = sin(t) + cos(t)
where and are constants to be determined.
Dierentiating, we obtain
I 0 = cos(t) sin(t)

I 00 = sin(t) cos(t).
Substituting into the nonhomogeneous ODE, we obtain
sin(t) cos(t) + 3 cos(t) 3 sin(t)

+2 sin(t) + 2 cos(t) cos(t)

which leads to
[ 3] sin(t) + [3 + ] cos(t) cos(t).
The nonhomogeneous ODE is satisfied if we choose and
satisfying
3 = 0 and 3 + = 1,
103

that is,
=

1
3
and = .
10
10

Thus, a particular solution of the nonhomogeneous ODE is


I=

3
1
sin(t) +
cos(t),
10
10

and the required general solution is


I(t) =

3
1
sin(t) +
cos(t) + Aet + Be2t
10
10

where A and B are arbitrary constants.


We are given I(0) = 2. To determine the two arbitrary
constants A and B, another condition is required. This may
be obtained by letting t = 0 in the original integro-dierential
equation. We obtain the other condition as I 0 (0) = 6 as
follows.

Z 0
dI
+
3I(0)
+
2
I( )d = sin(0)
dt t=0
0
I 0 (0) = 3I(0) = 6
Dierentiating the general solution,
I 0 (t) =

3
1
cos(t)
sin(t) Aet 2Be2t .
10
10

We may now determine A and B. We find that


1
19
=
10
10
3
63
0
I (0) = 6 A 2B = 6
=
10
10
I(0) = 2 A + B = 2

which leads to
A=

5
22
and B = .
2
5

Hence, the current flowing in the circuit is given by


I(t) =

3
22
1
5
sin(t) +
cos(t) et + e2t .
10
10
2
5
104

3. Consider the electric network in Figure 4.3. Write down


a system of 3 equations for the electric currents I1 , I2
and I3 . Explain briefly how these equations can be solved
for I1 , I2 and I3 , without actually solving them.

Figure 4.3
To analyze the network, we break it up into two simple
circuits as shown in Figure 4.4 and apply Kirchos voltage
law separately on each of the circuits.
Applying Kirchos voltage law on the each of the circuits
in Figure 4.4, we obtain
Z t
2I3 +
I1 ( )d + VC (0) = 0
0

dI2
2I3 = 9
dt

where VC (0) is the voltage across the capacitor at time t = 0.


We reverse the direction of the current I3 in the circuit at the
bottom of Figure 4.4, as Kirchos voltage is applicable to a
closed loop of a circuit where the current flows in only one
direction only. (Note that I3 gives the current having the
same magnitude as I3 but flowing in the opposite direction.)
105

Figure 4.4
The first equation above is an integro-dierential equation
in 2 unknowns, namely I1 and I3 . The second equation is a 1st
order ODE in I2 and I3 . Since there are three unknowns I1 , I2
and I3 , a third equation is required to completely describe the
flow of current in the electric network.
Another equation may be obtained by applying Kirchos
curent law at the point (node) P in Figure 4.3. The total
amount of electric current entering P is I2 +I3 , while the electric
current leaving P is I1 . Thus,
I1 = I2 + I3 .
This is the required third equation.
How do we solve this system of 3 equations for I1 , I2 and
I3 ?
Dierentiating the integro-dierential equation with respect
to t, we obtain
2

dI3
+ I1 (t) = 0.
dt
106

This may be rewritten as


dI3
+ I2 (t) + I3 (t) = 0
dt

since I1 = I2 + I3 .
Dierentiating once more with respect to t, we obtain
2

d2 I3 dI2 dI3
+
+
= 0.
dt2
dt
dt

Now, from the ODE dI2 /dt 2I3 = 9, that is, dI2 /dt =
9 + 2I3 , we obtain the 2nd order ODE
2

dI3
d2 I3
+ 9 + 2I3 +
=0
dt2
dt

which may be rearranged to give


2

d2 I3 dI3
+ 2I3 = 9
+
dt2
dt

Once I3 is determined from the 2nd order ODE, we may


determine I1 from the ODE I1 (t) = 2dI3 /dt. The remaining
unknown I2 may then be found from I1 = I2 + I3 .
4. Consider once again the simple LR circuit in Figure 4.2.
Take the external source voltage V (t) to be given by the
piece-wise function

t for 0 t < 1
1 for 1 t < 2
V (t) =

0 for t 2.
If the electric current I is zero at time t = 0, find I(t)
for t 0.

According to Kirchos voltage law, the ODE for the electric current in the circuit is given by
3

dI
+ 2I = V (t).
dt
107

From the given external source voltage V (t), it is obvious that


we have to solve dierent ODEs over the time intervals 0 t <
1, 1 t < 2 and t 2.
The first ODE to solve is
3

dI
+ 2I = t for 0 t < 1.
dt

Solving the above ODE subject to the condition I(0) = 0, we


obtain
1
3 3
I(t) = t + e2t/3 .
2
4 4
This gives
1 3
I(1) = + e2/3 .
4 4
The second ODE
3

dI
+ 2I = 1 for 1 t < 2
dt

is to be solved subject to I(1) as computed above. We obtain


I(t) =

1 3
+ (1 e2/3 )e2t/3 for 1 t < 2
2 4

and
I(2) =

1 3
+ (1 e2/3 )e4/3 .
2 4

Lastly, we solve
3

dI
+ 2I = 0 for t 2
dt

subject to I(2) as computed above. We obtain


1
3
I(t) = [ e4/3 + (1 e2/3 )]e2t/3 for t 2.
2
4

108

4.3

Exercise VI

1. Consider the LCR circuit in Figure 4.1. If L = 1 (henry),


C = 1/13 (farad) and R = 6 (ohm), the input (external
source) voltage is V (t) = 2 sin(2t) (volt), the current at
time t = 0 is 0 (ampere) and the capacitor is not charged
at t = 0, find the current at time t = 2 (second).
2. Repeat Problem 1 with the input voltage given by

t for 0 t < /4
V (t) =
0 for t /4.
3. Find the currents I1 , I2 and I3 in Figure 4.3 (page 105),
if it is known that I1 (0) = I2 (0) = I3 (0) = 0 and the
capacitor is not charged at time t = 0.
4. A simple RC circuit is made up of a resistor, a capacitor
and an external source voltage. If the external source
voltage provides an input voltage which does not change
with time t and if the resistance R of the resistor and the
capacitance C of the capacitor are such that the RC = 1
(ohm farad), find the time taken for the magnitude of the
current to be reduced to 20% of its magnitude at t = 0.
5. A simple LC circuit is made up of an inductor, a capacitor and an external source voltage. If the external source
voltage provides a constant input voltage V0 and if the capacitance C of the capacitor and the inductance L of the
inductor are such that LC = 1 (ohm farad) and V0 C = 1
(volt farad), find the current flowing in the circuit, given
that at t = 0 there is no current and the capacitor is not
charged.

4.4
4.4.1

Spring-mass systems
A simple spring-mass system

We now look at the motion of a body (mass) attached to a


spring. The spring is hung vertically from a ceiling. A sketch
109

of the situation is given in Figure 4.5. We assume that the body


moves vertically up and down. There is no sideway motion. We
measure the position of the body at time t by y(t). According
to Figure 4.5, y is the downward displacement of the body from
a fixed reference position, that is, y > 0 if the body is below
the reference position and y < 0 if it is above.

Figure 4.5
Hookes law
The spring is said to be in its natural condition when it does
not exert any force on the body. For convenience, we assume
that the spring is in its natural condition when the body is
at the fixed reference position, that is, when the downward
displacement y of the body is zero.
Let the vertical length of the spring in its natural condition
be `natural . If the vertical length of the spring is changed to `,
the spring exerts a force (which we call the spring force) on the
body. According to Hookes law, the magnitude of the spring
force is proportional to |` `natural |. What is the direction of
the spring force? For the spring-mass system in Figure 4.5,
when ` > `natural (the spring extends in length), that is, when
the body is below the fixed reference position (y > 0), the
110

spring force acts upward on the body. On the other hand,


when ` < `natural (the spring compresses in length), that is,
when y < 0, the spring force acts downward on the body. In
short, for the system in Figure 4.5, the direction of the spring
force on the body is always opposite to that of the displacement
y.
Mathematically, the downward spring force2 on the body in
the spring-mass system in Figure 4.5 is given by

|` `natural | if ` < `natural


Fspring =
|` `natural | if ` `natural
where > 0 is the spring coecient (assumed to be a constant
here). The constant depends on the strength of the spring.
It is larger in magnitude for stronger springs. Since y is the
downward displacement of the body, we find that y = |`
`natural | when ` < `natural , and y = |``natural | when ` `natural .
Thus, for the spring-mass system in Figure 4.5, if the fixed
reference position is where the body is when the spring does not
exert any force, then Hookes law tells us that the downward
force exerted by the spring on the body is given by
Fspring = y.
ODE for the spring-mass system
If we can identify all the forces acting on the body attached
to the spring (the spring force is one of them), we may use
Newtons law of motion to form an ODE to describe the motion
of the body.
Apart from the spring force, the body may experience a
damping force as it moves through a medium such as air or viscous fluid. The downward force due to damping by the medium,
Fdamping , may be given by
Fdamping = k
2

dy
dt

When we say that a force F is downward, we mean that the force is


pointing downward if F > 0 and pointing upward if F < 0.

111

where k > 0 is the damping coecient. (If the spring-mass system is placed in vacuum, k = 0.) Note when the body is moving
downward, dy/dt > 0 and Fdamping < 0, that is, the damping
force is in the upward direction. When the body moves upward, dy/dt < 0 and Fdamping > 0, that is, the damping force
is acting downward. As we will see, the presence of damping
force helps to kill the motion of the body.
Another force acting on the body is the gravitational force.
This always acts downward. The downward gravitational force
acting on the body, Fgravity , is given by
Fgravity = mg
where g is the acceleration due to gravity (g ' 9.81 meter per
second per second around planet earth) and m is the mass of
the body.
We assume that there are no other types of forces acting on
the body. Thus, the total downward force acting on the body
is given by
Fspring + Fdamping + Fgravity = y k

dy
+ mg.
dt

Newtons law of motion tells us that


(total downward force acting on body)
= (mass of body) (downward acceleration of body)
d2 y
= m 2.
dt
It follows that
d2 y
dy
+ mg = m 2
dt
dt
d2 y
k dy

2 +
+ y = g.
dt
m dt
m
y k

We obtain a 2nd order linear ODE in y(t). The ODE is nonhomogeneous if g 6= 0.


112

Solution of the ODE


We now solve the ODE
k dy

d2 y
+
+ y=g
2
dt
m dt
m
for the spring-mass system in Figure 4.5.
We first solve the corresponding homogeneous ODE, that
is,
d2 Y

k dY
+ Y = 0.
+
2
dt
m dt
m
It is a homogeneous 2nd order linear ODE with constant coefficients.
Let us use
Y = et , Y 0 = et , Y 00 = 2 et .
Substituting into the homogeneous ODE, we find that
k

+
=0
m pm
k k2 4m
.
=
2m
2 +

The general solution for the homogeneous ODE is


2
2
Y (t) = Ae(k+ k 4m)t/(2m) + Be(k k 4m)t/(2m)
where A and B are arbitrary constants.
A particular solution of the original nonhomogeneous ODE
is
mg
.
y(t) =

This may be easily verified by substitution into the ODE.


Thus, the required general solution of the nonhomogeneous
ODE is
2
2
mg
y(t) =
+ Ae(k+ k 4m)t/(2m) + Be(k k 4m)t/(2m)

113

where A and B are arbitrary constants.


If the displacement y(t) and the velocity y 0 (t) of the body
are known at time t = 0, we may determine the constants A
and B. Even without knowing A and B, we may make certain
deductions about the motion of the body attached to the spring.
If k = 0, that is, in a vacuum (absence of damping), the
displacement becomes

mg
+ Aeit /m + Beit /m
y(t) =

r
r

mg
=
+ C cos(
t) + D sin(
t).

m
m
In this case, y does not tend to any fixed value as t .
Because of the real sine and cosine terms in time t, the body
keeps on oscillating forever if there is no damping to the motion.
If k2 < 4m, we find that the displacement may be rewritten
as
p
|k 2 4m| t
mg
y(t) =
+ Cekt/(2m) cos(
)

2m
p
|k 2 4m| t
).
+Dekt/(2m) sin(
2m

For the case k2 < 4m, if k 6= 0, we find thar y mg/ (a


constant) as t . The presence of the real sine and cosine
terms (in time) shows that the body does oscillate up and down
but the oscillation becomes smaller and smaller as time goes by.
The spring-mass system is said to be damped.
p
For k2 4m, we observe that the numbers k k 2 4m
are real and negative. Hence, for this case, the displacement as
given by

mg
(k+ k2 4m)t/(2m)
(k k2 4m)t/(2m)
y(t) =
+ Be
+ Ae

also tend to mg/ as t . There is, however, no sine and


cosine term in the solution. The body does not oscillate. The
motion dies down rapidly without any oscillation. The springmass system is said to be overdamped.
114

4.4.2

A more complicated spring-mass system

Consider now a more complicated spring-mass system which


consists of two vertical springs and two bodies connected as
shown in Figure 4.6. Let us assume that the only forces acting on the masses are due to the springs. Gravitational and
damping forces are ignored. It is not dicult, however, to incorporate them into the analysis, if necessary.

Figure 4.6

The two bodies are in motion here. We expect a system of


two ODEs to describe the motion.
Let y1 (t) and y2 (t) be the downward displacement of body 1
and 2 respectively from selected fixed reference positions. Refer
to Figure 4.6. For convenience, the fixed reference position for
each body is chosen to be where it (the body) is when the
springs do not exert any force (that is, when the springs are in
their natural condition).

115

Newtons law of motion gives


d2 y1
dt2
d2 y2
(total downward spring forces on body 2) = m2 2 .
dt

(total downward spring forces on body 1) = m1

Here m1 and m2 are the mass of body 1 and 2 respectively.


What are the total spring forces acting on the masses? For
our analysis, let us assume that y1 > 0 and y2 > 0, that is,
both bodies are below their fixed positions. (This assumption
is made only for the purpose of providing a clear explanation.
The final outcome of the analysis is the same whether the assumption holds or not.) It is clear that as body 1 displaces itself
below its fixed reference position, it extends spring 1 but compresses spring 2. On the other hand, as mass 2 displaces itself
below its fixed reference position, it extends spring 2. Thus,
spring 1 increases in length by y1 . The net increase in length of
spring 2 is y2 y1 . (If y2 > y1 then there is a positive increase
in the length of spring 2. If y2 < y1 , there is a negative increase
in length, that is, spring 2 shortens in length.)
Let the spring coecient of body 1 and 2 be denoted by
1 and 2 respectively. The downward force due to spring 1
acting on body 1 is 1 y1 . (For y1 > 0, this is negative, that
is, upward, as expected.) The downward spring force due to
spring 2 on body 1 is 2 (y2 y1 ). (To see this, let us consider the
case y2 > y1 . For this case, spring 2 extends in length. When
the length of spring 2 increases, it exerts a downward force on
body 1. Downward force is positive, hence 2 (y2 y1 ) > 0 for
y2 > y1 .) According to Newtons law of motion, body 1 gives
1 y1 + 2 (y2 y1 ) = m1

d2 y1
dt2

(1)

an ODE with 2 unknowns y1 and y2 .


The only force acting on body 2 is due to spring 2. The
downward spring force due to spring 2 on body 2 is given by
2 (y2 y1 ). (For y2 > y1 , spring 2 increases in length and
we expect the spring force due to spring 2 to point upward.
116

This is correct, as 2 (y2 y1 ) is negative for y2 > y1 .) Thus,


Newtons law for body 2 gives
2 (y2 y1 ) = m2

d2 y2
dt2

(2)

another ODE in y1 and y2 .


How do we solve this system of ODEs? One way is to
convert it to a single higher order ODE in only one unknown
as follows.
If we divide (2) by m2 and (1) by m1 , the dierence between
the two resulting ODEs gives
2 (

1
1

d2 Y
+
)Y + 1 y1 = 2
m2 m1
m1
dt

(3)

where Y = y2 y1 .
If we dierentiate (3) twice with respect to t, we obtain
2 (

1
1 d2 Y
d2 y1
d4 Y
+
) 2 + 1
=
m2 m1 dt
m1 dt2
dt4

which, by the use of (1), may be converted to


2 (

1
1 d2 Y

d4 Y
+
) 2 + 1 ( 1 y1 + 2 Y ) = 4 .
m2 m1 dt
m1 m1
m1
dt

Further use of the (3) to eliminate y1 gives a homogeneous 4th


order linear ODE in Y (t), that is,
Y 0000 + Y 00 + Y = 0
where
1
1

+
)+ 1
m2 m1
m1
1 2 1
1

(
+
) 1 22 .
m1 m2 m1
m1

= 2 (
=

The general solution of the ODE in Y may be obtained by


letting
Y = et
117

where is a constant to be determined from


4 + 2 + = 0.
If the quartic equation in gives 4 distinct solutions, that is,
= 1 , = 2 , = 3 and = 4 , then the required general
solution is given by
Y (t) = Ae1 t + Be2 t + Ce3 t + De4 t
where A, B, C and D are arbitrary constants. For further
details, refer to Chapter 3.
Once Y is found, y1 may be determined directly out from
(3). Subsequently, y2 = Y + y1 may be obtained. The 4 arbitrary constants in y1 and y2 can be found if we know, say,
y1 (0), y10 (0), y2 (0) and y20 (0) which gives the state of motion of
the two bodies at t = 0.

4.5

Exercise VII

1. Consider the spring-mass system in Figure 4.5. The only


forces acting on the body are the spring force, damping
force and gravity, and the spring force is 0 when the displacement y = 0, as discussed. The damping coecient,
the spring coecient and the acceleration due to gravity are denoted by k, and g respectively. If k/m = 2
(per second), /m = 10 (per second per second), g = 10
(meter per second per second) and the displacement and
velocity are both zero at time t = 0, find the displacement
and velocity at time t = 1 (second).
2. An electric motor is attached to the body in Figure 4.5.
The motor exerts a vertical force on the body. The downward force due to the motor is given by Fmotor = 10m cos(t)
(newton), where m is the mass (kilogram) of the body.
The only other force acting on the body is the spring
force. (Gravity and damping are ignored.) The spring
force is 0 when the displacement y is 0. The spring coecient is denoted by . Write down an ODE to describe the
118

motion of the body. If /m = 1 (per second per second)


and the displacement and velocity of the body are both
0 at time t = 0, find the displacement and velocity of the
body at time t = 1 (second).
3. As in Problem 2, an electric motor is attached to the body
in Figure 4.5. The downward force exerted by the motor
on the body is given by Fmotor = 4m cos(2t) (newton).
The spring force is 0 when the displacement y is 0. Take
the damping coecient k and the spring coecient to
be given by k/m = 6 (per second) and /m = 13 (per second per second) respectively. Ignore the eect of gravity
on the motion of the body. If the displacement and velocity of the body are both 0 at t = 0, find the displacement
at t = 2 (second).
4. Taking m1 = 1, m2 = 1, 1 = 6 and 2 = 4, solve the
ODEs for the spring-mass system in Figure 4.6 subject to
y1 (0) = y2 (0) = 1 and y10 (0) = y20 (0) = 0.

4.6

Solutions to Exercise VI

1. The integro-dierential equation for the LCR circuit is


Z t
dI
6I +
I( )d = 2 sin(2t)
+ 13
dt
0
which may be dierentiated to obtain the nonhomogeneous 2nd order linear ODE
6

d2 I
dI
+ 2 + 13I = 4 cos(2t).
dt
dt

We are given I(0) = 0. From the integro-dierential equation, we obtain I 0 (0) = 0. Thus, the nonhomogeneous 2nd
order linear ODE is to be solved subject to I(0) = I 0 (0) =
0. The corresponding homogeneous ODE is
6

dJ
d2 J
+ 2 + 13J = 0.
dt
dt
119

The general solution of the homogeneous ODE (obtained


by trying J = et ) is
J(t) = e3t (A cos(2t) + B sin(2t)).
To obtain a particular solution of the nonhomogeneous
ODE, try I(t) = sin(2t) + cos(2t). Substituting into
the ODE gives = 16/75 and = 4/25. Thus, the general solution of the ODE is
I(t) =

16
4
sin(2t) +
cos(2t)
75
25
+e3t (A cos(2t) + B sin(2t)).

Applying the conditions I(0) = I 0 (0) = 0 gives A =


4/25 and B = 34/25. The current is
4
16
sin(2t) +
cos(2t)
75
25
4
34
+e3t ( cos(2t)
sin(2t)).
25
75

I(t) =

The current at time t = 2 second is


16
4
sin(4) +
cos(4)
75
25
4
34
+e6 ( cos(4)
sin(4))
25
75
' 0. 264 9 ampere.

I(2) =

2. The integro-dierential equation for the LCR circuit is


Z t
dI
6I +
+ 13
I( )d = V (t)
dt
0
which may be dierentiated to give
6

d
d2 I
dI
+ 2 + 13I = [V (t)].
dt
dt
dt

Since the voltage is given by

t for 0 t < /4
V (t) =
0 for t /4
120

and hence
d
[V (t)] =
dt

1 for 0 t < /4
0 for t /4

the task of finding the current has to be divided into two


parts as follows.
In the first part, the ODE to solve is
6

dI
d2 I
+ 2 + 13I = 1.
dt
dt

The above ODE is valid for 0 t < /4. At time t = 0,


we are given I(0) = 0. From the above integro-dierential
equation with V (t) = t, we find that I 0 (0) = 0. Solving
the ODE subject to these conditions, we obtain
I (t) =

1
1
e3t cos(2t) e3t sin(2t) for 0 t < .
13 13
26
4

In the second part which is for t /4, the ODE to solve


is
6

dI
d2 I
+ 2 + 13I = 0.
dt
dt

We need to have two conditions. We can calculate the


current I(t) at t = /4 using the solution above for 0
t < /4. (Due to the law of conservation of charge, the
current has to be a continuous function of time t. Hence
we expect the current for 0 t < /4 to match with that
for t /4 at time t = /4.) We find that

I( ) =
4
=

1
1
3

e3/4 cos( ) e3/4 sin( )


13 13
2
26
2
1
3 3/4
.
e
13 26

The value of I 0 (/4) must be obtained from the integrodierential equation with V (t) = 0 (that is, the integrodierential equation which is valid for t /4). We find
121

that

6I( ) + I 0 ( ) + 13
4
4

/4

I( )d = 0.

Using integration by parts twice, after a bit of tedious


work, we find that
Z /4
Z /4
1
1
I( )d =
( e3t cos(2t)
13 13
0
0
3 3t
e sin(2t))dt
26
5 3/4
6
1
+
e

=
52
338
169
and hence

1
1
I 0 ( ) = e3/4 .
4
2
4
For t /4 , we have to solve
6

dI
d2 I
+ 2 + 13I = 0
dt
dt

subject to

1
1
3
1
I( ) =
e3/4 and I 0 ( ) = e3/4 .
4
13 26
4
2
4
We obtain
I(t) =

e3/4
(12 8e3/4 + 13)e3t cos(2t)
104
e3/4

(2 + 3e3/4 )e3t sin(2t) for t .


26

3. Refer to page 105 (and a few pages thereafter) for equations for I1 , I2 amd I3 . We start with
2

d2 I3 dI3
+
+ 2I3 = 9.
dt2
dt
122

To solve this, we need two conditions on I3 . One condition


is given, that is, I3 (0) = 0. Another condition can be
obtained from I1 (0) = 0 and the ODE 2I30 (t) + I1 (t) = 0,
that is, we obtain I30 (0) = 0. Solving the ODE in I3 (t)
subject to I3 (0) = 0 and I30 (0) = 0 (standard procedure),
we obtain
9 9
1
I3 (t) = + et/4 cos(
15t)
2 2
4
1
3 t/4
15e
sin(
15t).
+
10
4
The current I1 (t) can be obtained from 2I30 (t) + I1 (t) = 0,
that is,
dI3
dt
d
1
9 9
= 2 ( + et/4 cos(
15t)
dt 2 2
4
1
3 t/4
15e
sin(
15t))
+
10
4
12 t/4
1
=
15e
sin(
15t).
5
4

I1 (t) = 2

Lastly, I2 (t) is given by


I2 (t) = I1 (t) I3 (t)
21 t/4
1
9
=
15e
sin(
15t) +
10
4
2
9 t/4
1
e
cos(
15t).
2
4
4. Let the external source voltage be given by V (t) = K
(cosntant). The integral equation for the RC circuit is
Z
1 t
RI +
I( )d = K
C 0
which may be dierentiated to give
dI
+ I = 0.
dt
123

Note that RC = 1. The 1st order ODE can be easily


solved to give I(t) = I(0)et . To find the time when the
time t is 20% of I(0), we set I(t) = I(0)/5. This gives
1
1
= et t = ln( ) = ln(5) ' 1. 609 second.
5
5
5. We are given LC = 1 and V0 C = 1. This implies V0 /L =
1. For the LC circuit, the integro-dierential equation is
Z
dI
1 t
L +
I( )d = V0
dt
C 0
Z t
dI

I( )d = 1
+
dt
0
V0
= 1)
(after using LC =
L
d2 I

+ I(t) = 0 .
dt2
The 2nd order ODE can be solve to give the general solution
I(t) = A cos(t) + B sin(t).
We are told I(0) = 0. From the integro-dierential equation, I 0 (0) = 1. Using I(0) = 0 and I 0 (0) = 1, we obtain A = 0 and N = 1, that is, the required solution is
I(t) = sin(t).

4.7

Solutions to Exercise VII

1. The ODE for the spring-mass system is y 00 (t) + 2y 0 (t) +


10y(t) = 10. To solve the corresponding homogeneous
ODE, that is, Y 00 (t) + 2Y 0 (t) + 10Y (t) = 0, we let Y = et
to look for two linearly independent solutions. We obtain
the general solution Y (t) = et (A cos(3t) + B sin(3t)). It
is easy to see that a particular solution of the nonhomogeneous ODE for the spring-mass system is y = 1. Thus,
the general solution of the nonhomogeneous ODE is
y(t) = 1 + et (A cos(3t) + B sin(3t)).
124

Fitting the given conditions y(0) = 0 and y 0 (0) = 0 into


the general solution above, we obtain A = 1 and B =
1/3. Thus,
y(t) = 1 et (cos(3t) +

1
sin(3t)).
3

The velocity of the mass is given by


y 0 (t) =
=

d
1
(1 et (cos(3t) + sin(3t)))
dt
3
10 t
e sin(3t)
3

The displacement at t = 1 is given by


y(1) = 1 e1 (cos(3) +

1
sin(3))
3

' 1. 347 meter.


The velocity at t = 1 is y 0 (1) =
per second.

10 1
sin(3)
3 e

' 0. 173 meter

2. Newtons law gives


d2 y
dt2
d2 y
y + 10m cos(t) = m 2
dt

00
y (t) + y(t) = 10 cos(t) (after using
= 1).
m
Fspring + Fmotor = m

The corresponding homogeneous ODE Y 00 (t) + Y (t) = 0


has general solution Y (t) = A cos(t) + B sin(t). To look
for a particular solution of the nonhomogeneous ODE,
we let y(t) = t(C cos(t) + D sin(t)) (can you see why
y(t) = C cos(t) + D sin(t) would not work?), substitute
it into the ODE and choose C and D to ensure that the
ODE is satisfied. We obtain y(t) = 5t sin(t) as a particular solution. It follows that the general solution of the
nonhomogeneous ODE is
y(t) = 5t sin(t) + A cos(t) + B sin(t).
125

Applying the given conditions y(0) = 0 and y 0 (0) = 0, we


find that A = B = 0. Thus, the displacement and velocity
are given by
y(t) = 5t sin(t)
d
y 0 (t) = 5 (t sin(t)) = 5t cos(t) + 5 sin(t).
dt
At time t = 1, the displacement is y(1) = 5 sin(1) ' 4.
207 meter and the velocity is y 0 (1) = 5 cos(1) + 5 sin(1) '
6. 909 meter per second.
3. Newtons law gives
d2 y
dt2
2
d y
dy
4m cos(2t) = m 2
y k
dt
dt
00
0
y (t) + 6y (t) + 13y(t) = 4 cos(2t)
k

= 13 and
= 6).
(after using
m
m
The general solution of the corresponding homogeneous
ODE Y 00 (t)+6Y 0 (t)+13Y (t) = 0 is Y (t) = e3t (A cos(2t)+
B sin(2t)). To find a particular solution of the nonhomogeneous ODE, we let y(t) = C cos(2t) + D sin(2t) and
work out C and D. We obtain C = 4/25 and D =
16/75. Thus, the displacement is given generally by
Fspring + Fdamping + Fmotor = m

16
4
cos(2t)
sin(2t)
25
75
+e3t (A cos(2t) + B sin(2t))

y(t) =

Using the conditions y(0) = 0 and y 0 (0) = 0, we find that


A = 4/25 and B = 34/75. Thus, the required displacement is
4
16
y(t) = cos(2t)
sin(2t)
25
75
4
34
sin(2t)).
+e3t ( cos(2t) +
25
75
The displacement at time t = 2 is y(2) ' 0. 265 meter.
126

4. Refer to the analysis on page 116 (and a few pages thereafter). Now y1 and y2 denote the displacement of body
1 and 2 respectively. We first solve for Y = y2 y1 . The
ODE to solve is Y 0000 + 14Y 00 + 24Y = 0. If we try Y =et ,
we
obtain 2 = 2 or 12. It follows that = 2i,
2 3i. This gives the general solution

Y (t) = A cos( 2t) + B sin( 2t)

+C cos(2 3t) + D sin(2 3t).


We can now work out y1 as follows.
6y1

Y 00 (t) + 8Y

y1 = A cos( 2t) + B sin( 2t)

2
2
C cos(2 3t) D sin(2 3t).
3
3

It follows that
y2 = Y + y1

= 2A cos( 2t) + 2B sin( 2t)

1
1
+ C cos(2 3t) + D sin(2 3t).
3
3

We are given y1 (0) = y2 (0) = 1. This gives A 2C/3 = 1


and 2A + C/3 = 1, that is, A = 3/5 and C = 3/5. To
work out B andD, we use y10 (0) = y20 (0)= 0, that is, we

obtain 2B 4 3 3 D = 0 and 2 2B + 2 3 3 D = 0 to give


B = D = 0. Thus, the required displacements are
y1 (t) =
y2 (t) =

3
cos( 2t) +
5

6
cos( 2t)
5

127

2
cos(2 3t)
5

1
cos(2 3t).
5

Chapter 5

Series solutions
5.1

Preamble

As seen in Chapter 3, if we can find two linearly independent


solutions of a homogeneous 2nd order linear ODE, we can use
Theorem 2 (page 53) to construct the general solution of the
ODE. So far, however, we have learnt how to systematically
obtain solutions for only two specific types of homogeneous
2nd order linear ODEs: those with constant coecients and
the Euler-Cauchy equations.
In this chapter, we will look at the power series method
and the Frobenius method for deriving series solutions of rather
general homogeneous 2nd order linear ODEs. The methods can
be applied to treat well known ODEs in mathematical physics,
such as the Legendres equation and Bessels equation, giving
rise to particular special functions, but here we will not go into
the details of those ODEs and the associated special functions.

5.2

Review of power series

A power series of x centered about the constant is a series of


the form

n=0

cn (x )n = c0 + c1 (x ) + c2 (x )2 +
128

where c0 , c1 , c2 , are coecients of the powers of (x ).


Note that c0 , c1 , c2 , are independent of x.
The radius of convergence of the above power series is the
largest non-negative number R such that the series converges
for R < x < + R. It can be found by using the ratio test
which states that the power series converges if

(m + 1)th non-zero term in the series


< 1.
lim
m
mth non-zero term in the series

If ck 6= 0 for k greater than a positive integer (for example,


ck 6= 0 for k > 10) then the ratio test above gives

cm+1 (x )m+1

<1
lim

m cm (x )m

cm
cm

.
R = lim
|x | < lim
m cm+1
m cm+1

Power series may be used to represent functions. If a function F (x) can be represented by a power series of x centered
about , that is, if we can write

X
cm (x )m for R < x < + R
F (x) =
m=0

then we can dierentiate the power series term by term to obtain a power series representation for F 0 (x) as follows.
F 0 (x) =

m=0

cm

d
(x )m
dx

d
d
d
(1) + c1 (x ) + c2 (x )2
dx
dx
dx
d
+c3 (x )3 +
dx
= c1 + 2c2 (x ) + 3c3 (x )2 +

X
=
kck (x )k1 (note that k starts from 1)
= c0

k=1

X
=
(n + 1)cn+1 (x )n (if we let k = n + 1)
n=0

for R < x < + R.


129

Similarly, if we start from


0

F (x) =

(m + 1)cm+1 (x )m for R < x < + R

m=0

then

F 00 (x) =

(m + 1)cm+1

m=0

k=1

(k + 1)kck+1 (x )k1

d
(x )m
dx

(n + 2)(n + 1)cn+2 (x )n

n=0

for R < x < + R.

If F (x) is a function which can be dierentiated as many


times as we like at x = , its Taylor series about x = is given
by the power series

X
F (n) ()

n=0

n!

(x )n = F () + F 0 ()(x )
+

F 00 ()
(x )2 + .
2!

If the Taylor series of F (x) about x = has a positive


radius of convergence R and if the function F (x) is such that1
F (n) ()
(x )n = 0
n
n!
lim

for all between and x and R < x < + R then


we can represent F (x) by its Taylor series about x = for
R < x < + R, that is, we can write
F (x) =

X
F (n) ()

n=0
1

n!

(x )n for R < x < + R.

Check out on the Lagrange remainder term for Taylor series.

130

5.3

Power series method for ODEs

Consider the homogeneous 2nd order linear ODE


y 00 + f (x)y 0 + g(x)y = 0.

(1)

If f (x) and g(x) can be represented by their Taylor series


about x = then the power series method may be used to find
a general solution (in series form) for (1). The steps involved
are described in a general manner as follows.
(i) Write
f (x) =

X
f (m) ()
(x )m
m!
m=0

X
g (m) ()
g(x) =
(x )m .
m!
m=0

(2)

(ii) For a solution of (1), let y(x) be given by a power series


of x centered about , that is, let
y(x) =

n=0

cn (x )n .

(3)

Here c0 , c1 , c2 , are coecients to be determined using


(1). If the two series in (2) are valid for R < x < +R
(R is a positive number) then so is the series in (3).
(iii) Dierentiate (3) to obtain2

X
y (x) =
(n + 1)cn+1 (x )n .
0

(4)

n=0

Similarly, dierentiate (4) to obtain


y 00 (x) =

X
(n + 2)(n + 1)cn+2 (x )n .

n=0
2

The dierentiation of power series is explained on page 129.

131

(5)

(iv) Substitute (2), (3), (4) and (5) into the ODE in (1) to
obtain

X
(n + 2)(n + 1)cn+2 (x )n

n=0

+
+

X
f (m) ()
(n + 1)cn+1 (x )n
(x )m
m!
m=0
n=0

X
X
g (m) ()
cn (x )n = 0.
(x )m
m!
m=0
n=0

(6)

(v) Rewrite (6) in the form

X
p=0

bp (x )p = 0.

(7)

To work out bp , we note that

X
X
f (m) ()
(n + 1)cn+1 (x )n
(x )m
m!
m=0
n=0

=
=

(n + 1)cn+1

n=0
p
X
X

X
f (m) ()
(x )m+n
m!
m=0

(n + 1)cn+1

p=0 n=0

f (pn) ()
(x )p
(p n)!

(if we let m + n = p).

(8)

Similarly, we also note that

X
X
g (m) ()
cn (x )n
(x )m
m!
m=0
n=0

p
X
X

p=0 n=0

cn

g (pn) ()
(x )p .
(p n)!

(9)

If we rename the summation (dummy) index n as p (that


is, let p = n) in the series on the first line of (6) and
132

replace the series on the second and third lines using (8)
and (9) respectively, we obtain
bp = (p + 2)(p + 1)cp+2
p
X
f (pn) ()
g (pn) ()
+ cn
}
+
{(n + 1)cn+1
(p n)!
(p n)!
n=0
for p = 0, 1, 2, .

(10)

If the series solution (3) is valid for R < x < + R


then, to ensure that (7) holds for all the values of x within
the given range, we need to set bp = 0 for p = 0, 1, 2, ,
that is, we have to ensure that
(p + 2)(p + 1)cp+2
p
X
f (pn) ()
g (pn) ()
+ cn
}
=
{(n + 1)cn+1
(p n)!
(p n)!
n=0

for p = 0, 1, 2, .

(11)

(vi) Use (11) to determine the coecients c2 , c3 , c4 in


terms of c0 and c1 . The constants c0 and c1 can be regarded as arbitrary. No matter what values are given to
c0 and c1 , we can always work out c2 , c3 , c4 from (11).
(Note that the right hand side of (11) does not contain
cp+2 and the factor (p + 2)(p + 1) multiplied to cp+2 is
never zero.)
We will now apply the steps above to specific examples of
ODEs. In the first three examples below, we consider 2nd order
linear ODEs which can also be solved as explained in Chapter
3. In those examples, we can check that the series solutions
agree with the solutions obtained as described in Chapter 3.
Examples
1. Use the power series method to solve the ODE y00 2y 0 =
0, taking y to be a power series of x centered about 0.

133

In this example, the coecients f (x) and g(x) (refer to the


general ODE (1) on page 131) are given by f (x) = 2 and
g(x) = 0. They are already in the form of their Taylor series
about x = 0.
To solve the given ODE, let
y(x) =

cn xn .

n=0

It follows that
y0 =
y00 =

(n + 1)cn+1 xn

n=0

(n + 2)(n + 1)cn+2 xn .

n=0

Substituting the above into the given ODE, we obtain

X
{(p + 2)(p + 1)cp+2 2(p + 1)cp+1 }xp = 0.
p=0

Setting the coecient of xp in the series above to 0, we find


that
2
cp+2 =
cp+1 for p = 0, 1, 2, .
(p + 2)
Note that the above relation is a specific case of (11).
If we let p = 0, we obtain
2
c2 = c1 .
2
Subsequent values of p give
2
22
c2 = c1
3
3!
2
23
=
c3 = c1
4
4!
2
24
=
c4 = c1
5
5!
..
.

c3 =
c4
c5

134

From the above, we deduce that


cn =

2n1
c1 for n = 2, 3, 4, .
n!

We can easily check whether the deduced formula for cn is correct as follows.
2n1
c1
n!
2p+11
2p
cp+1 =
c1 =
c1
(p + 1)!
(p + 1)!
2p+21
cp+2 =
c1
(p + 2)!
2
2p
=
c1
(p + 2) (p + 1)!
2
=
cp+1 (verified).
(p + 2)
cn =

The required series solution is given by


y(x) =

cn xn

n=0

= c0 +

X
2n1

n=1

n!

c1 xn

c1 X (2x)n
= c0 +
.
2 n=1 n!

There are two observations we may make concerning the


series solution above.
Firstly, if we solve the ODE y 00 2y 0 = 0 as described in
Chapter 3 (that is, by letting y = ex to find two linearly
independent solutions and then applying Theorem 2 on page
53), we obtain the general solution y = A + Be2x , where A and
B are arbitrary constants. Thus, we may like to check if we
can recover this general solution from the series solution. We

135

can rewrite the series solution as

c1 X (2x)n
y(x) = c0 +
2 n=1 n!

c1 c1
c1 X (2x)n
= c0 + ( + ) +
2
2
2 n=1 n!

c1 X (2x)n
c1
c1
c1
= (c0 ) + e2x
= (c0 ) +
2
2
n!
2
2
n=0

since from the Taylor series of ex about x = 0 we know that


ex

X
xn

n=0

n!

e2x =

X
(2x)n

n=0

n!

As there is no restriction on the coecients c0 and c1 , they are


arbitrary. Thus, if we let A = c0 12 c1 and B = 12 c1 , A and
B are arbitrary constants and we recover the general solution
y = A + Be2x .
Secondly, we note that the series solution above converges
for all x (as the Taylor series for e2x is valid for < x < ).
This is as expected since the Taylor series of the coecients,
that is, f (x) = 2 and g(x) = 0, used in the derivation of the
series solution converges for all x.
2. Derive a solution for the ODE y 00 + x1 y0 x2 y = 0 by
taking y to be a power of x centered about 1. Determine
the range of x for which the series solution converges.
(For this ODE, it is not possible to find a solution in the
form of a power series centered about 0.)
To express the coecient of y 0 , that is f (x) = x1 , in terms

136

of its Taylor series about x = 1, we note that


f (x) = x1 f (1) = 1

f 0 (x) = x2 f 0 (1) = 1

f 00 (x) = 2x3 f 00 (1) = 2

f 000 (x) = 3 2x4 f 000 (1) = 3!

f 0000 (x) = 4 3 2x5 f 0000 (1) = 4!


..
.
From the above, we deduce that
f (m) (1) = m!(1)m .

If the Taylor series of f (x) = x1 about x = 1 converges, then


we can write

X
1
=
(1)m (x 1)m .
x m=0

Whether the Taylor series of f (x) = x1 about x = 1 converges or not depends on the value of x. For example, if x = 2,
the series diverges as the n-th term in the series does not tend to
0 as n increases. The range of x for which the series converges
can be determined by calculating the radius of convergence of
the series.
Since the Taylor series of x1 about x = 1 has non-zero
coecients for all positive powers of (x 1), its radius of convergence is given by

(1)m
= 1.
R = lim
m (1)m+1

Thus, the power series of x1 about x = 1 converges for 0 <


x < 2.
In a similar way, we can work out the Taylor series of g(x) =
x2 about x = 1. If the Taylor series converges then we can
write

X
1
2 =
(m + 1)(1)m (x 1)m .
x
m=0

137

The series also converges for 0 < x < 2. Note that


g (m) (1) = (m + 1)!(1)m
An alternative way to derive the power series representing
g(x) = x2 is to dierentiate the Taylor series of f (x) = x1
about x = 1 as follows.
d 1
( )
dx x

X
X
n d
n
(1)
n(1)n (x 1)n1
(x 1) =
dx
n=0
n=1

X
1
2 =
(m + 1)(1)m (x 1)m
x
m=0

(if we let n = m + 1)

If we look for a solution of the ODE in the series form


y(x) =

n=0

cn (x 1)n

then (11) in step (v) above of the power series method (page
133) gives
(p + 2)(p + 1)cp+2
p
X
=
{(n + 1)cn+1 (p n + 1)cn }(1)pn
n=0

for p = 0, 1, 2, .

For p = 0, we obtain
2c2 = c0 c1 .
Subsequent values of p give
6c3 = 2(c1 c0 c2 ) c3 = c2

12c4 = 3c1 + 3c0 + 3c2 3c3 c4 = c2

20c5 = 4c1 4c0 4c2 + 4c3 4c4 c5 = c2


..
.
138

Thus, we deduce that


1
cp = (1)p (c0 c1 ) for p = 2, 3, 4, .
2
The required series solution is given by

X
1
(1)p (x 1)p .
y(x) = c0 + c1 (x 1) + (c0 c1 )
2
p=2

We can rewrite the series solution as


1
1
y(x) = c0 + c1 (x 1) (c0 c1 ) + (c0 c1 )(x 1)
2
2

X
1
(1)p (x 1)p
+ (c0 c1 )
2
p=0
which simplifies to

X
1
1
y(x) = (c0 + c1 )x + (c0 c1 )
(1)p (x 1)p .
2
2
p=0

The series above (with the sum from p = 0 to ) converges to


x1 for 0 < x < 2. Thus, the series solution is valid only for
0 < x < 2. This is as expected since the power series for the
coecients of y and y 0 in the ODE converges for the same range
of x. Furthermore, if we set A = 12 (c0 + c1 ) and B = 12 (c0 c1 )
(where A and B are arbitrary constants since c0 and c1 can
be given any values we like), we find the series solution of the
ODE gives
y(x) = Ax +

X
B
1
(1)p (x 1)p = ).
(since
x
x
p=0

This is the general solution which we obtain if we solve y 00 +


x1 y 0 x2 y = 0 as an Euler-Cauchy equation (that is, by
rewriting and solving it as x2 y 00 + xy0 y = 0, as described in
Chapter 3).
In the above, in finding the solution in terms of a power
series centered about 1 directly from the ODE y 00 + x1 y0
139

x2 y = 0, we have to work out the power series centered about


1 for the coecients x1 and x2 . For this particular ODE,
it is possible to avoid working out power series representations
for the coecients, if we use the ODE in its rewritten form
x2 y 00 + xy 0 y = 0 and proceed as follows to work out the same
series solution.
Rewrite x2 y 00 + xy 0 y = 0 further as
x2 y00 + xy 0 y = 0

([x 1] + 1)2 y 00 + ([x 1] + 1)y0 y = 0

([x 1]2 + 2[x 1] + 1)y00 + ([x 1] + 1)y 0 y = 0.


Substitute the proposed power series solution given by
y(x) =

n=0

and its derivatives


y

cn (x 1)n

X
=
(n + 1)cn+1 (x 1)n
n=0

y 00 =

(n + 2)(n + 1)cn+2 (x 1)n .

n=0

into the rewritten ODE above to obtain

X
(n + 1)(n + 2)cn+2 (x 1)n+2
n=0

X
+2
(n + 1)(n + 2)cn+2 (x 1)n+1
n=0

X
+
(n + 1)(n + 2)cn+2 (x 1)n

+
+

n=0

(n + 1)cn+1 (x 1)n+1

n=0

(n + 1)cn+1 (x 1)

n=0

= 0

140

n=0

cn (x 1)n

which may be rewritten as

X
X
(p 1)pcp (x 1)p + 2
p(p + 1)cp+1 (x 1)p
p=2

p=1

X
p=0

(p + 1)(p + 2)cp+2 (x 1)p +

X
p=1

pcp (x 1)p

X
X
p
+
(p + 1)cp+1 (x 1)
cp (x 1)p = 0
p=0

p=0

to give
2c2 + c1 c0 + (6c2 + 6c3 )(x 1)

X
(p + 1){(p + 2)cp+2 + (2p + 1)cp+1
+
p=2

= 0.

+(p 1)cp }(x 1)p

To satisfy the ODE for all x, we set


2c2 + c1 c0 = 0
6c2 + 6c3 = 0

and
(p + 2)cp+2 + (2p + 1)cp+1 + (p 1)cp = 0 for p = 2, 3, ,
that is,
1
c2 = (c0 c1 ), c3 = c2 , c4 = c2 , c5 = c2 and so on.
2
From the above, we deduce that
1
cp = (1)p (c0 c1 ) for p = 2, 3, 4,
2
as before.
141

3. Use the power series method to solve y00 + 4y = 0 subject


to y(0) = 1 and y0 (0) = 2.
Let the series solution be given by
y(x) =

cn xn

n=0

As before, it follows that

X
(n + 1)cn+1 xn
y (x) =
0

y 00 (x) =

n=0

(n + 2)(n + 1)cn+2 xn .

n=0

Substituting the above into the given ODE, we find that

X
{(p + 2)(p + 1)cp+2 + 4cp }xp = 0
p=0

which gives
(p + 2)(p + 1)cp+2 = 4cp for p = 0, 1, 2, .
For p = 0 and p = 1, we obtain
4
2c2 = 4c0 c2 = c0
2
4
c1
3 2c3 = 4c1 c3 =
32
Subsequent even values of p yields
42
c0
4!
43
= 4c4 c6 = c0
6!
4
4
= 4c6 c8 = c0
8!
45
= 4c8 c10 = c0
10!
..
.

4 3c4 = 4c2 c4 =
6 5c6
8 7c8
10 9c10

142

while odd values of p gives


42
c1
5!
43
= 4c5 c7 = c1
7!
4
4
= 4c7 c9 = c1
9!
45
= 4c9 c11 = c1
11!
..
.

5 4c5 = 4c3 c5 =
7 6c7
9 8c9
11 10c11

From the above, we deduce that


c2k =

(1)k 4k
c0 for k = 0, 1, 2,
(2k)!

and
c2k+1 =

(1)k 4k
c1 for k = 0, 1, 2, .
(2k + 1)!

Now from y(0) = 1, we obtain c0 = 1. Similarly, y 0 (0) = 2


gives c1 = 2. Thus,
c2k =

(1)k 4k
for k = 0, 1, 2,
(2k)!

and
c2k+1 =

2(1)k 4k
for k = 0, 1, 2, .
(2k + 1)!

We break up the series for y into odd and even powers of x,


that is,
y(x) =

cn xn +

n=0,2,4,

X
c2k x2k
k=0

cn xn

n=1,3,5,

143

X
k=0

c2k+1 x2k+1 .

From the deduced formulae for c2k and c2k+1 for k = 0, 1, 2,


, it follows that the required series solution of the ODE is
y(x) =

X
(1)k 4k
k=0

(2k)!

x2k +

X
2(1)k 4k
k=0

(2k + 1)!

x2k+1 .

As a check, let us rewrite the series solution as


y(x) =

X
(1)k 22k
k=0

(2k)!

x2k +

k=0

X
(1)k (2x)2k
k=0

X
(1)k 22k+1

(2k)!

(2k + 1)!

x2k+1

X
(1)k (2x)2k+1
k=0

(2k + 1)!

From the Taylor series of sin(x) and cos(x) about x = 0, we


find that
sin(x) =
cos(x) =

X
(1)k x2k+1
k=0

X
k=0

(2k + 1)!

sin(2x) =

(1)k x2k
cos(2x) =
(2k)!

X
(1)k (2x)2k+1

k=0

X
k=0

(2k + 1)!

(1)k (2x)2k
.
(2k)!

Thus, the series solution derived above can be rewritten as


y(x) = cos(2x) + sin(2x)
which is what we obtain if we solve y 00 + 4y = 0 subject to
y(0) = 1 and y 0 (0) = 2 as described in Chapter 3.
4. Consider solving the ODE y 00 + ex y 0 + y = 0 subject to
y(0) = y0 (0) = 1 using the power series method, by taking
y to be a power series of x centered about 0. Truncate the
series solution to obtain a quartic (4th order polynomial)
approximation of y.
Let the series solution be given by
y(x) =

n=0

144

cn xn .

Here c0 = y(0) = 1 and c1 = y 0 (0) = 1.


Applying (11) in step (v) above of the power series method
(page 133), we obtain
(p + 2)(p + 1)cp+2 =

p
X

(n + 1)cn+1

n=0

for p = 0, 1, 2, .

1
cp
(p n)!

Letting p = 0, 1, 2, we find that


2c2 = c1 c0 = 1 1 = 2 c2 = 1

6c3 = c1 2c2 c1 = 0 c3 = 0
1
5
5
12c4 = c1 2c2 3c3 c2 = c4 =
2
2
24
Thus, the required approximation is given by
y(x) ' 1 + x x2 +

5 4
x .
24

An alternative way to derive the approximation above is as


follows. If we assume that the required solution of the ODE
can be represented by its Taylor series about x = 0 then we
can write
y(x) ' y(0) + y 0 (0)x +

y 00 (0) 2 y000 (0) 3 y0000 (0) 4


x +
x +
x .
2!
3!
4!

It is given that y(0) = 1 and y0 (0) = 1. We can work out y 00 (0),


y000 (0) and y 0000 (0) from the ODE y00 + ex y0 + y = 0 as follows.
y00 + ex y0 + y = 0
y000 + ex y 0 + ex y 00 + y0 = 0

y0000 + ex y 0 + 2ex y 00 + ex y 000 + y 00 = 0


y00 (0) = e0 y0 (0) y(0) = 2

y000 (0) = e0 y 0 (0) e0 y 00 (0) y 0 (0) = 0

y0000 (0) = e0 y 0 (0) 2e0 y00 (0) e0 y 000 (0) y00 (0) = 5.

Thus, from the Taylor series of y about x = 0, we can also


obtain the quartic approximation which we have derived earlier
on.
145

5.4

Exercise VIII

1. Use the power series method to solve each of the following


ODEs. Give your solution as a power series of x centered
about 0. State the range of x over which the series solution
converges.
(a)
(b)
(c)

y 00 25y = 0

y 00 + 5y0 6y = 0 with y(0) = 2 and y 0 (0) = 5

y 00 + 5(x 1)1 y0 + 3(x 1)2 y = 0

with y(0) = 0 and y0 (0) = 2

(Multiply this ODE by (x 1)2 , if you like.)


2. For each of the following ODEs and given conditions,
write down the first four non-zero terms of its power series
solution centered about 0.
(a)

y 00 + sin(x)y = 0 with y(0) = 1 and y0 (0) = 0

(b)

y 00 4y0 + 13y = 0 with y(0) = y 0 (0) = 1

(c)

y 00 + sin(2x)y 0 + cos(2x)y = 0

with y(0) = 0 and y 0 (0) = 1


3. Apply the power series method directly on
(1 x2 )y 00 2xy 0 + 42y = 0
to find the exact solution of the ODE subject to y(0) = 2
and y 0 (0) = 0. (Begin by taking y to be in the form of a
power series of x centered about 0. You will find that the
coecient of xn in the series solution, that is, cn is zero if
n exceeds a certain value and the required exact solution
turns out to be a polynomial function.)
4. Repeat Problem 3 above using the ODE
(1 x2 )y 00 2xy 0 + 56y = 0
with y(0) = 0 and y0 (0) = 2.
146

5.5

Frobenius method

We will consider now the homogeneous 2nd order linear ODE


in (1) (page 131) with the coecients f (x) and g(x) given by
f(x) =
g(x) =

p(x)
x
q(x)
(x )2

(12)

where p(x) and q(x) are functions which can be represented by


their Taylor series about x = .
In general, the coecients f (x) and g(x) in (12) are not
well defined at x = and Taylor series about x = are not
available to represent them. Thus, the power series method
described above (page 131) cannot be applied directly on (1)
and (12) to obtain a solution in the form of a power series
centered about the constant . An attempt may, however, be
made to apply the power series method on the ODE rewritten
as
(x )2 y 00 + (x )p(x)y 0 + q(x)y = 0

(13)

to obtain a power series solution centered about . Depending on p(x) and q(x), it may just end up giving us the trivial
solution y = 0.
There is a more general approach for solving (13) to obtain
a solution in terms of a series containing powers of (x )
(not necessarily non-negative integer powers). According to
the Frobenius method, we can look for a solution of (13) in the
form of a series given by
y(x) = (x )

n=0

dn (x )n

(14)

where and dn are constants to be determined from (13) as


explained below.

147

We can dierentiate (14) twice as follows3 .


y(x)

n=0

dn (x )n+

X
(n + )dn (x )n+1

y 0 (x) =
y 00 (x) =

(15)

n=0

(n + )(n + 1)dn (x )n+2 .

n=0

Representing p(x) and q(x) by their Taylor series about


x = and substituting (15) into (13), we obtain

X
(n + )(n + 1)dn (x )n+

n=0

X
p(m) () X
+
(n + )dn (x )m+n+
m!
m=0
n=0

X
q (m) () X
+
dn (x )m+n+ = 0
m!
m=0
n=0

which can be rewritten as (if we follow step (v) of the power


series method above, as explained on page 132, that is, if we let
k = m + n in the second and third lines of the equation above)

X
{(k + )(k + 1)dk
k=0

k
X

(n + )dn

n=0

k
X

n=0

dn

p(kn) ()
(k n)!

q (kn) ()
}(x )k+ = 0.
(k n)!

(16)

Bear in mind that is not necessarily 0 here. If = 0 (as in the power


series method) then the summation in the series for y 0 and y 00 in (15) can
be taken to start from n = 1 and n = 2 respectively (instead of 0).

148

To ensure that (16) is satisfied for all x, we set the coecient


of (x )k+ to zero for k = 0, 1, 2, , that is,
(k + )(k + 1)dk

k
X
p(kn) ()
(n + )dn
(k n)!
n=0

k
X

n=0

dn

q (kn) ()
(k n)!

= 0 for k = 0, 1, 2, (17)

In (17), k = 0 yields
[( 1) + p() + q()]d0 = 0.

(18)

To keep open the option of choosing d0 as an arbitrary constant,


we select the constant in such a way that
( 1) + p() + q() = 0.

(19)

With chosen to satisfy (19), we can work out the remaining


coecients d1 , d2 , from (17) with k = 1, 2, , that is,
from
[(k + )(k + 1) + (k + )p() + q()]dk
=

k1
X

n=0

dn
{(n + )p(kn) () + q (kn) ()}
(k n)!
for k = 1, 2, .

(20)

We choose to satisfy (19) so that d0 is not forced to take


any specific value in (18). Nevertheless, whether we can take d0
to be arbitrary or not would depend on the coecient of dk on
the left hand side of (20). To see this, let us write out (20) for
k = 1, that is, after using (19), we obtain
(2 + p())d1 = ( 1)d0 .
Now if it happens that 2 + p() = 0 but ( 1) 6= 0 then
we are forced to take d0 = 0 and to look into the possibility of
taking d1 as an arbitrary constant instead.
149

Note that if the coecient of dk on the left hand side of (20)


is not zero for all k = 1, 2, , then we are free to give d0 any
non-zero value, for example, d0 = 1 (for convenience), in order
to work out a particular solution for the ODE in (13).
Note that (19) is a quadratic equation in . It may have up
to two distinct solutions. Let = 1 and = 2 be solutions
of (19). With determined, the coecients dk can then be
worked out from (20). If the coecients are given by

dk1 if = 1
dk =
dk2 if = 2
then the solutions corresponding to = 1 and = 2 are
respectively y1 (x) and y2 (x) given by
1

y1 (x) = (x )

y2 (x) = (x )2

n=0

X
n=0

dn1 (x )n
dn2 (x )n .

(21)

Now if y1 (x) and y2 (x) in (21) are linearly independent then


according to Theorem 2 in Chapter 3 (page 53) the general
solution of (13) is
y(x) = Ay1 (x) + By2 (x)

(22)

where A and B are arbitrary constants.


If 1 = 2 then it is obvious that y1 (x) and y2 (x) are not
linearly independent. In this case, to construct the general solution of (13), we have to look for another linearly independent
solution.
To examine whether y1 (x) and y2 (x) are linearly independent or not for the case in which 1 6= 2 , let us write either
y2 (x)
=
y1 (x)

n=0

dn2 (x )n+2 1

n=0

dn1 (x )n

150

(23)

or

dn2 (x )n
y2 (x)
n=0
.
=
P
y1 (x)
dn1 (x )n+1 2

(24)

n=0

For the case in which 2 1 or 1 2 is a positive integer,


on the right hand side of (23) or (24), we see that y2 /y1 can be
given by one power series centered about divided by another
power series also centered about . Depending on what the coecients dn1 and dn2 are, the power series in the numerator
may or may not a constant multiple of the one in the denominator. Thus, for the case in which 2 1 = 1, 2, 3, ,
we find that y2 /y1 may or may not be a constant, that is, y1 (x)
and y2 (x) may or may not be linearly independent.
For the case in which 2 1 is not an integer, on the right
hand side of (23), the denominator is a power series centered
about , but the numerator is a series with non-integer powers
(n + 2 1 may be a real number which is not an integer or
it may be a complex number with a non-zero imaginary part).
It follows that y2 /y1 cannot be a constant, hence y1 and y2 are
linearly independent. Thus, if 2 1 is not an integer (that
is, if 2 1 6= 0, 1, 2, 3, ), then the general solution
of (13) is given by (22)
If y1 (x) and y2 (x) as given in (21) are not linearly independent, we have to find another linearly independent solution in
order to construct the general solution of (13). This may be
done by modifying the second solution y2 (x) to be given by
y2 (x) = y1 (x) ln(x ) + (x )min(1 ,2 )

n=0

gn (x )n
(25)

where min(1 , 2 ) = 1 if 1 2 or min(1 , 2 ) = 2 if


2 1 . In (25) above, note that y1 (x) is the same particular solution in (21) (as obtained by using = 1 ) and = 2
is the second solution of (19). We can work out the coecients
151

gn (n = 0, 1, 2, ) by substituting (25) into (13) and equating the coecients of the resulting series to zero. The task of
determining gn (n = 0, 1, 2, ) for (13) in its general form
will not be described here. Instead, it will be illustrated below
through some specific examples.
Examples
1. Use the Frobenius method to find the general solution of
x2 y 00 2xy0 + y = 0.
Comparing the given ODE to (13) (page 147), we find that
= 0, p(x) = 2 and q(x) = 1. Thus, if we take y(x) to be of
the series form
y(x) = x

dn xn

n=0

then according to (19) (page 149) the constant must satisfy


( 1) 2 + 1 = 0.

The above equation gives = 32 + 12 5 and = 32 12 5.


Use of (20) (page 149) with p(x) = 2 and q(x) = 1 gives
k(k + 2 3)dk = 0 for k = 1, 2, 3,

(since p(m) (x) = 0 and q (m) (x) = 0 for m = 1, 2, ).

For both = 32 + 12 5 and = 32 12 5, we find that k(k +


2 3) 6= 0 for k = 1, 2, and hence the above implies that
2, .
dk = 0 for k = 1,
For = 32 + 12 5, we may take d0 = 1 to obtain one particular solution

Similarly, for =
tion

3
2

y1 (x) = x 2 + 2 5 .

12 5, we obtain another particular soluy2 (x) = x 2 2


152

The two particular solutions given above are linearly independent. Hence, the required general solution is given by
3

y(x) = Ax 2 + 2

+ Bx 2 2

where A and B are arbitary constants.


The ODE in this example is a Cauchy-Euler equation. It
is chosen here to show that the Frobenius method may be regarded as a generalization of the solution procedure in Section
3.4 for solving Cauchy-Euler equations.
2. Use the Frobenius method to find the general solution of
2x2 y 00 xy0 + (2x + 1)y = 0.
We look for a series solution of the form
y(x) = x

dn xn .

n=0

Substituting the proposed series solution into the given ODE,


we obtain
2

X
X
(n + )(n + 1)dn xn+
(n + )dn xn+

n=0

n=0

+2

dn xn++1 +

n=0

dn xn+ = 0

n=0

which can be rewritten as


[22 3 + 1]d0 x

X
+
{2(k + )(k + 1)dk (k + )dk
k=1

+2dk1 + dk }xk+ = 0.

To ensure that the ODE is satisfied, we choose such that


22 3 + 1 = 0
153

and the coecients in the series solution such that


k[2k + 4 3]dk = 2dk1 for k = 1, 2, .
Solving the quadratic equations in , we obtain = 1/2 and
= 1. For = 1/2 and = 1, we find that k[2k + 4 3] 6= 0
for k = 1, 2, 3, , hence we may take d0 = 1 to work out
particular solutions of the ODE.
For = 1/2, taking d0 = 1, we find that
d1 = 2
2d1
22
=
d2 =
23
23
2d2
23
d3 =
=
35
(3 2) (5 3)
..
.
(1)k 2k
.
dk =
k!(2k 1)(2k 3) 5 3
It follows that a particular solution of the ODE is
1/2

y(x) = x

(1 +

X
k=1

(1)k 2k xk
).
k!(2k 1)(2k 3) 5 3

For = 1, also taking d0 = 1, we find that


2
13
2d1
22
=
=
25
(2 1) (5 3)
..
.
(1)k 2k
=
.
k!(2k + 1)(2k 1) 5 3

d1 =
d2

dk

Thus, another particular solution of the ODE is


y(x) = x(1 +

X
k=1

(1)k 2k xk
).
k!(2k + 1)(2k 1) 5 3
154

The first particular solution is not a constant multiple of


the second one. The two particular solutions given above are
linearly independent. Hence, the required general solution is
given by
1/2

y(x) = Ax

(1 +

X
k=1

+Bx(1 +

X
k=1

(1)k 2k xk
)
k!(2k 1)(2k 3) 5 3

(1)k 2k xk
)
k!(2k + 1)(2k 1) 5 3

where A and B are arbitary constants. (Note that the series in


the general solution can be shown to converge for all x.)
3. Use the Frobenius method to find two linearly independent
solutions of
y00 +

x3 0
1
y = 0.
y +
x2
(x 2)2

Rewrite the ODE as


(x 2)2 y 00 + (x 2)(x 2 1)y 0 + y = 0
and propose a series solution of the form
y(x) = (x 2)

n=0

dn (x 2)n .

Substitute the proposed series solution into the rewritten


ODE, we find that

X
(n + )(n + 1)dn (x 2)n+

n=0

= 0

(n + )dn (x 2)n++1

n=0

n+

(n + )dn (x 2)

n=0

155

n=0

dn (x 2)n+

which may be rewritten as


[( 1) + 1]d0 (x 2)

X
+
{(n + )(n + 1)dn
n=1

+(n 1 + )dn1 (n + )dn + dn }(x 2)n+

= 0.

We choose such that


( 1) + 1 = 0

( 1)2 = 0 = 1.
With = 1, the constants d1 , d2 , can be determined
from
[(n + 1)n (n + 1) + 1]dn = ndn1 for n = 1, 2, .
Taking d0 = 1, we find that
d1 = 1
2d2 = d1 d2 =

1
2

3d3 = d2 d3 =

dn

1
32

..
.
(1)n
=
for n = 0, 1, 2, .
n!

From the above analysis, we manage to obtain one particular solution, that is,
y1 (x) =

X
(1)n (x 2)n+1

n!

n=0

For another particular solution y2 (x) such that y1 (x) and


y2 (x) are linearly independent, let
y2 (x) = y1 (x) ln(x 2) + (x 2)
156

n=0

gn (x 2)n

which gives
y20 = y10 (x) ln(x 2) +
y200 = y100 (x) ln(x 2) +
+

n=1

y1 (x) X
+
gn (n + 1)(x 2)n
x2
n=0

2y10 (x)
x2

y1 (x)
(x 2)2

gn (n + 1)n(x 2)n1 .

Substituting y2 (x) into the ODE and making use of (x


+ (x 2)(x 2 1)y10 + y1 = 0 (since y1 is a particular
solution), we obtain

2)2 y100

X
(1)n (n + 1)(x 2)n+1

n=0

= 0

n=1

X
n=0

X
n=0

n!

gn (n + 1)n(x 2)n+1 +
gn (n + 1)(x 2)n+2
gn (n + 1)(x 2)n+1 +

X
(1)n (x 2)n+1

n!

n=0

(1)n (x 2)n+2
n!
n=0

X
(1)n (x 2)n+1

n=0

X
n=0

n!

gn (x 2)n+1

which can be tidied up to give

X
(1)n
+ n2 gn + ngn1 }(x 2)n+1 = 0.
{
(n 1)!

n=1

It follows that
ngn =

(1)n
gn1 for n = 1, 2, .
n!

There is no restriction on the coecient g0 here. Taking

157

g0 = 0, we find that the equation above gives


g1 = 1 g0 = 1
1
3
2g2 = g1 g2 =
2
4
1
11
3g3 =
g2 g3 =
3!
36
1
25
4g4 = g3 g4 =
4!
288
1
137
g4 g5 =
5g5 =
5!
7200
1
49
6g6 = g5 g6 =
6!
14 400
..
.
It appears dicult here to deduce a general formula for gn by
just looking at the first few coecients above.
To summarize, two linearly independent solutions of the
ODE are

X
(1)n (x 2)n+1
y1 (x) =
n!
n=0
y2 (x) = ln(x 2)

X
(1)n (x 2)n+1

n!
n=0

3
11
+(x 2) (x 2) (x 2)2 + (x 2)3
4
36
25
137

(x 2)4 +
(x 2)5
288
7200
49
(x 2)6 + .

14 400

4. Use the Frobenius method to solve 4x2 y00 + 4xy0 (1 +


x)y = 0.
Take y(x) to be of the series form
y(x) = x

n=0

158

dn xn .

Substitute the proposed series solution into the ODE to


obtain

X
X
(n + )(n + 1)dn xn+ + 4
(n + )dn xn+
4
n=0

= 0

n=0

n=0

dn xn+

dn xn++1

n=0

which can be rearranged to give


(42 1)d0 x +

X
{[4n2 + 8n + 42 1]dn dn1 }xn+ = 0.

n=1

The ODE is satsified if we choose = 1/2 and


4n(n + 2)dn = dn1 for n = 1, 2, .
The dierence between the two values of is an integer.
There is a possibility that we cannot obtain two linearly independent solutions of the series form proposed above by using
the two dierent values of .
For = 1/2, we find that

1
n(n 1)dn = dn1 for n = 1, 2, .
4
If we let n = 1, we find that d0 = 0. Thus, d0 cannot be
arbitrary. Noticing that 4n(n 1) 6= 0 for n = 2, 3, , we
may regard d1 as an arbitrary constant. Let us take d1 = 1. It
follows that
1
1
2d2 =
d2 =
4
42
1
1
3 2d3 =
d2 d3 = 2
4
4 322
1
1
4 3d4 =
d3 d4 = 3
4
4 43322
..
.
1
for k = 1, 2, .
dk =
k1
4 k[(k 1)!]2
159

Thus, a particular solution is given by


y1 (x) =

X
k=1

1
4k1 k[(k

1)!]2

xk1/2

1
1 5/2
1 7/2
= x1/2 + x3/2 +
x +
x +
8
192
9216
Now for = 1/2, we find that
1
n(n + 1)dn = dn1 for n = 1, 2, .
4
If we take d0 = 1, we obtain
d1 =

1
322
1
=
3
4 43322
..
.
1
=
for k = 0, 1, 2, .
k
4 (k + 1)[k!]2

d2 =
d3

dk

1
42
42

It is easy to see that the above leads to the same particular


solution which we have derived earlier on. If we select d0 to
be a non-zero value other than 1, we will find that we obtain
a particular solution which is a constant multiple of the earlier
one. Thus, for this example, the particular solutions from =
1/2 and = 1/2 are not linearly independent.
Following (25) (page 151), we look for a second particular
solution by letting
1/2

y2 (x) = y1 (x) ln(x) + x

gn xn .

n=0

Substituting the proposed solution into the ODE, we obtain

X
{
k=1

8(k 1/2)
+ 4k(k 1)gk gk1 }xk1/2 = 0.
4k1 k[(k 1)!]2
160

To ensure the ODE is satisfied, we take


4k(k 1)gk =

8(k 1/2)
+ gk1 for k = 1, 2, .
1)!]2

4k1 k[(k

For k = 1, the above gives g0 = 4. The constant g1 can


be aribtrary (as there is restriction on it). If we take g1 = 0,
subsequent values of k give
3
3
8g2 = + g1 g2 =
2
16
5
7
24g3 = + g2 g3 =
48
576
7
35
48g4 =
+ g3 g4 =
2304
110 592
..
.
Thus, the general solution of the ODE is
y(x) = A

X
k=1

"

1
4k1 k[(k

+B ln(x)

X
k=1

1)!]2

xk1/2

1
xk1/2 + 4x1/2
4k1 k[(k 1)!]2

3
7 5/2
35
x3/2
x
x7/2
16
576
110 592

where A and B are arbitrary constants.

5.6

Exercise IX
For each of the following ODEs, use the Frobenius method
to find two linearly independent solutions.

1. 6x2 y 00 x(1 + x2 )y 0 3y = 0
2. 4y 00 + 19(x 1)1 y0 (5 x)(x 1)2 y = 0
3. x2 y 00 + xy0 + (x2 9)y = 0
161

4. 9x2 y 00 + 15xy 0 + (x + 1)y = 0


5. 16x2 y00 + 8xy 0 (x + 3)y = 0
6. 16x2 y00 + x(8 x)y 0 3y = 0

5.7

Solutions to Exercise VIII

1. Let the series solution be given by


y(x) =

cn xn

n=0

and hence
y0 =
y 00 =

X
(n + 1)cn+1 xn

n=0

(n + 2)(n + 1)cn+2 xn .

n=0

(a) Substituting the series solution into the given ODE


y 00 25y = 0 gives

X
{(n + 2)(n + 1)cn+2 25cn }xn = 0.

n=0

It follows that

(n + 2)(n + 1)cn+2 = 25cn for n = 0, 1, 2, .


We find that
52
c0 (if we let n = 0)
2!
52
=
c1 (if we let n = 1)
3!
52
54
=
c2 = c0 (if we let n = 2)
43
4!
52
54
=
c3 = c1 (if we let n = 3)
54
5!
..
.

c2 =
c3
c4
c5

162

We deduce that
c2k =

52k
52k
c0 and c2k+1 =
c1
(2k)!
(2k + 1)!
for k = 0, 1, 2, .

Thus, the required series solution is

X
X
52k 2k
52k
x + c1
x2k+1
y = c0
(2k)!
(2k + 1)!
k=0

k=0

where c0 and c1 are arbitrary constants. Since the coecients of the ODE are constant functions, their Taylor series about x = 0 should converge for all values of x. Thus,
the above series solution converges for < x < .
(b) From the conditions y(0) = 2 and y 0 (0) = 5, we find
that y(0) = c0 = 2 and y 0 (0) = c1 = 5. If we substitute
the series solution into the given ODE, we obtain
(n + 2)(n + 1)cn+2 = 5(n + 1)cn+1 + 6cn
for n = 0, 1, 2, .

It follows that
52 + 6 2
1 + 62
=
2!
2!
2
5(1 + 6 ) 6(5)
1 63
=
=
3!
3!
3
2
5(1 6 ) + 6(1 + 6 )
1 + 64
=
=
4!
4!
..
.
1 + (1)n 6n
=
for n = 0, 1, 2, .
n!

c2 =
c3
c4

cn

Thus, the required solution is


y=

X
1 + (1)n 6n

n=0

163

n!

xn .

The above series solution converges for < x < (as


the coecients of y 0 and y in the ODE have Taylor series
about x = 0 which converge for < x < ).
(c) Rewrite ODE as
(x 1)2 y 00 + 5(x 1)y 0 + 3y = 0

(x2 2x + 1)y 00 + 5(x 1)y 0 + 3y = 0

Substitute the series solution into the ODE to obtain


(x2 2x + 1)
+5(x 1)

(n + 2)(n + 1)cn+2 xn

n=0
n

(n + 1)cn+1 x + 3

n=0

cn xn = 0

n=0

which can be rewritten as


3c0 5c1 + 2c2 + (3c1 10c2 + 5c1 + 6c3 4c2 )x

X
{3cn 5(n + 1)cn+1 + 5ncn
+
n=2

+(n + 2)(n + 1)cn+2

= 0.

2(n + 1)ncn+1 + n(n 1)cn }xn

From given conditions, y(0) = c0 = 0 and y 0 (0) = c1 = 2.


Thus,
3c0 5c1 + 2c2 = 0 c2 = 5

3c1 10c2 + 5c1 + 6c3 4c2 = 0 c3 = 9


and
(n + 2)(n + 1)cn+2 = (5 + 2n)(n + 1)cn+1
3cn 5ncn n(n 1)cn

for n = 2, 3, .
164

It follows that c4 = 14, c5 = 20, c6 = 27, c7 = 35 and so


on. We observe that
cn = cn1 + 1 + n for n = 1, 2, 3, .
Hence
cn = cn1 + 1 + n
= cn2 + 1 + (n 1) + 1 + n
= cn2 + 1 + n + n

= cn3 + 1 + (n 2) + 1 + n + n

= cn3 + 1 + (n 1) + n + n

= cn4 + 1 + (n 3) + 1 + (n 1) + n + n

= cn4 + 1 + (n 2) + (n 1) + n + n
..
.
= c0 + 1 + 2 + 3 + + n + n
1
=
n(n + 1) + n.
2
The required series solution is

X
1
y=
( n(n + 1) + n)xn .
2
n=1

The series solution converges for 1 < x < 1.


2. Let the series solution be given by
y(x) =

cn xn .

n=0

(a) From the given conditions, c0 = 1 and c1 = 0. Proceeding as explained on page 133, we find that
2 1c2
3 2c3

c4

=
=

c0 sin(0) = 0

c0 cos(0) c1 sin(0) = 1
1
c3 =
3!
1
1
= 0, c5 =
and c6 =
.
5!
180
165

Thus,
1
1 5
1 6
y(x) ' 1 x3 +
x +
x .
6
120
180
(b) Here c0 = c1 = 0 and
(n + 2)(n + 1)cn+2 = 4(n + 1)cn+1 13cn for n = 0, 1, 2, .
Form the above, we can work out c2 = 9/2 and c3 =
49/6. Thus,
9
49
y(x) ' 1 + x x2 x3 .
2
6
(c) Here c0 = 0 and c1 = 1. Proceeding as explained on
page 133, we find that
2 1c2

3 2c3

c4

=
=

(sin(0) + 0 cos(0)) = 0

(1 2 cos(0) + cos(0)) = 3
1
c3 =
2!
41
923
= 0, c5 = , c7 =
.
5!
7!

Thus,
y(x) ' x

1 3 41 5 923 7
x + x
x .
2!
5!
7!

3. Let the series solution be given by


y(x) =

cn xn .

n=0

Here c0 = 2 and c1 = 0. Substituting the series solution


into the given ODE gives
2c2 + 42c0 = 0 c2 = 42

2c1 + 6c3 + 42c1 = 0 c3 = 0

(p + 2)(p + 1)cp+2 = (p 6)(p + 7)cp

for p = 2, 3, .

166

It follows that
4 3c4 = (4) 9c2 c4 = 126
462
c5 = 0, c6 =
,
5
c7 = 0, c8 = 0
..
.
cn = 0 for n = 9, 10, 11, .
Thus, the required exact solution is
y(x) = 2 42x2 + 126x4

462 6
x .
5

4. Let the series solution be given by


y(x) =

cn xn .

n=0

Here c0 = 0 and c1 = 2. Substituting the series solution


into the given ODE gives
2c2 + 56c0 = 0 c2 = 0

6c3 + 54c1 = 0 c3 = 18

(p + 2)(p + 1)cp+2 = (p 7)(p + 8)cp

for p = 2, 3, .

It folllows that c4 = c6 = c8 = 0, c5 = 198/5, c7 =


858/35, c9 = 0 and cn = 0 for n 10. Thus, the required exact solution is
y(x) = 2x 18x3 +

5.8

198 5 858 7
x
x .
5
35

Solutions to Exercise IX

1. Let the series solution be given by


y=

n=0

167

dn xn+ .

Substituting the series solution into the given ODE gives


(62 7 3)d0 = 0

(62 + 5 4)d1 = 0

k(6k + 12 7)dk = (k 2 + )dk2

for k = 2, 3, .

To allow for the possibility that d0 is an arbitrary number,


we choose such that
3
1
62 7 3 = 0 = , = .
2
3
Since 62 + 5 4 6= 0 for the above values of , we
have to take d1 = 0. Also, since k(6k + 12 7) 6= 0 for
k = 2, 3, , we can take d0 to be arbitrary and we find
that d3 = d5 = d7 = ... = 0 (since d1 = 0). Let us take
d0 = 1 to obtain a particular solution corresponding to
each of the two values of . The two particular solutions
corresponding to = 3/2 and = 1/3 are linearly
independent since the dierence between 3/2 and 1/3
is not an integer. For = 3/2, we obtain
d2 =

3
3
11
, d4 =
, d6 =
,
92
3680
691840

while for = 1/3, we find that


1
5
11
, d6 =
, .
d2 = , d4 =
6
936
84240
The required series solution is
3 2
3 4
11
x +
x +
x6 + )
92
3680
691840
1
5 4
11 6
+Bx1/3 (1 x2
x +
x + ).
6
936
84240

y(x) = Ax3/2 (1 +

2. Rewrite the ODE as


4(x 1)2 y 00 + 19(x 1)y0 (4 (x 1))y = 0.
168

Let the series solution be given by


y=

n=0

dn (x 1)n+ .

Substituting the series solution into the ODE gives


(42 + 15 4)d0 = 0

n(4n + 8 + 15)dn = dn1 for n = 1, 2, .


To allow for the possibility of having an arbitrary d0 , we
choose to satisfy 42 + 15 4 = 0. This gives = 1/4
and = 4. Check that n(4n + 8 + 15) 6= 0 for these
values of and for n = 1, 2, , that is, so that we can
take d0 is arbitrary. Let us take d0 = 1. For = 1/4, we
obtain
d1 =

1
1
1
, d2 =
, d3 =
21
1050
91350

and for = 4, we find that


d1 =

1
1
1
, d2 =
, d3 =
.
13
234
3510

Thus, the required general solution is


1 2
1
1
x+
x
x3 + )
21
1050
91350
1
1 3
1 2
+Bx4 (1 + x +
x +
x + ).
13
234
3510

y(x) = Ax1/4 (1

3. Let the series solution be given by


y=

dn xn+ .

n=0

Substituting the series solution into the given ODE gives


(2 9)d0 = 0
d1 = 0

n(n + 2)dn = dn2 for n = 2, 3, .


169

To allow for the possibility that d0 is arbitrary, we take


2 9 = 0, that is, = 3 or = 3. However, for
= 3, we see that n(n + 2) is zero when n = 6. Thus,
for = 3, letting n = 6 in n(n + 2)dn = dn2 ,
we obtain d4 = 0 which in turn leads to d2 = 0 and
d0 = 0. From d1 = 0 and n = 3, 5, 7, , we deduce
that d3 = d5 = d7 = = 0. From n = 8, we find that
8 2d8 = d6 . Also, 10 4d10 = d8 , 12 6d12 = d10 and
so on. We can take either one of d6 , d8 , d10 , to be
arbitrary here. Taking d6 = 1 (here we choose d6 to be
any real number except 0-can you see the reason for not
choosing g6 = 0?), we find that = 3 gives
1
1
1
, d10 =
and d12 =
.
16
640
46080
Thus, a particular series solution corresponding to =
3 is given by
d8 =

1 8
1 10
1
x +
x
x12 + )
16
640
46080
1
1 7
1
= x3 x5 +
x
x9 +
16
640
46080
If we attempt to find another particular solution by using
= 3, we find that it is a merely a multiple of y1 above,
that we cannot obtain two linearly independent solutions
from = 3 and = 3. To seek another particular solution y2 which is linearly independent of y1 , let
y1 (x) = x3 (x6

y2 = y1 ln(x) +

gn xn3 .

n=0

Substituting the above into the ODE gives


5 4
7 6
9
x +
x
x8 + )
16
640
46080

X
2
{n(n 6)gn + gn2 }xn3 = 0.
5g1 x +
2x(3x2

n=2

Note that the coecient of gn in n(n 6)gn + gn2 is 0


when n = 6. As we will see, this forces g0 , g2 and g4 to
170

have definite values (that is, we cannot assign an arbitrary


value to any one of these three coecients). Setting the
coecient of x2 to 0, we obtain g1 = 0. Setting the
coecients of x1 , x0 , x1 , x2 , x3 , x4 and so on to 0, we
obtain
8g2 + g0

g3

8g4 g2

6 + g4

0 g5 = 0

5g5 g3

7g7 g5

0 g4 = 6

g2 = 48 g0 = 384
=

16g8 + g6

27g9 + g7

40g10 + g8

0 g7 = 0
5
8
0 g9 = 0
7

320
..
.

It appears that we can choose one of the coecients from


g6 , g8 , g10 , to be an arbitrary constant. If we choose
g6 = 0 (we can choose g6 = 0 because here it does not
lead to a trivial solution for y2 ) then g8 = 5/128 and
g10 = 39/25600. The solution y2 is thus given by
1 5
1 7
1
x +
x
x9 + ) ln(x)
16
640
46080
+x3 (348 48x2 6x4
5 8
39 10
+
x
x + ).
128
25600

y2 = (x3

171

The required general solution is


1 5
1 7
1
x +
x
x9 + )
16
640
46080
1
1 7
1
+B[(x3 x5 +
x
x9 + ) ln(x)
16
640
46080
+x3 (348 48x2 6x4
5 8
39 10
+
x
x + )].
128
25600

y = A(x3

(Note that in the above we choose g6 = 0 to work out the


particular solution y2 . Now if we give g6 a dierent value
or if we choose to assign a value to either g8 or g10 (instead
of g6 ), we will obtain a dierent particular solution from
y2 given above, but we should be able to recover that
particular solution by selecting appropriate values of A
and B in the general solution above. For example, if we
choose g8 = 0, we obtain g6 = 5/8 and g10 = 7/12 800 ,
that is, we obtain the particular solution
1 5
1 7
1
x +
x
x9 + ) ln(x)
16
640
46080
+x3 (348 48x2 6x4
5
7
+ x6
x10 + ).
8
12800

y2 = (x3

We can easily check that the particular solution above can


be recovered from the general solution by letting A = 5/8
and B = 1.)
4. Let the series solution be given by
y=

dn xn+ .

n=0

Substituting the series solution into the given ODE gives


(3 + 1)2 d0 = 0
(9[n ][n 1] + 15[n ] + 1)dn = dn1

for n = 1, 2, 3, .

172

From the above, we obtain only one value for , that is,
= 1/3. We find that the coecient (9[n ][n
1] + 15[n ] + 1) is not 0 for = 1/3 and n = 1, 2,
. Thus, we can assign a non-zero arbitrary value to d0 .
Taking = 1/3 and d0 = 1, we find that
1
d1 = 2
3
1
d2 =
2
(3 )2 22
1
d3 = 2 3
(3 ) (3 2)(3 2)
1
d4 =
2
4
(3 ) (4 3 2)(4 3 2)
..
.
(1)n
dn =
for n = 0, 1, 2,
32n (n!)2
A particular solution of the ODE is

X
(1)n n1/3
y1 (x) =
x
.
32n (n!)2
n=0
To find another particular solution, let

X
X
(1)n n1/3
1/3
x
+x
gn xn .
y2 (x) = ln(x)
2n (n!)2
3
n=0
n=0

If we substitute the above into the ODE and equate the


coecients of x1/3 , x2/3 , x5/3 and so on to 0, we obtain
g0 = 0, g1 = 2/9, g2 = 1/108 and so on. Thus, the
required general solution is

X
(1)n n1/3
y(x) = A
x
32n (n!)2
n=0
+B{ln(x)

X
(1)n n1/3
x
32n (n!)2
n=0

2
1 2
+x1/3 ( x
x + )}.
9
108
173

5. Let the series solution be given by


y=

dn xn+ .

n=0

Substituting the series solution into the given ODE gives


(162 8 3)d0 = 0

8n(2n + 4n 1)dn = dn1

for n = 1, 2, 3, .

We obtain = 3/4 and = 1/4. From = 3/4, we


obtain one particular solution given by
y1 (x) = x3/4 (1 +

1
1
1 2
x+
x +
x3 + ).
32
3072
589 824

The two dierent values of give linearly dependent solutions. To obtain another particular solution which is not
a multiple of y1 , let
y2 (x) = y1 ln(x) + x1/4

gn xn .

n=0

Proceeding as before, we obtain g0 = 16, g1 = 0, g2 =


3/64, g3 = 7/9216 and so on. Thus, the required
general solution is
1
1
1 2
x+
x +
x3 + )
32
3072
589 824
1 2
1
x
+B{x3/4 (1 + x +
32
3072
1
+
x3 + ) ln(x)
589 824
3
7 3
+x1/4 (16 x2
x + )}.
64
9216

y(x) = Ax3/4 (1 +

6. Let the series solution be given by


y=

n=0

dn (x 1)n+ .

174

Substituting the series solution into the ODE gives


(162 8 3)d0 = 0

8n(2n + 4 1)dn = (n + 1)dn1 for n = 1, 2, .

Setting 162 8 3 = 0, we obtain = 3/4 and =


1/4. For = 3/4, we find that 8n(2n + 2)dn = (n
1/4)dn1 for n = 1, 2, . Since 8n(2n + 2) 6= 0 for
n = 1, 2, , we can choose d0 = 1 when working out
d1 , d2 and so on for = 3/4. For = 3/4, we obtain
d1 = 3/128, d2 = 7/16 384, d3 = 77/12 582 912 and so on.
Thus, we obtain the particular solution
3
77
7
y1 (x) = x3/4 (1 +
x+
x2 +
x3
128
16 384
12 582 912
77
+
x4 + ).
1073 741 824
If we attempt to find another particular solution using
= 1/4, we obtain a solution which is a multiple of y1
above. To find another particular solution which is not a
multiple of y1 above, we let
1/4

y2 (x) = y1 ln(x) + x

gn xn .

n=0

Proceeding as before, we obtain g0 = 64, g1 = 4,


g2 = 25/256, g3 = 31/16 384 and so on. Thus, the
required general solution is
3
77
7
y1 (x) = Ax3/4 (1 +
x+
x2 +
x3
128
16 384
12 582 912
77
+
x4 + )
1073 741 824
3
77
7
x+
x2 +
x3
+B{x3/4 (1 +
128
16 384
12 582 912
77
+
x4 + ) ln(x)
1073 741 824
1
25
64x1/4 (1 + x +
x2
16
16 384
31
x3 + )}.
+
1048 576
175

Chapter 6

Numerical methods
6.1

Preamble

Analytical methods of solution such as those given in Chapters


2 and 3 are not available for many ODEs. If an ODE cannot be
solved exactly, one may resort to numerical methods for finding
approximately the required solution. In this chapter, we look
at the Eulers method for solving numerically 1st order ODEs
and show how it can be extended to solve 2nd order ODEs
subject to certain prescribed conditions. The Eulers method
is definitely not the best numerical method for solving ODEs.
It is examined here merely for instructional purposes to give a
flavor of what is involved in the numerical solution of an ODE.
A somewhat better (more accurate) numerical method is the
second order Runge-Kutta method described in Problems 5 and
6 in Exercise X (page 193).

6.2

Eulers method for 1st order ODEs

We consider now solving the 1st order ODE in y(x) given by


dy
= F (x, y)
dx
subject to the condition y(a) = c. Here F (x, y) is a given function of x and y and a and c are constants.
176

Let us assume that we are interested in finding y(x) for


a x b. To find y(x) approximately, we divide the interval
a x b into N smaller subintervals given by x0 x x1 ,
x1 x x2 , , xk1 x xk , , xN2 x xN1 and
xN1 x xN , where a = x0 < x1 < < xN1 < xN = b.
Let the value of y at the point x = xk be denoted by yk for
k = 0, 1, 2, , N. From the condition given by the problem,
that is, y(a) = c, we know that y0 = c. The values of y1 ,
y2 , , yk , , yN1 and yN are, however, not known. A simple
approximate technique for finding y1 , y2 , , yk , , yN1 and
yN is the Eulers method.
To derive the Eulers method, we use the Taylor series1 of
y(x) about x = xk1 , that is,
y(x) = y(xk1 ) + y0 (xk1 )[x xk1 ]
1
+ y 00 (xk1 )[x xk1 ]2
2
1
+ y 000 (xk1 )[x xk1 ]3 + .
6
For x very near xk1 , y(x) may be reasonably approximated
using only the first two terms of the series, that is,
y(x) ' y(xk1 ) + y 0 (xk1 )[x xk1 ]
for xk1 x xk .

If we bear in mind that y 0 (x) = F (x, y) (from the given


ODE) and y(xk1 ) = yk1 , we can write
y(x) ' yk1 + [x xk1 ]F (xk1 , yk1 )
for xk1 x xk .

Thus, if yk1 is known, we may calculate y(x) approximately


for xk1 x xk using the formula above.
If we let x = xk in the formula above, we obtain
yk ' yk1 + [xk xk1 ]F (xk1 , yk1 ).
1

Refer to Section 5.2 in Chapter 5 for some details on Taylor series.

177

The above formula gives the Eulers method for calculating


approximate numerical values of y1 , y2 , , yk , , yN1 and
yN .
If we let k = 1, we obtain
y1 ' y0 + [x1 x0 ]F (x0 , y0 ).
Since y0 , x0 and x1 are known, we may calculate y1 using the
approximation above. With y1 now known, we may let k = 2
and compute y2 using
y2 ' y1 + [x2 x1 ]F (x1 , y1 )
and subsequently
y3 ' y2 + [x3 x2 ]F (x2 , y2 )

y4 ' y3 + [x4 x3 ]F (x3 , y3 )


..
.
yN

' yN1 + [xN xN1 ]F (xN1 , yN1 ).

All the above calculations may be done by hand, that is, on


a piece of paper with the help of a hand calculator, if N is not
very large. For large N, hand calculations become extremely
tedious. In this case, we may write a computer program (using,
for example, Fortran 77, Pascal or C++) to execute the large
number of calculations. Alternatively, it may also be possible
to implement the calculations on an electronic spreadsheet (for
example, Microsoft Excel), as explained in the example below.
To summarize, once the numerical values of y1 , y2 , ,
yk , , yN1 and yN are obtained from the Eulers method,
that is, from
yk ' yk1 + [xk xk1 ]F (xk1 , yk1 ),
we can calculate y(x) approximately for all x in the interval
a x b by using
y(x) ' yk1 + [x xk1 ]F (xk1 , yk1 )
for xk1 x xk .

178

As shown graphically in Figure 6.1, the Eulers method approximates the actual solution curve using a set of straight
lines over the subintervals x0 x x1 , x1 x x2 , ,
xk1 x xk , , xN2 x xN 1 and xN 1 x xN .
The straight line over the subinterval xk1 x xk passes
through the point (xk1 , yk1 ) and its gradient is given by
F (xk1 , yk1 ) (from the ODE y 0 = F (x, y)). Note that the
straight line over the subinterval xk1 x xk is parallel
to the tangent to the solution curve at x = xk1 .

Figure 6.1

Example
Use the Eulers method to solve numerically the ODE
y 0 (x) = 2xy subject to y(0) = 1 over the interval 0
x 1, in order to find an approximate value for y(1).
Note that this ODE can be solved exactly. It is a 1st order
2
separable ODE. The exact solution is y = ex . There is really
no need to use the Eulers method to solve this problem numerically. Nevertheless, for the purpose of illustration, we will
179

use the Eulers method here to solve the ODE and examine the
accuracy of the numerical results obtained through comparison
2
with the exact solution y = ex .
We divide up the interval 0 x 1 into N smaller subintervals of equal size h = (10)/N = 1/N. Thus, x0 = 0, x1 = h,
x2 = 2h, , xk = kh, , xN1 = (N 1)h and xN = N h =
1. In this case, xk xk1 = h for all k = 1, 2, , N. The required approximate value for y(1) is given by yN . The Eulers
method is then given by the formula
yk ' yk1 + 2 h xk1 yk1

= yk1 + 2 h 2 (k 1) yk1
for k = 1, 2, , N.

If N is not very large, we may carry out the calculations


in the formula by hand. For large N, we may write a simple
computer program to carry out the calculations in the formula.
The pseudocode for the calculations is as given below.
read N {input a positive integer N }
h=1.00/N {calculate h}
ykm1=1.00 {value of y(0)}
do k=1 to N {set current value of k}
yk=ykm1+2*h*h*(k-1)*ykm1 {calculate yk at current k}
ykm1=yk {give yk1 the value of yk at current k}
enddo {end of loop}
print yk {print out approximate value of y(1)}
Alternatively, we may carry out the calculations on an electronic spreadsheet. A typical spreadsheet comprises cells like
Table 6.1.
We will use only columns A to E to carry out the calculations required by the Eulers method. We define them as
follows.
Column A:= input N
Column B:= value of h = 1/N
180

Column C:= current value of the integer k


Column D:= value of yk1 for k given in column C
Coulmn E:= value of yk for k given in column C

Table 6.1
A

1
2
3
4
We set up the spreadsheet as outlined in the steps below.
1. In row 1 of column A (that is, in the cell A1), we enter
the positive integer N (the number of subintervals) (for
example, 10).
2. In the cell B1, we insert the formula =1.0/A1.
3. In C1, we set the initial value of k to 1.
4. In D1, we enter the value 1 for the condition y(0) = 1.
5. In E1, we insert the formula for the Eulers method, that
is,
=D1+2.0*B1*B1*(C11.0)*D1.
6. In A2, we insert the formula =A1, since the value of N
does not change throughout the calculations.
7. In B2, we insert the formula =B1.
8. In C2, we insert the formula =C1+1, since k increases by
1 in the next step of the calculations.
9. In D2, we insert the formula =E1.
181

10. Copy and paste the formula in E1 into E2. If this is


correctly done, the formula in E2 should be
=D2+2.0*B2*B2*(C21.0)*D2.
All the columns A to E now contain programmed formulae
in them. We are ready to perform the rest of the calculations. If we are doing the calculations with N = 10, we need
to command the sheet to repeat the calculations according to
the programmed formulae from rows 3 to 10. The approximate
numerical value of y(1), that is, y10 , is given in cell E10. In
Table 6.2, we show the results of the calculations for N = 10.
For N = 10, we find that the approximate numerical value of
y(1) is 2.3346. How does this compare with the exact value?
2
Recall that the exact solution is y = ex . Thus, the exact value
is y(1) = e = 2.7183 (accurate to 5 significant figures). The
percentage error in our approximation is about 14%. Here the
percentage error is calculated according to the formula
|

exact value of y(1) numerical value of y(1)


| 100%.
exact value of y(1)

Table 6.2

1
2
3
4
5
6
7
8
9
10
Guide

A
10
10
10
10
10
10
10
10
10
10
N

B
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
h

C
1
2
3
4
5
6
7
8
9
10
k
182

D
1
1
1.02
1.0608
1.1244
1.2144
1.3358
1.4961
1.7056
1.9785
yk1

E
1
1.02
1.0608
1.1244
1.2144
1.3358
1.4961
1.7056
1.9785
2.3346
yk

Table 6.3
N
10
50
100
500

Approximate y(1)
2.3346
2.6309
2.6738
2.7093

% Error
14
3.2
1.6
0.3

We can use the same spreadsheet to carry out calculations


for dierent values of N. We only need to change the value of A1
in the sheet. All other required calculations will then be carried
out automatically. We repeat the calculations for N = 50, 100
and 500. The results for the approximate numerical values of
y(1) together with the percentage errors of the calculations are
shown in Table 6.3. From Table 6.3, it is obvious that the
accuracy of Eulers method improves if a larger value of N is
used. For N = 500, the error in our approximation of y(1) is
well under 1%.

6.3

Second order ODEs

Consider now solving the 2nd order ODE


d2 y
= F (x, y, y 0 )
dx2
subject to y(a) = c and y0 (a) = d. Here F (x, y, y 0 ) denotes a
mathematical expression containing x, y and y 0 , and a, c and
d are given constants.
As in the Eulers method, to solve the ODE for x within the
interval a x b, we divide the interval up into N subintervals
given by x0 x x1 , x1 x x2 , , xk1 x xk , ,
xN2 x xN1 and xN 1 x xN , with x0 = a and
xN = b.
Also, as before, let the value of y at x = xk be yk . The value
of y 0 at x = xk is denoted by yk0 . From y(a) = c and y 0 (a) = d,
183

we know that y0 = c and y00 = d. We are interested in finding


approximate numerical values of y1 , y2 , , yk , , yN1 and
yN .
Recall the approximation
y(x) ' y(xk1 ) + y0 (xk1 )[x xk1 ]
for xk1 x xk .

In the above approximation, if we replace y and y 0 in the


approximation by y0 and y 00 respectively, we obtain
y0 (x) ' y0 (xk1 ) + y 00 (xk1 )[x xk1 ]
for xk1 x xk .

If we let x = xk in both approximate formulae above and


use the given ODE y 00 (x) = F (x, y(x), y 0 (x)), we obtain
0
yk ' yk1 + (xk xk1 ) yk1

0
0
yk0 ' yk1
+ (xk xk1 ) F (xk1 , yk1 , yk1
).

Numerical values of y1 , y2 , , yk , , yN 1 and yN can be


computed from the two formulae as follows. If we let k = 1,
the first formula give y1 ' y0 + (x1 x0 ) y00 . Since y0 and y00 are
known, we may calculate y1 . For k = 1, we may also calculate
y10 from the second formula. If we let k = 2, the first formula
gives y2 ' y1 + (x2 x1 ) y10 which can be calculated as y1 and
y10 are known from the earlier calculation for k = 1. Similarly,
after calculating y20 using the second formula with k = 2, we let
k = 3 to work out y3 and y30 , and so on.
As in the case of the Eulers method, we can write a computer program or use an electronic spreadsheet to execute the
calculations described above.
Example
Use the numerical method described above to solve the
ODE y 00 = y 2y 0 + 12 x subject to y(0) = 0 and y0 (0) =
1, over the interval 0 x 1, in order to compute y(1)
approximately. Divide the interval 0 x 1 up into
184

N subintervals of equal size. Compute for N = 5 and


N = 10.
Firstly, note the ODE may be rewritten as y 00 +2y 0 +y = 12 x.
In Chapter 3, we have learnt how to solve this ODE exactly. If
we solve it exactly subject to y(0) = 0 and y 0 (0) = 1, we obtain
1
3
y (x) = 1 + x + ex + xex .
2
2
Hence y(1) = 1 + 12 + e1 + 32 e1 = 0.4197 (accurate to 4
significant figures).
Here we will solve the problem numerically using the method
described above and compare the approximate numerical value
of y(1) with the exact one.
We divide up the interval 0 x 1 into N smaller subintervals of equal size h = (10)/N = 1/N. Thus, x0 = 0, x1 = h,
x2 = 2h, , xk = kh, , xN1 = (N 1)h and xN = N h =
1. In this case, xk xk1 = h for all k = 1, 2, , N. The
required approximate value for y(1) is given by yN .
The formulae for the calculations are
1
0
0
+ h[yk1 2yk1
+ (k 1)h]
yk0 ' yk1
2
0
yk ' yk1 + hyk1
.
For the calculations, we prepare a spreadsheet using seven
of its columns, that is, columns A, B, C, D, E, F and G defined
as follows.
Column A:= input N
Column B:= value of h = 1/N
Column C:= current value of the integer k
Column D:= value of yk1 for k given in column C
0
for k given in column C
Column E:= value of yk1

Column F:= value of yk for k given in column C


185

Column G:= value of yk0 for k given in column C


We set up the spreadsheet following the steps below.
1. In the cell A1, we enter a value for N.
2. In B1, we insert the formula =1/A1 to compute h.
3. In C1, we enter the initial value of 1 for k .
4. In D1, we enter 0 for y(0) = 0.
5. In E1, we enter 1 for y0 (0) = 1.
6. In F1, we insert the formula
=D1+B1*E1.
7. In G1, we insert the formula
=E1 + B1*sum( D1, 2.0*E1,0.5*(C1 1.0)*B1).
8. In A2, we insert the formula =A1.
9. In B2, we insert the formula =B1.
10. In C2, we increase the value of k in C1 by 1 by inserting
the formula =C1+1.
11. In D2, we insert the formula =F1.
12. In E2, we insert =G1.
13. Copy and paste the formula in F1 into F2. If this is
properly done, the formula in F2 should be
=D2 + B2*E2.
14. Copy and paste the formula in G1 into G2. If this is
properly done, the formula in G2 should be
=E2 + B2*sum( D2, 2.0*E2,0.5*(C2 1.0)*B2).
186

The spreadsheet is now ready for carrying out the required


calculations.
Table 6.4

1
2
3
4
5
Guide

A
5
5
5
5
5
N

B
0.2
0.2
0.2
0.2
0.2
h

C
1
2
3
4
5
k

D
0
0.2
0.32
0.388
0.424
yk1

E
1
0.6
0.34
0.18
0.0904
0
yk1

F
0.2
0.32
0.388
0.424
0.44208
yk

G
0.6
0.34
0.18
0.0904
0.04944
yk0

Table 6.4 shows the results for N = 5. Calculations for


N = 5 yield y5 = 0.4421 (in cell F5) as an approximate numerical value for y(1). If we compare this with the exact value of
0.4197, the error in the approximate value is about 5%. This
is a reasonably good result, if we take into consideration that
we use only N = 5. If we repeat the calculations for N = 10,
we obtain y10 = 0.4298 as an approximate numerical value for
y(1). The percentage error is reduced to about 2%.

6.4
6.4.1

Oscillation of a pendulum
Nonlinear ODE

Consider a swinging pendulum which consists of a body of mass


m attached to a very thin taut string of length L as shown in
Figure 6.2. The position of the body is given by the angle
(in radian) as defined in Figure 6.2. It varies with time t 0.
Hence is a function of t. If we regard as positive when the
body is on the right of the dotted vertical line in Figure 6.2,
then is negative when the body is on the other side. If the only
forces acting on the body are due to gravity and the tension in
the string, then (t) satisfies the ODE
00 (t) + k 2 sin() = 0
187

p
where k = g/L and g is the acceleration due to gravity (g '
9.81 meter per second per second). The ODE above comes from
Newtons law of motion. We will not go into the details of its
derivation here.

Figure 6.2
The ODE above is not a linear one. It is a second order
nonlinear ODE which is dicult (if not impossible) to solve
exactly.

6.4.2

ODE for very small oscillation

In elementary physics courses, it is usual to assume that has


a very small magnitude so that we may approximate2 sin()
by . With sin() ' , the nonlinear ODE may be replaced
approximately by
00 (t) + k2 (t) = 0.
The simpler ODE above is only approximately true. It is a
good approximation only if the pendulum has a very small
oscillation. It is a homogeneous 2nd order linear ODE with
2
The Taylor series for sin(x) about x = 0 is sin(x) = xx3 /6+x5 /120
. If x is very, very small, sin(x) can be approximated by x if we throw
away all other terms in the series.

188

constant coecients and can be solved as explained in Chapter


3.
Without going into details, the general solution of the ODE
for very small oscillation is
(t) = C sin(kt) + D cos(kt)
where C and D are arbitrary constants.
We may determine C and D if we know the state of motion
of the body at a particular time. For example, if the position of
the pendulum at time t = 0 is known, that is, (0) = 0 , where
0 is a given constant, then D = 0 . If it is further known that
the body is at rest at t = 0, that is, 0 (0) = 0, then C = 0. For
this particular case, the swinging of the pendulum is given by
(t) = 0 cos(kt).
Once again, bear in mind that this solution is only approximately true for very small oscillation.

6.4.3

Numerical solution for larger oscillation

If we wish to investigate the swinging of the pendulum without


assuming that the angle has a very small magnitude, we have
to solve the complete nonlinear ODE given by
00 (t) + k2 sin() = 0.
Rewrite the ODE as
00 (t) = k 2 sin().
We can use the approximate method in Section 6.3 to solve the
nonlinear ODE.
Before we proceed any further, let us give a specific value for
the parameter k. We choose k = 1 (that is, g/L = 1 per second
per second) and solve the ODE subject to (0) = 1 (radian)
and 0 (0) = 0, over the time interval 0 t 1, that is, during
the first one second. We divide up the interval 0 t 1 into
N smaller subintervals 0 t h, h t 2h, , (k 1)h
189

t kh, , (N 2)h t (N 1)h and (N 1)h t 1,


where h = 1/N. We define k = (kh) and 0k = 0 (kh).
For the numerical solution of the ODE, we use the formulae
on page 184 to obtain
0k ' 0k1 h sin(k1 )
k ' k1 + h0k1

together with 0 = 1 and 00 = 0.


We carry out the calculations on an electronic spreadsheet
as described in Section 6.3. For N = 100, we obtain approximate values of at t = 0.2, 0.4, 0.6, 0.8 and 1.0. When the
calculations are repeated for N = 200, we observe that the approximate numerical values of agree to at least 2 significant
figures with the ones for N = 100. In Table 6.5, the approximate values of for N = 200 are compared with those values
from the solution (t) = cos(t) which is approximately true
for very small oscillation (linear solution). It is obvious that
the approximate values of obtained from the nonlinear ODE
are quite close to the corresponding ones from the linear ODE,
only when time t is small. As t increases, the dierence between
the nonlinear and linear solutions becomes significant. At time
t = 1, the dierence between the two is about 12% the linear
value. The linear solution is not a good approximation for the
oscillation of the pendulum, as we give the pendulum quite a
large angular displacement (of 1 radian or approximately 57 )
before allowing it to swing from rest. At least for 0 t 1, the
linear solution appears to predict that the pendulum is swinging faster than it should. Is this according to your expectation?
Table 6.5
Time t
0.20
0.40
0.60
0.80
1.00

Nonlinear
0.9836
0.9340
0.8522
0.7404
0.6016
190

Linear
0.9801
0.9211
0.8253
0.6967
0.5403

6.5

Numerical prudence

In essence, what a numerical method for an ODE does is to


replace the task of solving the ODE by a set of simpler formulae which can be computed to give approximate values of the
solution at selected points in the solution interval. Prudence
(for care, caution and good judgment) is needed when applying
a numerical method for solving an ODE. If possible, we should
analyse mathematically the errors in our approximations and
also round-o errors due to computer limitations. Such an error
analysis is beyond the scope of our studies here. Even without
an error analysis, we can still check the validity of a numerical
method in several dierent ways.
We can check that the numerical method works well for
problems which have known exact solutions. By comparing the
numerical results with the exact solutions, we may have some
idea of the accuracy of the method.
When using a numerical method to solve ODEs which do
not have exact solutions, we can examine whether the numerical solution converges (as it should) or not when we refine
our calculations. If no convergence is observed, the numerical
method may not be working properly. We may also compare
our numerical results with those obtained using other (dierent) numerical methods.
We may examine the numerical results obtained to see if
they are intuitively and physically acceptable. For example, in
using a numerical method to compute the mass of a piece of
melting ice, we know that something is amiss if the numerical
results show that the mass is increasing with time!

6.6

Exercise X

1. Use the Eulers method to solve y 0 = 2x2 y2 numerically


subject to the condition y(0) = 1/2, over the interval
0 x 1. (a) Divide the interval 0 x 1 into 10
equal subintervals and obtain numerical values of y at x =
0.2, 0.4, 0.6, 0.8 and 1.0. (b) Repeat the calculation by
191

dividing the interval 0 x 1 into 20 equal subintervals.


(c) Find the exact solution of the problem and compare
the numerical values you obtained with the exact solution.
2. If the motion of the body in the swinging pendulum in
Section 6.4 experiences resistance from its surrounding
medium, it may be modeled using the ODE
g

00 (t) = sin((t)) 0 (t),


L
m
where > 0 is the medium resistant coecient. For
g/L = 1 per second per second and /m = 1 per second,
use the numerical method in Section 6.3 to solve the
ODE subject to (0) = 1 and 0 (0) = 0 over the interval
0 t 1. Divide the interval up into 100 equal subintervals. Tabulate the numerical values of at t = 0.20,
0.40, 0.60, 0.80 and 1.00. Repeat the exercise by dividing
0 t 1 up into 200 subintervals. Check for convergence when the calculations are refined. Compare the
results you obtained with those in Table 6.5. Are they
physically acceptable?
3. Assuming that the angle (t) can be expressed in terms
of its Taylor series about t = 0, one can use the first few
terms in the series to construct an approximate solution
for the swinging pendulum. Specifically, for small time t,
one can make the approximation
(t) ' (0) + 0 (0)t +

00 (0) 2 000 (0) 3 0000 (0) 4


t +
t +
t .
2
6
24

The values of (0) and 0 (0) are known from the given
conditions at t = 0 and those of 00 (0), 000 (0) and 0000 (0)
can be found from the ODE which governs the motion of
the swinging pendulum in Problem 2 above. (Dierentiate the ODE once and twice to obtain expressions for
000 (t) and 0000 (t).) Use the above to obtain a small time
approximate solution for the swinging pendulum in Problem 2 and compute the values of approximately at at
192

t = 0.20, 0.40, 0.60, 0.80 and 1.00. Are the values in good
agreement with those obtained in Problem 2?
4. Extend the Eulers method to devise a numerical procedure for solving the 3rd order ODE y000 = F (x, y, y 0 , y 00 )
subject to y(a) = c, y 0 (a) = d and y00 (a) = s, where a, b,
c, d and s are given numbers.
5. Second order Runge-Kutta method. As mentioned on page
179, in the Eulers method for solving the 1st order ODE
y 0 (x) = F (x, y) subject to y(a) = c, the solution curve
is approximated using a set of straight lines over the
subintervals a = x0 x x1 , x1 x x2 , ,
xk1 x xk , , xN2 x xN1 and xN 1
x xN , and the straight line over the k-th subinterval
xk1 x xk has a gradient given by F (xk1 , yk1 ).
(Note that y0 = c = y(x0 ), y1 = y(x1 ), y2 = y(x2 ) and
so on.) In the second order Runge-Kutta method, the
gradient of the straight line over xk1 x xk is modified to take the value of F (x, y(x)) at x = 12 (xk1 + xk )
(the midpoint of the k-th subinterval). From the earlier
approximation (in the Eulers method), that is,
y(x) ' yk1 + (x xk1 )F (xk1 , yk1 )
for xk1 x xk ,

we obtain
1
1
y( (xk1 + xk )) ' yk1 + (xk xk1 )F (xk1 , yk1 ).
2
2
Thus, if we define
1
(xk1 + xk )
2
1
= yk1 + (xk xk1 )F (xk1 , yk1 )
2

xk =
yk

then the second order Runge-Kutta method for finding


numerically y1 , y2 , , yN 1 and yN is given by the for193

mula
yk ' yk1 + (xk xk1 )F (xk , yk )
for k = 1, 2, , N.

Repeat Problem 1 above using the second order RungeKutta method. Do you obtain more accurate numerical
results?
6. Extend the second order Runge-Kutta method in Problem 5 to solve the 2nd order ODE y00 = F (x, y, y0 ) subject
to y(a) = c and y0 (a) = d. Apply the extended method
to solve the problem in the example on page 184, that is,
solve the ODE y00 = y 2y 0 + 12 x subject to y(0) = 0 and
y 0 (0) = 1, over the interval 0 x 1, in order to compute y(1) approximately. Do you obtain more accurate
numerical results?

6.7

Solutions to Exercise X

1. Proceed following closely the example on page 179. In


setting up the spreadsheet for the calculations, one difference is in the formula to insert in column E. The formula to insert in column E is in accordance with yk '
2
2
= yk1 + 2 h 3 (k 1)2 yk1
for
yk1 + 2 h x2k1 yk1
k = 1, 2, , N, that is, in the cell E1, we insert the formula
=D1+2.0*B1*B1*B1*(C11.0)*(C11.0)*D1*D1.
Another dierence is in the condition y(0) = 1/2. This
requires us to insert 0.50 (instead of 1) in the cell D1.
The given ODE is 1st order separable. It can be easily
solved subject to y(0) = 1/2, as explained in Chapter 2,
to give the exact solution y(x) = 3(2x3 6)1 . The
numerical values of y at x = 0.2, 0.4, 0.6, 0.8 and 1.0,
for N = 10 and 20, are compared with the exact solution
below.
194

x
0.20
0.40
0.60
0.80
1.00

N = 10
0.5005
0.5070
0.5286
0.5782
0.6834

N = 20
0.5009
0.5089
0.5334
0.5896
0.7128

Exact
0. 501 3
0. 510 9
0. 538 8
0. 602 9
0.7500

The numerical values appear to converge to the exact ones


as N is increased from 10 to 20.
2. To set up the spreadsheet for calculations, follow closely
the example on page 184. Formulae to use are given by
0k ' 0k1 h(sin(k1 ) + 0k1 ) and k ' k1 + h0k1
together with 0 = 1 and 00 = 0. The numerical values
of at t = 0.20, 0.40, 0.60, 0.80 and 1.00, for N = 100
and N = 200, are given in the table below. In the third
column of the table, the numerical values of (taken from
Table 6.5) for the nonlinear motion in the absence of resistance from the surrounding medium are also given.
t
0.20
0.40
0.60
0.80
1.00

N = 100
0.9850
0.9423
0.8780
0.7974
0.7053

N = 200
0.9846
0.9418
0.8774
0.7968
0.7049

From Table 6.5


0.9836
0.9340
0.8522
0.7404
0.6016

The numerical values for N = 100 and M = 200 agree to


at least 2 significant figures. At a given time t, the value
of is larger than the corresponding value from Table
6.5. Thus, the motion of the pendulum here is slower
than that recorded in Table 6.5. This is expected as we
have here resistance to the motion from the surrounding
medium.
3. The ODE is 00 (t) = sin 0 (t). From (0) = 1 and
0 (0) = 0, we find that 00 (0) = sin(1) ' 0. 841 47. Differentiating, we find that 000 (t) = 0 (t) cos 00 (t) and
195

0000 (t) = (0 (t))2 sin 00 (t) cos 000 (t), hence 000 (0) '
0. 841 47 and 0000 (0) ' 0. 386 82. It follows that
0. 841 47 2 0. 841 47 3 0. 386 82 4
t +
t
t ,
2
6
24
(0.2) ' 0. 984 2, (0.4) ' 0. 941 2, (0.60) ' 0. 876 7,
(t) ' 1

(0.80) ' 0. 795 9, (1.00) ' 0. 703 4.

The approximate values of at t = 0.20, 0.40, 0.60, 0.80


and 1.00, for N = 100 and N = 200 are quite close to
those obtained in Problem 2.
4. For the 3rd order ODE y000 = F (x, y, y0 , y 00 ), we make the
approximations
0
yk ' yk1 + (xk xk1 ) yk1
0
00
yk0 ' yk1
+ (xk xk1 ) yk1

00
0
00
yk00 ' yk1
+ (xk xk1 ) F (xk1 , yk1 , yk1
, yk1
).

In the above, as before, we divide the solution interval


a x b into N subintervals a = x0 x x1 , x1
x x2 , , xk1 x xk , , xN2 x xN 1
and xN1 x xN , and define yk = y(xk ), yk0 = y 0 (xk ),
yk00 = y 00 (xk ) and yk000 = y 000 (xk ). In the above formulae, if
we let k = 1, we can calculate y1 , y10 and y20 using the
given conditions at x = a, that is, y0 = c, y00 = d and
y000 = s. Subsequently, we can let k = 2, 3, in order to
compute y2 , y3 and so on.
5. The solution domain 0 x 1 is divided into N equal
subintervals as in Problem 1 above. Here xk = kh, where
h = 1/N. For the problem here, the formulae for the
second order Runge-Kutta method are given by
2
y k = yk1 + h3 (k 1)2 yk1
1
yk ' yk1 + h3 (2k 1)2 y2k .
2

We will use columns A to F of the spreadsheet (Table 6.1)


to carry out the calculations. We define them as follows.
196

Column A:= input N


Column B:= value of h = 1/N
Column C:= current value of the integer k
Column D:= value of yk1 for k given in column C
Column E:= value of y k for k given in column C
Coulmn F:= value of yk for k given in column C
We set up the spreadsheet as outlined in the steps below.
(1) In A1, enter the positive integer N .
(2) In C1, set the initial value of k to 1.
(3) In D1, enter the value 0.50 for y(0) = 1/2.
(4) In B1, insert the formula =1.0/A1.
(5) In E1, insert the formula
=D1+B1*B1*B1*(C11.0)*(C11.0)*D1*D1.
(6) In F1, insert the formula
=D1+0.5*B1*B1*B1*(2*C11.0)*(2*C11.0)*E1*E1.

(7) In A2, insert the formula =A1.


(8) In B2, insert the formula =B1.
(9) In C2, insert the formula =C1+1.
(10) In D2, insert the formula =F1.
(11) Copy and paste the formula in E1 into E2.
(12) Copy and paste the formula in F1 into F2.

197

The numerical values of y at x = 0.2, 0.4, 0.6, 0.8 and 1.0,


for N = 10 and 20, are compared with the exact solution
below.
x
0.20
0.40
0.60
0.80
1.00

N = 10
0.5012
0.5107
0.5383
0.6015
0.7446

N = 20
0.5013
0.5108
0.5387
0.6025
0.7485

Exact
0. 501 3
0. 510 9
0. 538 8
0. 602 9
0.7500

Convergence is obvious as N increases from 10 to 20. The


numerical values here are definitely more accurate than
those in Problem 1 above.
6. Recall that if we extend the Eulers method to solve the
2nd order ODE y 00 = F (x, y, y 0 ), the formulae to use are
0
yk ' yk1 + (xk xk1 ) yk1

0
0
yk0 ' yk1
+ (xk xk1 ) F (xk1 , yk1 , yk1
).

The extension of the second order Runge-Kutta method


to the 2nd order ODE are given by the following formulae:
1
(xk1 + xk )
2
1
0
= yk1 + (xk xk1 )yk1
2
1
0
0
= yk1
+ (xk xk1 )F (xk1 , yk1 , yk1
)
2
' yk1 + (xk xk1 ) y 0k

xk =
yk
y0k
yk

0
yk0 ' yk1
+ (xk xk1 ) F (xk , y k , y0k ).

For the ODE y00 = y 2y 0 + 12 x, the interval 0 x 1


and the conditions y(0) = 0 and y 0 (0) = 1, if we divide the
interval into N equal subintervals (as before), we obtain

198

xk = kh (h = 1/N ), y0 = 0 and y00 = 1 and the formulae


xk =
yk =
y0k =
yk '
yk0 '

1
(2k 1)h
2
1 0
yk1 + hyk1
2
1
1
0
0
yk1 + h(yk1 2yk1
+ (k 1)h)
2
2
yk1 + hy 0k
1
0
yk1
+ h(y k 2y 0k + (2k 1)h).
4

We prepare the spreadsheet for calculations as follows.


Column A:= input N
Column B:= value of h = 1/N
Column C:= current value of the integer k
Column D:= value of yk1 for k given in column C
0
for k given in column C
Column E:= value of yk1

Column F:= value of y k for k given in column C


Column G:= value of y 0k for k given in column C
Column H:= value of yk for k given in column C
Column I:= value of yk0 for k given in column C
(1) In A1, enter a value for N.
(2) In B1, insert the formula =1/A1.
(3) In C1, enter 1 for k .
(4) In D1, enter 0 for y(0) = 0.
(5) In E1, enter 1 for y 0 (0) = 1.
(6) In F1, insert the formula =D1+0.5*B1*E1.
199

(7) In G1, insert the formula


=E1 + 0.5*B1*sum( D1, 2.0*E1,0.5*(C1 1.0)*B1).
(8) In H1, insert the formula =D1+B1*G1.
(9) In I1, insert the formula
=E1 + B1*sum( F1, 2.0*G1,0.25*(2*C1 1.0)*B1).
(10) In A2, insert the formula =A1.
(11) In B2, insert the formula =B1.
(12) In C2, insert the formula =C1+1.
(13) In D2, insert the formula =H1.
(14) In E2, insert =I1.
(15) Copy and paste the formula in F1 into F2.
(16) Copy and paste the formula in G1 into G2.
(17) Copy and paste the formula in H1 into H2.
(18) Copy and paste the formula in I1 into I2.
For N = 5, we obtain y(1) ' 0.4133 (about 1. 5% error)
(compared to 5% error by the extended Eulers method).
For N = 10, y(1) ' 0.4183 (about 0. 3% error) (compared
to 2% error by the extended Eulers method). Yes, more
accurate results are obtained here. For N = 50, we find
that y(1) ' 0.4196 (the exact value of y(1) to 4 significant
figures is 0.4197).

200

You might also like