You are on page 1of 238

Ordinary Differential Equations

Barry Croke
Semester 1, 2016
Based on notes written by Lilia Ferrario, Linda Stals and Dayal
Wickramasinge

Contents
1 Introduction
1.1 Mathematical models . . . . . . . . . . .
1.1.1 Setting up a mathematical model
1.2 Basic concepts and definitions . . . . . .
1.3 Solutions of DEs . . . . . . . . . . . . .
1.3.1 Particular solution of a DE . . .
1.4 Initial Value Problems . . . . . . . . . .
1.5 Geometrical meaning of y 0 = f (x, y). . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

2
2
2
3
5
6
7
8

2 Mathematical models
2.1 Matlab . . . . . . . . . . . . . .
2.2 Population dynamics . . . . . . .
2.3 Newtons law of cooling/warming
2.4 Spread of disease . . . . . . . . .
2.5 Chemical reactions . . . . . . . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

10
10
11
13
17
19

3 Separable differential equations


3.1 Definitions and notation . . . . . . . . . . . . . .
3.1.1 Example: Separable differential equations
3.2 Application: Exponential growth and decay . . .
3.3 Application: Population growth . . . . . . . . . .
3.4 Application: Compound Interest . . . . . . . . .
3.5 Application: Pollution in Lake Burley Griffin . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

22
22
22
26
28
29
29

4 Exact differential equations


4.1 Differentials . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.1 Example: Exact equation . . . . . . . . . . . . . . .
4.1.2 Theorem: Exact equation . . . . . . . . . . . . . . .
4.2 General solutions . . . . . . . . . . . . . . . . . . . . . . . .
4.2.1 Example: General solutions . . . . . . . . . . . . . .
4.2.2 Application: Fluid flow past a cylindrical obstacle .
4.3 Reduction to exact form: integrating factors . . . . . . . . .
4.3.1 Example: Integrating factor . . . . . . . . . . . . . .
4.3.2 Application: Economic growth of developing country
4.3.3 Application: fluid flow along dipole-like field lines . .

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

35
35
35
35
37
38
39
43
45
46
47

5 First order linear differential equations


5.1 Definitions and notation . . . . . . . . . . . . .
5.2 Homogeneous equations . . . . . . . . . . . . .
5.2.1 Examples: Homogeneous equations . . .
5.3 Non-homogeneous equations . . . . . . . . . . .
5.3.1 Examples: Non-homogeneous equations
5.3.2 Application: Art forgery . . . . . . . . .
5.3.3 Application: Radiation transfer . . . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

52
52
52
52
53
55
55
61

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

5.4

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

6 Second order homogeneous linear differential equations


6.1 Definitions and notation . . . . . . . . . . . . . . . . . . .
6.1.1 Homogeneous differential equations . . . . . . . . .
6.1.2 Example: Linear combinations . . . . . . . . . . .
6.1.3 General solution . . . . . . . . . . . . . . . . . . .
6.2 Initial Value Problems . . . . . . . . . . . . . . . . . . . .
6.2.1 Example: Initial value problems . . . . . . . . . .
6.3 Method of reduction of order . . . . . . . . . . . . . . . .
6.3.1 Basis . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.2 How to find one solution if the other is known . . .
6.3.3 Example: Method of reduction of order . . . . . .
6.4 Constant coefficients case . . . . . . . . . . . . . . . . . .
6.4.1 Characteristic equations . . . . . . . . . . . . . . .
6.4.2 Application: Mass-Spring System . . . . . . . . . .
6.4.3 Application: Euler-Cauchy equation . . . . . . . .
6.5 Existence and uniqueness theory . . . . . . . . . . . . . .
6.5.1 Wronskian . . . . . . . . . . . . . . . . . . . . . . .
6.5.2 Example: Test of linear independence . . . . . . .

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

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

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

82
. 82
. 82
. 83
. 83
. 83
. 84
. 84
. 84
. 85
. 86
. 86
. 86
. 92
. 98
. 103
. 103
. 104

7 Non-homogeneous differential equations


7.1 Notation and definitions . . . . . . . . . . . . . . . . .
7.1.1 General solution and particular solution . . . .
7.2 Solution by undetermined coefficients . . . . . . . . . .
7.2.1 Examples: Method of undetermined coefficients
7.3 Solution by variation of parameters . . . . . . . . . . .
7.3.1 Examples: Method of variation of parameters .
7.4 Modelling: Forced oscillations, resonance . . . . . . . .
7.4.1 Undamped forced oscillations . . . . . . . . . .
7.4.2 Application: NASA tethered satellite system .
7.4.3 Application: Beats . . . . . . . . . . . . . . . .
7.4.4 Application: Damped forced oscillations . . . .
7.5 Modelling: RCL-circuit . . . . . . . . . . . . . . . . .
7.6 Supply and Demand . . . . . . . . . . . . . . . . . . .

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

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

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

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

5.5

Reduction to linear form. Bernoulli equation


5.4.1 Example: Bernoulli equations . . . . .
5.4.2 Application: the logistic equation . . .
Electric circuits . . . . . . . . . . . . . . . . .
5.5.1 Example: RL-Circuit . . . . . . . . . .
5.5.2 Example: RC-Circuit . . . . . . . . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

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

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

8 Higher order linear differential equations


8.1 Higher order homogeneous linear differential equations . . . . . .
8.1.1 Definitions and notation . . . . . . . . . . . . . . . . . . .
8.1.2 Higher order homogeneous linear differential equations
with constant coefficients . . . . . . . . . . . . . . . . . .

63
64
65
70
72
78

106
106
106
107
108
111
113
114
116
118
120
122
127
131
132
132
132
133

8.2

8.1.3 Examples: Constant coefficients . . . . . . . . . . . . . .


8.1.4 Initial value problems . . . . . . . . . . . . . . . . . . .
Higher order non-homogeneous linear differential equations . .
8.2.1 Particular solution: method of undetermined coefficients
8.2.2 Example: Method of undetermined coefficients . . . . .
8.2.3 Particular solution: method of variation of parameters .
8.2.4 Initial value problems . . . . . . . . . . . . . . . . . . .

9 Systems of differential equations


9.1 Systems of differential equations: what are they? . . . . .
9.1.1 Modelling: predator-prey . . . . . . . . . . . . . .
9.1.2 Investigate using Matlab . . . . . . . . . . . . . .
9.2 Analytic approach . . . . . . . . . . . . . . . . . . . . . .
9.2.1 Experimental evidence . . . . . . . . . . . . . . . .
9.3 Linear systems of n first order differential equations . . .
9.3.1 Eigenvalues and eigenvectors . . . . . . . . . . . .
9.3.2 Application: model of an electrical networks . . . .
9.4 Conversion of a nth order differential equation to a system
9.4.1 Example: Higher order differential equations . . .
9.5 Homogeneous systems with constant coefficients . . . . . .

.
.
.
.
.
.
.

134
134
135
135
135
136
137

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

138
138
138
138
146
151
152
153
154
158
160
161

10 Systems of differential equations: Phase planes


10.1 Phase planes . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.1 Real and distinct roots of same sign: improper node
10.1.2 Real roots of opposite signs: saddle point . . . . . .
10.1.3 Complex roots (i): spiral point . . . . . . . . .
10.1.4 Complex pure imaginary roots (i): Centre point .
10.1.5 Equal roots: proper node . . . . . . . . . . . . . . .
10.1.6 Equal roots: degenerate node . . . . . . . . . . . . .
10.2 Summary of critical points and stability . . . . . . . . . . .
10.3 No basis of eigenvectors available . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.

162
162
163
165
166
169
170
172
173
174

11 Nonlinear systems of differential equations


11.1 Nonlinear systems . . . . . . . . . . . . . .
11.2 Linearisation of nonlinear systems . . . . .
11.2.1 Example . . . . . . . . . . . . . . . .
11.3 Applications . . . . . . . . . . . . . . . . . .
11.3.1 Application: Macroeconomics Model
11.3.2 Application: undamped pendulum .
11.3.3 Application: damped pendulum . . .

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

176
176
177
177
179
179
182
184

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

.
.
.
.
.
.
.

12 Power Series Solutions


188
12.1 Power Series Solutions of ODEs (2nd order) . . . . . . . . . . . 188
12.1.1 Euler type equations . . . . . . . . . . . . . . . . . . . . . 193
12.1.2 The Method of Frobenius . . . . . . . . . . . . . . . . . . 196

13 Special functions
198
13.1 Bessels Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 198
13.1.1 Bessel functions of the first kind and Gamma functions . 199
13.1.2 Bessel functions of the 2nd kind . . . . . . . . . . . . . . 205
14 Numerical solution of ODEs
14.1 Taylors theorem . . . . . . . . . . . . . . . . . . . . .
14.1.1 Taylors theorem for a function of two variables
14.1.2 Example: Taylors series . . . . . . . . . . . . .
14.1.3 Example: Initial Value Problem . . . . . . . . .
14.2 Eulers method . . . . . . . . . . . . . . . . . . . . . .
14.2.1 Example: Eulers method . . . . . . . . . . . .
14.3 Runge-Kutta methods . . . . . . . . . . . . . . . . . .
14.3.1 Second order Runge-Kutta . . . . . . . . . . .
14.3.2 Fourth order Runge-Kutta . . . . . . . . . . . .
14.3.3 Examples: Runge-Kutta method . . . . . . . .
14.4 System of equations . . . . . . . . . . . . . . . . . . .
14.4.1 Application: galactic dynamics . . . . . . . . .

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

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

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

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

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

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

206
206
207
207
208
209
210
220
220
221
221
224
229

1
1.1

Introduction
Mathematical models

Mathematical models
Mathematical models of a wide range of systems, (in ecology, economics,
biology, physics, engineering, physiology, sociology etc) have become part of our
everyday lives; from decisions made in business dealing with millions of dollars
to decisions at home about whether to cycle to uni based on weather predictions.
To model systems can be an extremely complex procedure. The variables
describing the process need to be identified and the relationships between them
established, and to a degree, the process needs to be isolated and variables with
negligible influence need to be excluded. Clearly no model is then a perfect representation of the real life system, but they can be a very good approximation.
1.1.1

Setting up a mathematical model

Figure 1: The modelling process

Modelling process
(a) Identify the most relevant quantities describing the process. Identify any
assumptions made and establish relationships between the quantities.
(b) Define symbols to denote the quantities, variables and constant, and set
up the mathematical equations (or assumptions you have made).
(c) Solve the equations and interpret the results in terms of the original process.

(d) Check the results are reasonable and whether they match with any experimental data.
Refer to Figure 1.
Building a model
Equations which are very complicated may be too complex to solve and
thus interpretation becomes difficult. On the other hand, models which are too
simplistic do not represent the process well and may not be very reliable in their
interpretation. So a reasonable balance needs to be found.

1.2

Basic concepts and definitions

Independent and dependent variables


We will start with basic definitions, most of which you will have come across
before, but we need some standard terminology.
Definition 1 (Independent and dependent variables). If an equation involves
the derivative of one variable with respect to another, then the former is called
a dependent variable and the latter is the independent variable.
Example 1 (Independent and dependent variables). For example, in the equation
dy
d2 y
+a
+ by = 0 ,
dx2
dx
x is the independent variable and y the dependent variable and a and b are the
coefficients.
Ordinary differential equations
Definition 2 (Ordinary differential equations). A differential equation involving ordinary derivations with respect to a single independent variable such as
dy
= 7y
dx

d2 y
dy
a
=0
2
dx
dx

or

are Ordinary Differential Equations (ODEs).


Partial differential equations
Definition 3 (Partial differential equation). These contrast with equations involving partial derivations with respect to more than one independent variable,
such as
u u

= x 2y
x y
which is a Partial Differential Equation (PDE).

The order of a differential equation


Definition 4 (Order). The order of a differential equation is the order of the
highest derivative present in the equation.
Example 2 (Order). Thus
dy
= 7y
dx

dy
d2 y
a
=0
dx2
dx

or

are first order and second order differential equations respectively.


Linear differential equation
Definition 5 (Linear differential equation). A linear differential equation is
any equation that can be written in the form
an (x)

dn y
dn1 y
dy
+
a
(x)
+ + a1 (x)
+ a0 (x)y = F (x)
n1
dxn
dxn1
dx

where ai and F are functions of x, but not y.


Example 3 (Linear differential equation). An example is
d2 y
+ y = x2 .
dx2
Non-linear differential equation
Definition 6 (Non-linear differential equation). A non-linear differential equation is one which is not linear!
Example 4 (Non-linear differential equation). For example
d2 y
+ cos y = 0
dx2

and

d2 y
dy
+y
= sin x
dx2
dx

are non-linear because of the cos y term and the ydy/dx term respectively.
Linearisation
Although most phenomena in nature are nonlinear, linear equations are much
easier to analyse. For this reason, in cases when nonlinear equations are difficult
to analyse, these can be studied through a process known as linearisation. We
will see this later in the course.

Notation for derivatives


Some other notations for derivatives are:
y0
y (1)
Dy

=
=
=

dy
dx ,
dy
dx ,
dy
dx ,

d y
y 00 = dx

2,
d2 y
(2)
y = dx
,

2
d2 y
2
D y = dx2 ,

d y
y (n) = dx
n
dn y
Dn y = dx
n

If x = x(t), where t is time, then the following notation is often used:


x =

1.3

dx
dt

x
=

d2 x
dt2

... d3 x
x = 3
dt

Solutions of DEs

Explicit and implicit solutions


Definition 7 (Explicit solution). A function y = f (x) that satisfies a differential equation


dy
dn y
F x, y, , , n = 0
dx
dx
on some open interval, is said to be an explicit solution to the equation. This
means that if we substitute y = f (x) into the above equation we get an identity.
Definition 8 (Implicit solution). Sometimes, a solution of a DE will appear as
an implicit function, given in the form:
f (x, y) = 0
and is called an implicit solution.
Example 5 (Explicit solution). The function
9 4
x
4
is an explicit solution of the non-linear differential equation:
y=

dy
= 6xy 1/2
dx
on the interval < x < .
Lets verify this. By substituting the solution into the differential equation
and by explicit differentiation we obtain:

d 94 x4
dy
=
= 9x3
dx
dx
and
1/2

9 4
6xy 1/2 = 6x
x
= 9x3 .
4
Since the left-hand-side comes up to be the same as the right-hand-side, it
dy
is true that y = 49 x4 is a solution to dx
= 6xy 1/2 .
5

Example 6 (Implicit solution). The function


f (x, y) = x2 + y 2 9 = 0

(y > 0)

is an implicit solution of the non-linear differential equation:


y

dy
= x
dx

on the interval 3 < x < 3.


Lets verify this. By implicit differentiation of f (x, y) = x2 + y 2 9 = 0 we
obtain:


d
d
d
x2 +
y2
9
dx
dx
dx
dy
2x + 2y
dx
dy
y
dx

d
0,
dx

0,

= x.

Note that we could write the solution explicitly as y =


1.3.1

9 x2 .

Particular solution of a DE

Solution curves
Differential equations in general have many solutions. This shouldnt surprise us, since integration introduces arbitrary constants. For example, take the
differential equation
1
dy
=x+
dx
2
with solutions:
x
x2
+ +C
y(x) =
2
2
where C is a constant. Some of the solutions are shown in Figure 2.
A function like the one above involving an arbitrary constant C is called
a general solution of a first order differential equation. Geometrically, these
solution curves are infinitely many curves, one for each C. We call this a family
of curves.
If we choose a specific C we obtain what is called a particular solution of
that equation. For example, if we take C = 0, we get:
y(x) =

x2
x
+ .
2
2

20

15

10

-4

-2

0
x

Figure 2: Some solution curves of the differential equation dy/dx = x + 1/2.

1.4

Initial Value Problems

What is an initial value problem?


Definition 9 (Initial value problems). A differential equation with an initial
condition is called an initial value problem. That is:
dy
= f (x, y),
and
y(x0 ) = y0
dx
where x0 and y0 are given values, together define an initial value problem.
Example 7 (Initial value problems). Lets use again the previous example:
dy
1
=x+
dx
2
now with the initial value y(1) = 2 (thus x0 = 1, y0 = 2).
We have already shown that the general solution is
x
x2
+ + C.
2
2
To obtain the solution to the initial value problem, we must ensure that the
solution curve passes through (x0 , y0 ) = (1, 2), therefore:
y(x) =

2=

1 1
+ + C.
2 2
7

By doing so, we fix the value of the constant C, since the above equation is
satisfied if C = 1. Thus, the solution to the IVP is:
y(x) =

1.5

x2
x
+ + 1.
2
2

Geometrical meaning of y 0 = f (x, y).

Direction fields
Given a differential equation:
dy
= f (x, y).
dx
A solution curve is a function y(x) whose slope at (x, y) is given by dy/dx =
f (x, y). The direction field is formed by a grid of arrows which are tangential
to the solution curves. These arrows are centred at (x, y) and have slope dy/dx.
By looking at the direction field, one can have an idea of what the solution
curves look like, since the tangent line to a solution curve at each point is given
by the direction field at that point (see Figure 3).

Figure 3: Construction of one arrow of the vector field of the differential equation
dy/dx = f (x, y). The curve y = f (x) is a solution curve through (x0 , y0 )

Figure 4: Vector field of the differential equation dy/dx = x + 1/2

Mathematical models

Numerical simulation
The main focus of the course will be the analytical solution of ordinary
differential equations, however we will also use a computer package to obtain
numerical results. The numerical results will largely be used to interpret and
verify the analytical solutions. Towards the end of the course we will look at
some examples where numerical techniques must be used because the differential
equation are too difficult to solve analytically.

2.1

Matlab

Matlab
The computer package that we will be using is Matlab. Matlab is available
on the Information Commons computers. It is possible to buy the student
version of Matlab at the Co-op bookstore, for example, if you want it on your
home computer, but hopefully that will not be necessary. Most of the coding
exercises will be short.
dsolve in Matlab
dsolve in Matlab allows you to find the symbolic solution to some ODEs.
While this approach may be used to check your assignment solutions, it is not
an approach that will be addressed in the course. In the course you will be
expected to check your solutions by substituting them back into the original
ODE.
In other words, you may use dsolve to check your answers if you want, but
you must also use the substitution method.
ODE solvers in Matlab
To solve equations of the form
dy
= f (y, t), y(t0 ) = y0 ,
dt
in Matlab we will usually use [T,Y] = ode45(F,TimeSpan,Y0,Options)

(1)

F is a handle to a function that evaluates the right hand side of (1).


TimeSpan is a vector of the form [t0 , , tn ] specifying the times at which
the solution is to be evaluated.
Y0 is a vector of initial values, i.e y0 .
Options may be used to pass in additional optional arguments, we will ignore
for now.
Note that ode45 is not the only ODE solver available in Matlab. Certain
types of ODEs require the use of different numerical techniques. It is important to understand the assumptions and limitations of each numerical technique
before solving complicated ODEs.
10

Example Matlab code


M-file (ydot.m)
% dy/ dt=y2 y s i n ( t )+c o s ( t ) , y ( 0 ) =0
% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
f u n c t i o n rhs=ydot ( t , y )
rhs=y2y s i n ( t )+c o s ( t ) ;

Example Matlab code


Main routine
% s e t the i n i t i a l c o n d i t i o n s
y0 =0;
% evaluate the s o l u t i o n over t h i s i n t e r v a l
ts = [ 0 : 0 . 0 1 : p i ] ;
% s o l v e t h e ODE
[ t , y]= ode45 ( @ydot , ts , y0 ) ;
% p l o t the s o l u t i o n
plot (t , y)
t i t l e ( ' Simple one d i m e n s i o n ODE ' )
xlabel ( ' t ' )
ylabel ( 'y ' )
Figure 5 shows the output of the Matlab code.

2.2

Population dynamics

Model of population growth


Assumption 1 (Population growth). Rate of change in population growth is
proportional to the population size.
Let P (t) be the population at time t. Then
dP
= kP,
dt
where k is the rate of growth.
Example 8 (Population growth model). Lets assume the population size at
t = 0 is 10 and see how the population grows if k = 1.35.

11

Simple one dimension ODE


1
0.9
0.8
0.7

0.6
0.5
0.4
0.3
0.2
0.1
0

0.5

1.5

2.5

Figure 5: Output of Matlab code example

Example Matlab code


M-file (Pdot.m)
% P o p u l a t i o n growth , p0 = 1 0 , k = 1 . 3 5
% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
f u n c t i o n rhs = Pdot ( t , P )
k =1.35;
rhs=kP ;

Example Matlab code


Main routine
% s e t the i n i t i a l c o n d i t i o n s
p0 =10;
% evaluate the s o l u t i o n over t h i s i n t e r v a l
ts = [ 0 : 0 . 1 : 5 ] ;
% s o l v e t h e ODE
[ t , p]= ode45 ( @Pdot , ts , p0 ) ;

12

3.5

%p l o t t h e s o l u t i o n
plot (t , p)
t i t l e ( ' Simple P o p u l a t i o n Model ' )
xlabel ( ' t ' )
ylabel ( 'p ' )

Simple Population Model


9000
8000
7000
6000

5000
4000
3000
2000
1000
0

0.5

1.5

2.5
t

3.5

4.5

Figure 6: Output of Matlab code example

Example population model


According to the results in Figure 6 the population will grow exponentially
for ever, which is clearly not a realistic scenario. It also ignores additional
factors such immigration and emigration. However this model is still used to
study the growth of small populations over short intervals of time, such as the
growth of bacteria in a petri dish.

2.3

Newtons law of cooling/warming

Development of Newtons law of cooling/warming


Assumption 2 (Newtons law of cooling). The rate at which the temperature
of a body changes is proportional to the difference between the temperature of
the body and the temperature of the surrounding medium.

13

Let T (t) be the temperature of the body at time t and the constant Tm be
the temperature of the surrounding medium, then
dT
= k(T Tm ),
dt
where k < 0 is the rate at which the heat is absorbed (or emitted) by the object.
Temperature and heat
Assumption 3 (Heat). Rate of change of heat content = cm Rate of change
of temperature, where c is the specific heat of the material (c is measured in
Jkg1 C1 ) and m is the mass.
Let Q be the rate of change of heat with time (measured in Watts). Let T
be the temperature. Then
dT
Q = cm .
dt
Some examples of c are given below;
Substance
Aluminium
Copper
Stainless Steel
Wood
Concrete
Water (at 20o )

c
896
383
461
2385
878
4187

Heat transfer
Convective heat is transfered to its surroundings according to the equation
hS(T Tm ),
where S is the surface area from which is lost, in units m2 , and h > 0 is the
convective heat transfer coefficient.
The following table gives some values of h for a plate of length 0.5m over
which airflow, given in m/s, passes

Plate in still air


Air-flow at 2 m/s
Air-flow at 35 m/s

14

h
4.5
12
75

Hot water heater


Example 9 (Hot water system). A typical electrical hot water system contains
250l of water. It is cylindrical with height 1.444m and diameter 0.564m. Initially we assume the water is 15o . The heating element supplies heat at a rate
of 3.6kW (per hour).
How long does it take to heat the water to 60o ?
S
S

b
b





b
b
:


Heating Element

S
S
Let
T (t) = temperature of water at time t,
T0 = initial temperature of water = 15o ,
Tf = final temperature of water = 60o ,
m = mass of water = 250 kg,
q = rate of energy supplied by the element = 3600 W,
S = surface area of the tank = 3.06 m,
h = convective heat transfer = 12,
c = specific heat of material = 4200 Jkg1 C1 .
We make the following assumptions
The water is well stirred so the temperature is homogeneous throughout
the tank (i.e. the temperature is not dependent on the spatial coordinates).
The heat is lost according to Newtons law of cooling.
The thermal constants remain constant (which may not be true for large
temperature changes).
15

Assumption 4 (Hot water tank). Rate of change of heat = Rate of heat produced by the element - Rate of heat lost to the surroundings.
Rate of change of heat = cm dT
dt .
Rate of heat produced by the element = q.
Rate of heat lost to surroundings = hS(T (t) Tm ).
Hence the equations modelling the water tank are
cm

dT
= q hS(T (t) Tm ).
dt

May solve numerically or analytically.


Analytical solution
Rewrite the equation as
dT
= T,
dt

T (0) = T0 ,

hS
m
where = q+hST
, = cm
.
cm
(We have assumed that the temperature of the surronding material Tm is
the same as the initial temperature of the water T0 .)
Using separation of variables gives the following analytical solution

T = T0 et +

(1 et ).

Returning back to the hot water tank problem we get the following values
for and .
hS
12 3.06
=
= 3.4971 105 .
cm
4200 250
q + hSTm
3600 + 12 3.06 15
=
=
= 3.9531 103 .
cm
4200 250
=

From

T = T0 et + (1 et ),


1 T0
t = ln
.
T

To heat the water up to 60o :



1 15
t = ln
= 17566 sec = 4.88 hrs.
60

The numerical results shown in Figure 7 also agree with these results.
16

Matlab code to model the hot water tank


M-file (Tdot.m)
% Hot Water Tank
% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
f u n c t i o n rhs = Tdot ( t , Temp )
alpha_c = 3 . 4 9 7 1 E 5; beta_c = 3 . 9 5 3 1 E 3;
rhs = beta_calpha_c Temp ;

Example Matlab code


Main routine
% s e t the i n i t i a l c o n d i t i o n s
Temp0 =15;
% evaluate the s o l u t i o n over t h i s i n t e r v a l
ts = [ 0 : 1 0 : 2 0 0 0 0 ] ;
% s o l v e t h e ODE
[ t , Temp ]= ode45 ( @Tdot , ts , Temp0 ) ;
% p l o t the s o l u t i o n
p l o t ( t / 6 0 / 6 0 , Temp )
t i t l e ( ' Hot Water Heater ' )
x l a b e l ( ' t ( h r s ) ' ) ; y l a b e l ( 'T (C) ' )
g r i d on

2.4

Spread of disease

A Simple model of the spread of disease


Assumption 5 (Spread of disease). The spread of a disease grows with the
number the of people who come into contact with infectives.
Let y be the number of susceptibles, x be the number of infectives. then
dx
= kxy,
dt
where k is the rate of infection.
We will additionally assume a constant population size of n and one infected
person is introduced into the community. Then
dx
= kxy, = kx(n + 1 x).
dt

17

Hot Water Heater


65
60
55
50

T (C)

45
40
35
30
25
20
15

3
t (hrs)

Figure 7: Increase in heat over time

Example 10 (Simple disease model). Set the population size to be 100 and
assume that there is initially one infective. How does the growth of the disease
depend on the infection rate k? Plot the results for k = 0.01, k = 0.02 and
k = 0.04 on the same graph.
See Figure 8
Matlab code to implement the disease model
M-file (xdot.m)
% d i s e a s e models
% define
function
global k
rhs =

t h e r i g h t hand s i d e f u n c t i o n
rhs = xdot ( t , x )
n
kx ( n+1x ) ;

Find the solution for the given value of k.


% s o l v e t h e model f o r t h e g i v e n p a r a m e t e r s
f u n c t i o n [ t , x ] = disease_model ( dn , x0 , dk , ts )
18

global k n
% s e t t h e v a r i a b l e s needed by xdot
k = dk ;
n = dn ;
% s o l v e t h e ODE
[ t , x ] = ode45 ( @xdot , ts , x0 ) ;
Main routine
% s e t the parameters
n = 1 0 0 ; x0 = 1 ;
% evaluate the s o l u t i o n at these points
ts = [ 0 : 0 . 1 : 2 0 ] ;
% f i n d the s o l u t i o n f o r k = 0.01
[ t1 , x1 ] = disease_model ( n , x0 , 0 . 0 1 , ts ) ;
% f i n d the s o l u t i o n f o r k = 0.02
[ t2 , x2 ] = disease_model ( n , x0 , 0 . 0 2 , ts ) ;
% f i n d the s o l u t i o n f o r k = 0.04
[ t3 , x3 ] = disease_model ( n , x0 , 0 . 0 4 , ts ) ;
% p l o t the s o l u t i o n
p l o t ( t1 , x1 , t2 , x2 , t3 , x3 )
t i t l e ( ' Spread o f D i s e a s e ' )
xlabel ( ' t ' )
ylabel ( 'x ' )
l e g e n d ( ' k =0.01 ' , ' k = 0 . 0 2 ' , ' k = 0 . 0 4 ' , ' L o c a t i o n ' , ' SouthEast ' )

2.5

Chemical reactions

Chemical reaction - 3 Species


Lets now look at how we can use ODEs to model chemical reactions.
Example 11 (Change in concentration). Consider three species A, B and C
in a tank. The reactions A B C occur in the tank and the constants k1 ,
k2 describe the reaction rates for A B and B C respectively. If k1 = 1
hr1 , k2 = 2 hr1 and the initial concentration for A, B and C are 5, 0 and 0
mol respectively, plot the change in species over time.
Note that this example is different in that we dont just have a single unknown. Consequently we expect to end up with a system of ODEs.
ODE model

19

Spread of Disease
120

100

80

60

40

20

k=0.01
k = 0.02
k = 0.04
0

10
t

12

14

16

18

20

Figure 8: Spread of disease with different values of k.

Let Ca , Cb and Cc represent the concentration of species A, B and C. Then


the following system of ODEs is obtained
dCa
dt
dCb
dt
dCc
dt

= k1 Ca ,
= k1 Ca k2 Cb ,
= k2 Cb .

As we will see later in the course, the analysis of systems of ODEs is more
complicated, and more interesting, than the analysis of a single ODE. However,
the method of coding these systems in Matlab is very similar to what we have
already been using.
Figure 9 shows the change in concentration over time.
Matlab code to model the chemical concentration
M-file (Cdot.m)
% 3 s p e c i e s Chemical R e a c t i o n
% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
20

f u n c t i o n rhs = Cdot ( t , C )
k_1 = 1 ; k_2 = 2 ;
rhs=[k_1 C ( 1 ) ; k_1 C ( 1 )k_2 C ( 2 ) ; k_2 C ( 2 ) ] ;
Main routine
% s e t the i n i t i a l c o n d i t i o n s
C0 = [ 5 ; 0 ; 0 ] ;
% evaluate the s o l u t i o n over t h i s i n t e r v a l
ts= [ 0 : 0 . 1 : 1 0 ] ;
% s o l v e t h e ODE
[ t , C]= ode45 ( @Cdot , ts , C0 ) ;
% p l o t the s o l u t i o n
p l o t ( t , C ( : , 1 ) , ' b+ ' , t , C ( : , 2 ) , ' r . ' , t , C ( : , 3 ) , ' g ' )
t i t l e ( ' Chemical R e a c t i o n ' )
xlabel ( ' t ( hrs ) ' )
y l a b e l ( 'C ( mol ) ' )
l e g e n d ( 'A ' , 'B ' , 'C ' )

Chemical Reaction
5
A
B
C

4.5
4
3.5

C (mol)

3
2.5
2
1.5
1
0.5
0

5
t (hrs)

Figure 9: Chemical concentration.

21

10

Separable differential equations

3.1

Definitions and notation

Separable differential equations


Many first order differential equations, linear and non-linear, can be reduced
through algebraic manipulation to the form:
f (x)dx = g(y)dy.
Such an equation is said to be separable because the variables x and y can be
separated from each other in such a way that x appears only in the coefficient
of dx and y appears only in the coefficient of dy. To solve an equation of this
type, we integrate on both sides to have the general solution:
Z
Z
f (x)dx = g(y)dy + C
where C is an arbitrary constant of integration.
Sometimes, the algebraic manipulation that allows us to separate the variables introduces division by one or more expressions. In such cases, the results
are valid where the denominators are different from zero. Those values that
make the denominator vanish require special considerations and may lead to
singular solutions.
3.1.1

Example: Separable differential equations

Example 12 (Separable differential equations). Solve:


dx + xydy = y 2 dx + ydy.
Solution
First of all, we note that this is a non-linear first order differential equation.
Lets try to separate the variables:
(1 y 2 )dx = y(1 x)dy,
Z
Z
dx
ydy

=
,
x 6= 1
1x
1 y2
ln |1 x| =

1
ln |1 y 2 | + C,
2

y 6= 1

where C is an arbitrary constant

2 ln |1 x| = ln |1 y 2 | + 2C,
ln

|1 x|2
= D,
|1 y 2 |

|1 x|2
= eD = K 2 ,
|1 y 2 |

where D = 2C

where K 2 is any positive constant 6= 0

22

(1 x)2
= K 2
(1 y 2 )

(1 x)2 = (1 y 2 ),

6= 0.

Here, can take any real value, positive or negative but not zero! So
(x 1)2
+ y2

6= 0.

Solution curves
The solution curves are ellipses if > 0 and hyperbolas if < 0. We have
plotted some of these solution curves in Figures 10, 11 and 12.
Solution of Implicit Function
4
3
2

1
0
1
2

4
4

1
x

Figure 10: Typical members of the solution family [(x 1)2 /] + y 2 = 1 of the
differential equation (1 y 2 )dx = y(1 x)dy.

In separating the variables, we obtained an equation where we ruled out x = 1


and y = 1. Therefore, if we were interested in a particular solution curve
passing through any of the points (1, y0 ), (x0 , 1) or (x0 , 1), we could not find
the curve using the solution we have just found, even if such particular solution
exists! Instead, we would need to go back to the original DE and look for the
required solution by using some other method. In this case, it is obvious that
23

Direction Field
5
4
3
2

1
0
1
2
3
4
5
4

1
x

Figure 11: Vector field of the differential equation (1 y 2 )dx = y(1 x)dy.

the equations x = 1, y = 1 and y = 1 are all solutions of the given DE and also
satisfy the conditions (1, y0 ), (x0 , 1), and (x0 , 1). None of these can be obtained
from our general solution, although x = 1 can be included by permitting = 0.
In this case, only y = 1 and y = 1 appear as singular solutions of the given DE.
All this is a consequence of the fact that the differential equation is non-linear.
Matlab code to draw the direction field
% s e t the a x i s range
a x i s ([ 4 6 4 4 ] )
% c a l c u l a t e gradient at these points
% ( want t o a v o i d v a l u e s o f x = 1 , y = 0 )
[ x , y ] = meshgrid ( [ [ 4 : . 5 : . 9 ] [ 1 . 1 : . 5 : 6 ] ] , [ [ 4 : . 5 : . 5 ] [0.5:0.5:4]]) ;
% f i n d t h e s l o p e o f t h e f u n c t i o n a t each p o i n t
dydx = (1y . 2 ) . / ( y .(1 x ) ) ;
% p l o t the s o l u t i o n
q u i v e r ( x , y , ones ( s i z e ( x ) ) , dydx . / abs ( dydx ) , 0 . 5 )
t i t l e ( ' Direction Field ' )
24

Direction Field and Solution


4
3
2

1
0
1
2

3
4
4

1
x

Figure 12: Vector field and solutions of the differential equation (1 y 2 )dx =
y(1 x)dy.

25

xlabel ( 'x ' ) ; ylabel ( 'y ' )

3.2

Application: Exponential growth and decay

Radioactive decay
Carbon in the atmosphere as CO2 (carbon dioxide) consists mostly of the
inert isotopes 12 C and 13 C with a small amount of radioactive 14 C.
14
C is produced in the upper atmosphere when N (nitrogen) is altered
through the effects of cosmic radiation bombardment. Being unstable it will
convert back to N after a period of time.
Living organisms absorb carbon from the atmosphere and so have 12 C, 13 C
and 14 C in the same ratio. After death, no more 14 C is absorbed. The old 14 C
slowly decays away, so the ratio of 14 C to 12 C slowly decreases.
If we know how this ratio decreases, we can use this to detect how long ago
the remains of something that was alive died, (e.g. bone, wood, rope, some
jewelry such as amber and coral).
Radioactive material decays at a rate directly proportional to the current
amount of material. This gives us a differential equation
dx
= kx
dt
where x > 0 is the amount of 14 C, t is the time measured in years and k is
the constant of proportionality. The growth rate is negative, expressing the fact
that we are looking at decay.
The general solution can be found by separating the variables:
dx
=
Z x
dx
=
x
ln(x) =
x =

kdt
Z
k dt
kt + C 0
0

ekt+C = Cekt

where C = eC .

Suppose now that the amount of 14 C at time t = 0 is x0 . This means that


C = x0 . After some time t1 , half of the initial amount will have decayed and so
half will remain. That is
x0
.
x1 =
2
Thus, since x1 = x0 ekt1 , then
x1 = x0 ekt1

ekt1

26

x0
2
1
.
2

Solving this equation for t1 gives:


kt1 = ln 2 t1 =

ln 2
.
k

Thus, the length of time for a radio-active material to decay to half its initial
amount depends only on the constant k (not on the initial amount x0 ). The
constant k varies from substance to substance. The length of time it takes for
half of a radio-active substance to decay is called halflife of the substance. Thus:
t1 = halflife =

ln(2)
k

so

k=

ln 2
.
halflife

So, the amount of radio-active substance left at any time t will be given by


x = x0 e

ln 2


t

halflife .

Application: Halflife

Figure 13: Human femurs: archeological discovery or police matter? (courtesy


of http://www.rkm.com.au)
We know that the halflife of 14 C is 5750 years. So if you find a bone (such
as a femur shown in Figure 13) that is measured to have 40% of the 14 C it
contained while it was still living, what is its age now? We can calculate what
the constant k for 14 C is:
k=

ln 2
ln 2
=
= 1.2055 104 .
halflife
5750
27

So, at a certain time t (to be determined) we will have:


x=

40
2
x0 = x0 .
100
5

2
x0 .
5
Solving this equation for t gives the time for the 14 C to fall to 40% of its initial
value:
ln(2) ln(5)
= 7, 601 years.
t=
1.2055 104
It looks like an interesting archeological discovery!
4

x = x0 ekt = x0 e1.205510

3.3

Application: Population growth

Population growth
We can apply the theory of differential equations to the study of how populations of life forms (people, bacteria ...) change in time.
Given no limiting conditions, such as predators or insufficient food or resources, it is generally true that a population will increase more rapidly as the
population becomes larger (there are more individuals available to procreate;
this might also ignore such factors as aging however).
The simplest assumption is that the rate of increase is proportional to the
population p(t) at any given time t, that is:
dp
= kp(t)
dt
Where the constant k is the relative growth rate. that is, if B is the birth
rate and D the death rate (both per head of population per unit time) then
k = (B D).
This is a very simple mathematical model of a biological system. However,
in modelling a real life system we usually have the problem that there are an
enormous number of factors that affect the system to a greater or lesser degree
and which should really be included in the model for a realistic and accurate
representation. On the other hand, if we include every possible factor we can
think of, we would end up with a mathematical system that would be impossible
to solve. Therefore we need to make assumptions about which factors are the
most important and which ones have negligible effect and can safely be ignored.
So, one normally starts with a very simple model (like the one above) and then
can introduce less important factors one or two at a time to see how they affect
the model.
This is what we have done above with our population model. We have
ignored all factors which might influence the growth rate other than the two
most obvious and simple ones. Some of the many factors we have ignored are:
Climatic effects, such as drought, which can make make birth and death
rates change with time.
28

Overcrowding, which may make the death rate rise or birth rate drop as
the population gets high.
There may be predators which eat our subjects. A change in the size of a
predator population will affect the death rate.
Our subjects may themselves be predator. A change in size of a prey
population will affect the birth and death rates.
Epidemics.
etc., etc., etc.
Later on in the course, we will build a more sophisticated model which take
some of these effects into account.

3.4

Application: Compound Interest

Compound Interest
Suppose that w(t) > 0 is the wealth in an account at time t and that r(t) is
the interest rate, with interest compounded continuously. Then
dw
= r(t)w.
dt
Using separation of variables we get
Z
w(t) = w(0) exp


r(s) ds .

3.5

Application: Pollution in Lake Burley Griffin

Pollution in Lake Burley Griffin


Some background on Lake Burley Griffin
Lake Burley Griffin was created artificially in 1956 for recreational and aesthetic purposes in Canberra (see Figure 14). In 1974 the public health authorities indicated that pollution standards set down for safe recreational use were
being violated, and this was attributed to the sewerage work in Queanbeyan (or
rather the discharge of untreated sewerage into the lakes feeder river).
After extensive measurements of pollution levels taken in the 1970s, it was
established that while sewerage plants (of which there are three above the lake)
certainly exacerbated the problem, there were significant contributions from
rural and urban run-off as well, particularly during summer rainstorms. These
were responsible for dramatic increases in pollution levels and at these times,
totally responsible to lifting the concentration levels above the safety levels

29

Figure 14: Canberra saw the future Lake Burley Griffin when the Molongo River flooded in 1956 (Picture courtesy of Reflections of Canberra:
http://www.act.gov.au/reflectionscd/reflect/intro.htm).

(interestingly, these safety levels are different for those who swim in the ACT
and those who swim in NSW).
We will formulate a simple model of this lake, and consider the concentration
of pollutant in the water as our dependent variable (the actual levels of pollution
are extremely complex involving chemical reactions, the temperature profile
written in the water column, the sediment at the bottom etc, but we will have
to ignore these).
The lake has a volume of 28.3 106 m3 and a mean flow rate of 4 106 m3
per month (for the summer months) and an average rate of 10 106 m3 per
month.
We would like to ascertain that if the authorities suddenly stopped all polluted flow into the lake, how long will it take for the concentration of pollutant
to decrease to 10% of its current level.
Model formulation
We have a schematic model shown in Figure 15.
Model assumptions
We need to make some assumptions on which our model will be based:
the lake is well stirred and the pollutant uniformly mixed throughout the
lake.
the flow rate out of the lake is equal to the flow rate into the lake - that
is the volume of the lake is constant.
30

Figure 15: Inflow and outflow of water/pollutant to/from Lake Burley-Griffin.

Let m = m(t) be the mass of the pollutant in the lake at time t, V be the
volume of the lake (which is constant) and F be the volume of mixture leaving
the lake per time interval.
Define c to be the concentration of the pollutant in the mixture, then
c=

m
,
V

which we expect to be a decreasing function in this problem (note that our


measurements need to be in the same units; an obvious aspect, but one easily
forgotten).

Figure 16: Diagram demonstrating the model formulation

Pollution equations
We need to establish the fundamental equation describing this process which
relates the change in mass of the pollutant to the water flows. We use the
31

conservation of mass. Let m denote the change of the pollutant mass in the
time interval t (ie from time t to t + t).
From the diagram in Figure 16 we have found that if no pollutant enters the
lake then m = FV m t. This can be re-written as:
m
F m
=
.
t
V
If we now let t 0 we establish
F m
dm
=
,
dt
V
which is a differential equation describing the continuous change of the mass
of a pollutant with time. We would like an equation describing the change of
concentration of the pollutant, so we will use c = m/V from above and change
the dependent variable in the differential equation as follows.
Since
m
c=
V
then
dc
1 dm
=
dt
V dt
so, from above we get
1 F
F c
dc
=

cV =
dt
V
V
V
and we have an equation for the rate of change of the concentration with respect
to time.
It is easy to solve the above DE using the technique of separation of variables.
dc
=
dt
dc
=
Z c
1
dc =
c
ln c =

Fc
V
F
dt
V Z
F

dt
V
F
t + const.
V

So we obtain:

Ft
Ft
c = e( V +const) = econst e V .
Using the initial condition c0 = econst , (c0 is the concentration at time
t = 0) we have:
Ft
c = c0 e V .

32

Pollution model applied to Lake Burley Griffin


We now use this model to solve the Lake Burley Griffin problem.
We had V = 28.3 106 m3 and F = 10 106 m3 per month and we wanted
to find t when c = 10%c0 .
So
c0
10
1
10
ln 10
t

Ft

= c0 e V
Ft

= e V
=
=

Ft
V

28.3 106
V
ln 10 =
ln 10 = 0.54
F
10 106 12

years.

(When the flow is low, F = 4 106 m3 /month and t increases to t = 2.30


years)
Model shortfalls
Note that this does not take into account regions of eddies or slow moving
pools caught in the topography of the lake, perhaps typically the more popular
swimming bays.
Summer pollution
Using some actual data measurements from the lake, during summer pollution levels have been measured to be 1000/100 ml, and the ACT safety standard
is set at 400/100 ml.
Using the model developed above, how long will it take (until no pollution
flowing into the lake) for the pollution level to drop to the safety standard.
In this case we want the time it would take for the concentration of the
pollutant to drop to 40% of its current level.
Now
0.4c0

t =

F /c

c0 e V
V
ln(2.5) = .22
F

years

(When the flow rate is low, F = 4 106 m3 per month, t increases to t = .54
years).
Formulation of the model with pollution entering the lake
We can easily extend this model to include pollution flowing into the lake.
We will assume that the concentration of the pollution entering the lake is
constant and denote it cin . Using the symbols and methods of the previous
formulation we have
m = cin F t cF t,

33

since the flow into the lake is assumed equal to the flow out of the lake.
If we now let t 0, we have
dm
= cin F cF
dt
and using again the change of variable c = m/V :
F
F
dc
= cin c .
dt
V
V
Make sure you can do this formulation (it is slightly different from the previous one) and then solve this differential equation using the separation of variables technique as we did for the previous example.
Under what conditions does this concentration increase to a steady-state
solution (t ), and what is this steady-state value?

34

Exact differential equations

4.1

Differentials

Exact equation
Definition 10 (Differential). If a function of u two variables x and y, u(x, y),
u
has continuous partial derivatives u
x and y over a simply connected region R
of the xy-plane, its differential is:
du =

u
u
dx +
dy.
x
y

Definition 11 (Exact equation). Thus, the differential equation


M (x, y)dx + N (x, y)dy = 0
is called an exact equation if the left-hand side is the differential of a function
u(x, y). That is,
du = M (x, y)dx + N (x, y)dy
where
M (x, y) =

u
x

and

N (x, y) =

u
.
y

If we can find such a function u(x, y) then


u(x, y) = constant
is a general solution of the differential equation.
4.1.1

Example: Exact equation

Example 13 (Exact equation).


dy
+y =0
dx
is exact, and its solution (check!) is
x

u(x, y) = xy = constant.
4.1.2

Theorem: Exact equation

Theorem 1 (Exact equation). If


N
x

and

M
y

are continuous over a simply connected region R of the xy-plane, then the differential equation
M (x, y)dx + N (x, y)dy = 0
is exact if and only if
N
M
=
.
x
y
35

Proof of theorem
We prove the above statements in order.
First, suppose that the differential equation M (x, y)dx + N (x, y)dy is exact
and lets see whether N/x = M/y.
We know that if the DE is exact, then
du = M (x, y)dx + N (x, y)dy
but also
du =
Therefore:
M (x, y) =

u
u
dy +
dx.
y
x

u
,
x

N (x, y) =

u
.
y

Thus,
M
2u
2u
N
=
=
=
y
yx
xy
x
Here, we could exchange the order of differentiation in the mixed derivatives because of our assumption of continuity. Thus, the only if part of the
theorem is satisfied.
Now we can prove that when N/x = M/y is satisfied, then we can find
a function u(x, y) such that du = M (x, y)dx + N (x, y)dy with M = u/x and
N = u/y.
To do this, we start with M (x, y) = u/x and integrate M (x, y) with
respect to x, holding y fixed. This gives
Z x
u(x, y) =
M (z, y) dz + k(y)
x0

where x0 is an arbitrary constant.


Since the integration is done with respect to x only, the integration constant is actually a function k of y to be determined! Thus, our proof is complete
if we can determine k(y) so that u/y = N (x, y).
To do so, lets now differentiate the above equation with respect to y:
Z x

u

=
M (z, y) dz + k(y)
y
y x0
Z x

dk(y)
=
M (z, y) dz +
y x0
dy
Z x
M (z, y)
dz + k 0 (y)
=
y
x
Z x0
N (z, y)
=
dz + k 0 (y)
z
x0
= N (x, y) N (x0 , y) + k 0 (y).

36

Note that we used the fact that M/y is continuous so that we could
interchange the integration with respect to x and the differentiation with respect
to y. We also used our original assumption N/x = M/y.
Thus, u/y will be equal to N (x, y), as required, provided that k 0 (y) =
N (x0 , y), that is:
Z
y

k(y) =

N (x0 , z) dz.
y0

Therefore, we have just shown that if N/x = M/y, then there is a


function u(x, y) such that
du =

u(x, y)
u(x, y)
dx +
dy = M (x, y)dx + N (x, y)dy.
x
y

Thus, this establishes the if part of the theorem and the proof is complete.
A general solution of the DE is:
u(x, y) = constant.

4.2

General solutions

Using exact equations to find a general solution


If the differential equation
M (x, y)dx + N (x, y)dy = 0
is exact, then a general solution u(x, y) = constant of the differential equation
can be found through
Z
u(x, y) = M (x, y)dx + k(y)
or through
Z
u(x, y) =

N (x, y)dy + l(x)

where the functions k(y) and l(x) are constants of integration.


To determine our general solution u(x, y) = c, we can use, for example the
first of the two equations above. That is, we perform the integral and then we
calculate u/y and compare it with N = u/y to find k(y). Once we know
k(y), we can obtain our general solution u(x, y) by adding the results. We can
determine u(x, y) by starting with the second equation and by finding l(x) in a
similar way.
This is all much better explained through an example!!

37

4.2.1

Example: General solutions

Example 14 (Exact and general solution). Show that the equation


(2x + 3y 2)dx + (3x 4y + 1)dy = 0
is exact and find a general solution.
Solution
First we have to show that this DE is exact. Here
M = 2x + 3y 2,

N = 3x 4y + 1.

So:
M
y
N
x

=
=

(2x + 3y 2)
=3
y
(3x 4y + 1)
=3
x

Since the two partial derivatives are equal, then the DE is exact.
A general solution is given by:
Z
u(x, y) =
M dx + k(y)
Z
=
(2x + 3y 2) dx + k(y)
=

(x2 + 3yx 2x) + k(y)

where k(y) is to be determined. To do so, lets differentiate u(x, y) with respect


to y:
u(x, y)
dk
= 3x +
.
y
dy
But we know that N = u(x, y)/y, so by comparing what we have just
obtained with N = 3x 4y + 1, we find:
3x +
Thus:

dk
= 3x 4y + 1.
dy
dk
= 4y + 1
dy

and
k = 2y 2 + y+constant.
Therefore, a general solution of the DE (check by differentiating!) is:
u(x, y) = (x2 + 3yx 2x) 2y 2 + y+constant = 0.

38

4.2.2

Application: Fluid flow past a cylindrical obstacle

Fluid flow past a cylindrical obstacle


The flow of fluids is defined by a velocity field, determined by a velocity vector ~v , whose components are the derivatives of the position vector with respect
to time t.
It is possible to show that the trajectories of a two-dimensional flow past a
cylinder of radius r = 1 are solutions curves of the system of DEs:
y 2 x2
(x2 + y 2 )2
2xy
= 2
(x + y 2 )2

dx
dt
dy
dt

1+

where ~r = (x, y) is the position vector of a given particle and ~v = (dx/dt, dy/dt)
the velocity at a given point.
If y(x) is the path of a particle, then, since
dy
dy dx
y
=
/
=
dx
dt dt
x
y satisfies the first-order DE:

 

dy
2xy
y 2 x2
= 2
/
1
+
dx
(x + y 2 )2
(x2 + y 2 )2
which can be written as:




2xy
y 2 x2
dx
+
1
+
dy = 0.
(x2 + y 2 )2
(x2 + y 2 )2
Hence,
M (x, y) =

2xy
(x2 + y 2 )2

N (x, y) = 1 +

y 2 x2
.
(x2 + y 2 )2

This differential equation is exact, that is, (check!!)


N
M
=
.
y
x
For a general solution
Z
u(x, y) =
So:

Z
u(x, y) =

M (x, y) dx + k(y).

2xy
dx + k(y).
(x2 + y 2 )2
39

To solve this integral lets set


v = x2 + y 2 ,

dv = 2xdx

so that
Z

2xy
dx
(x2 + y 2 )2

=
=

so
u(x, y) =

dv
y
=
v2
v
y
2
x + y2
y

y
+ k(y).
x2 + y 2

Lets now differentiate with respect to y:




u(x, y)

y
=
2
+ k(y)
y
y
x + y2
(x2 + y 2 ) 2y 2
dk(y)
=
+
(x2 + y 2 )2
dy
2
2
x y
dk(y)
= 2
+
.
2
2
(x + y )
dy
By comparing this to
N=
we find:

y 2 x2
u(x, y)
=1+ 2
y
(x + y 2 )2

x2 y 2
dk(y)
y 2 x2
+
=1+ 2
.
2
2
2
(x + y )
dy
(x + y 2 )2

So that

dk(y)
= 1.
dy

Thus

Z
k(y) =

dk(y)
dy = y + const.
dy

So the solution curves can be obtained by adding up the results:


u(x, y) =

y
+ y + const.
x2 + y 2

See Figure 17.


y
The solution to the ODE is x2 +y
2 + y + const = 0.
Some solution curves are shown in the figure below.

40

Figure 17: Some solution curves for a fluid flow past a cylindrical obstacle.

41

Then, if we take the symmetric fluid flow past a circular cylinder, we can
map it (in the complex plane) into the fluid flow past an asymmetric aerofoil.
In other words, under the appropriate transformation, a cross section of a fluid
around a cylinder transforms (or maps) in the complex plane onto a curve that
is shaped like the cross section of an aeroplane wing. See Figure 18. This curve
is called Joukowski aerofoil. This makes it possible to study the characteristics
of the air flow around an aeroplane wing. As I said, since such transformation
is done in the complex plane, I will not show you here how it is done.
Joukowski aerofoils have been used to build aircrafts, and even nowadays
aerodynamic engineers use these mathematical solutions as a frame of reference
to which they can compare, for validation, their more modern aircraft designs.
Note: Nikolai Joukowski (1847-1921) was the founder of aeromechanics in
Russia.

Joukowski Airfoil

1.5

0.5

-0.5

-1

-1.5
-2

-1

Figure 18: A Joukowski aerofoil.

42

4.3

Reduction to exact form: integrating factors

Integrating factors
Consider the DE
ydx + xdy = 0.
Here,
M = y

M
N
= 1 6=
= 1.
y
x

N = x;

So, the DE is not exact!


However, if we multiply it by 1/x2 (x2 6= 0):

x
y
dx + 2 dy = 0,
2
x
x

we get
M =

y
x2

N=

1
;
x

M
1
1
N
= 2 =
= 2.
y
x
x
x

Basically, we have done the following. We had a non-exact DE


P (x, y)dx + Q(x, y)dy = 0,
we multiplied it by a function F (x, y) to get an exact DE:
F (x, y)P (x, y)dx + F (x, y)Q(x, y)dy = 0.
The function F (x, y) is called an integrating factor.
There can be more than one function that make a non-exact DE become an
exact DE! In the above example, we could also have used:
F (x, y) =

1
,
x2

F (x, y) =

1
,
y2

F (x, y) =

1
,
xy

F (x, y) =

x2

1
.
+ y2

Try them all!


How do we find integrating factors?
So far so good... but how do we find these functions F (x, y) that make our
DE exact?
In some simple cases, one could find such functions by guessing.
Otherwise, we can use the exactness condition and see that
(F P )
y
F
P
P
+F
y
y

(F Q)
x
F
Q
= Q
+F
.
x
x

43

Now, this appears to be a rather difficult equation to solve to find F (x, y)!
However, we can find a solution to this equation in some special cases.
Thus, we look for an integrating factor that depends on one variable only,
either x or y. Lets start with F (x, y) = F (x). In this case:
P

F
P
+F
y
y
P
F
y
1 F
F x

F
Q
+F
x
x
F
Q
Q
+F
x
x


1 P
Q

.
Q y
x

=
=

and

We can calculate the RHS of the last equation quite easily. If, by doing so,
we get something that depends only on x, then our DE does have an integrating
factor F (x) and we can proceed as follows:


Z
Z
1 dF
1 P
Q
dx =

dx
F dx
Q y
x


Z
Q
1 P

dx
ln F =
Q y
x
And:

F (x) = e(

1
Q

Q
[ P
y x ] dx) .

We could have tried with an integrating factor F (x, y) = F (y). In this case,
we would get
(F P )
y
P
F
+F
P
y
y
P
F
P
+F
y
y
1 dF
F dy
Z
1 dF
dy
F dy
ln F (y)

(F Q)
x
F
Q
Q
+F
x
x
Q
F
and
x


1 Q P

P x
y


Z
1 Q P

dy
P x
y


Z
1 Q P

dy.
P x
y

=
=
=
=
=
=

And the integrating factor is:


F (y) = e(

1
P

P
[ Q
x y ] dy ) .

44

4.3.1

Example: Integrating factor

Example 15. Find a general solution of the following differential equation:


(2x2 + y)dx + (x2 y x)dy = 0
Solution
Here, we have:
M = 2x2 + y

N = x2 y x;

N
M
= 1 6=
= 2xy 1.
y
x

Lets try with a function F (x). To use the same notation that we used before
to look for integrating factors, lets set
P (x, y) = 2x2 + y,



Q
1 P

Q y
x

Q(x, y) = x2 y x.



1
(2x2 + y) (x2 y x)

x2 y x
y
x
1
[1 2xy + 1]
x2 y x
2(xy + 1)
x(xy + 1)
2
.
x

=
=
=
=

We have just obtained a function of x only, so the integrating factor is:


F (x) = e(

2
x

dx)

2
= e(2 ln |x|) = e(ln x ) = x2 .

We can now multiply our DE by the integrating factor that we have just
found to get:
x2 (2x2 + y)dx + x2 (x2 y x)dy
2

(2 + yx

)dx + (y x

)dy

Now this DE is exact and can be solved in the usual manner. Here
M (x, y) = 2 +

y
x2

N (x, y) = y

First integrate M (x, y) with respect to x:


Z
y
u(x, y) =
(2 + 2 ) dx + k(y)
x
y
= 2x + k(y).
x
45

1
.
x

Differentiate with respect to y:


u(x, y)
y

y

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

Compare what we have just found with N = y 1/x:

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

1
x

y
y2
+ const.
2

So,
u(x, y) = 2x

y2
y
+
+ const
x
2

and the general solution is


2x

y
y2
+
+ const = 0.
x
2

Note: By multiplying by the integration factor, we have lost the solution x = 0!!
So, we have to be careful when we change the original DE to make it exact.
4.3.2

Application: Economic growth of developing country

Economic growth of developing country


Consider the following model of economic growth in a developing country
X(t)

= K(t)

K 0 (t)

= X(t) + H(t),

where X(t) is the total production per year, K(t) is the capital stock (building
and equipments), and H(t) is the flow of foreign aid per year.
In the first equation we assume the production is proportional to the capital
stock. In the second equation we assume the total growth of capital per year
is equal to internal savings plus foreign aid. The internal savings are, inturn,
proportional to the production. The proportionality constants and are
positive.
To write the above system as a single differential equation, let H(t) = H0 et ,
where 6= . Then
dK
= K + H0 et ,
dt

46

or
(K + H0 et )dt dK = 0.
Let P = K + H0 et and Q = 1.
This equation is not exact. Check! So we need to find an integrating factor.
Try

 
Z
1 P
Q
F (t) = exp

dt
Q K
t
Z

= exp
dt
=

exp(t).

Multiply both sides of the above differential equation by the integrating


factor to get
(Ket + H0 e()t )dt dKet = 0.
Let M = Ket + H0 e()t and N = et . This equation is now
exact.
Then
Z
u(t, K) =
M dt + k(K)
= Ket +

H0
e()t + k(K).

Now,
u
K

= et + k 0 (K)
= N
= et .

So k 0 (K) = 0 and k = c where c is some constant.


Therefore, the solutions are equations of the form
Ket +

H0
e()t + c = 0,

or
K = cet +
4.3.3

H0
et .

Application: fluid flow along dipole-like field lines

Application: fluid flow along dipole-like field lines

47

This is another example of fluid flow. Consider the trajectories of a twodimensional flow given by the following system of DEs:
dx
dt
dy
dt

x2 y 2

2xy

where ~r = (x, y) is the position vector of a given particle and ~v = (dx/dt, dy/dt)
the velocity vector at a given point.
If y(x) is the path of a particle, we can write
dy
dy dx
y
=
/
= .
dx
dt dt
x
Thus, y satisfies the first-order DE:
2xy
dy
= 2
dx
x y2
which can be re-written as:
2xydx + (y 2 x2 )dy = 0
hence,
N (x, y) = y 2 x2 .

M (x, y) = 2xy,

This differential equation is not exact:


M
= 2x
y

N
= 2x.
x

6=

We can try to find an integrating factor. Lets try with a function of y:


F (y)

= e

P
[ Q
x y ] dy

1
P

1
2xy [2x2x] dy

= eR

= eR

4x
2xy
2
y

dy

dy

= e
= e2 ln |y|
= eln y

= y 2 .
Since the integrating factor is a function of y only, the DE can be reduced
to the exact form by multiplying it by F (y) = 1/y 2 .
2xy
(y 2 x2 )
dx
+
dy
y2
y2


2x
x2
dx + 1 2 dy
y
y
48

0.

Now we must find a general solution. Here


M (x, y) =

2x
y

N (x, y) =

x2
y2


.

Lets integrate M (x, y) with respect to x to find a general solution u(x, y):
Z
2x
u(x, y) =
dx + k(y)
y
x2
=
+ k(y).
y
Lets now differentiate with respect to y:
u(x, y)
y

x2
+ k 0 (y)
y y
x2
= 2 + k 0 (y).
y

But u(x, y)/y = N (x, y), so by comparing N = 1 xy2 with what we have
just found we get:

x2
x2
0
+
k
(y)
=
1

y2
y2
0
k (y) = 1
k(y)

y + const.

So a general solution is given by adding up the results:


u(x, y) =

x2
+ y + const
y

Some of the solution curves are shown in Figures 19, 20, 21 and 22.
The next figures show some astronomical applications of flow of matter along
dipolar field lines.

49

Figure 19: Some solution curves for a fluid flow along dipole-like field lines

Figure 20: A magnetically confined accretion flow in a strongly magnetic AM


Herculis-type system. Note the dipolar field lines closing on the stellar surface
(courtesy of http://www.rkm.com.au).

50

Figure 21: The ultra-massive, ultra-magnetic (109 Gauss) white dwarf star
EUVE J0317-855. Note the plasma trapped to flow along the magnetic field
lines of the star (courtesy of http://www.rkm.com.au).

Figure 22: Pulsar light-house effect. Charged particles flow along the dipolar
magnetic field lines producing radiation

51

First order linear differential equations

5.1

Definitions and notation

Linear differential equations


Definition 12 (Linear differential equation). A first order differential equation
is said to be linear if it can be written as:
y 0 + p(x)y = r(x).
This equation is linear in the unknown function y and its derivative y 0 =
The function p(x) and r(x) are any known functions of the variable x.

dy
dx .

Definition 13 (Homogeneous and non-homogeneous). If r(x) = 0 for all x in


the interval in which we consider the equation, then the equation is said to be
homogeneous. Otherwise, if r(x) 6= 0, it is said to be non-homogeneous.

5.2

Homogeneous equations

Homogeneous linear differential equations


If r(x) = 0 we have:
y 0 + p(x)y = 0
and since y 0 =

dy
dx ,

this can be written as


dy
= p(x)dx.
y

This is easy to solve! We can use the method of separation of variables.


Z
Z
dy
= p(x) dx
y
Z
ln |y| = p(x) dx + C 0
e

|y| =
y

Ce

p(x) dx+C 0
R

p(x) dx

where C 0 is a constant and C = eC when y > 0 and C = eC when y < 0.


Here, if C = 0 we get the trivial solution y(x) = 0.
5.2.1

Examples: Homogeneous equations

Example 16. Consider the differential equation


y 0 + 4xy = 0.

52

We can write this DE as:


dy
+ 4xdx = 0.
y
Here, p(x) = 4x. So the general solution is given by:
y(x) = Ce

4x dx

= Ce2x

See Figure 23.

y 0

-2

-4

-6

-8
-1.5

-1

-0.5

0
x

0.5

1.5

Figure 23: Some solution curves of the first order linear differential equation
dy/dx + 4xy = 0.

5.3

Non-homogeneous equations

Non-homogeneous linear differential equations


Consider again the differential equation:
y 0 + p(x)y = r(x).
now with r(x) 6= 0.
This can be written as:
dy
+ p(x)y = r(x).
dx
53

thus:
[p(x)y r(x)] dx + dy = 0.
The good news is that this DE has an integrating factor! Set
P = p(x)y r(x),

Q = 1.

Thus, we can re-write our differential equation in terms of P and Q:


P dx + Qdy = 0.

The integrating factor will be:


F (x)

= e(
R

= eR

= e
= e

1
Q

Q
[ P
y x ] dx)

P
y

dx

[p(x)yr(x)]
y

p(x) dx

dx

Lets multiply our DE by this integrating factor:


y 0 + p(x)y
e

p(x) dx

[y + p(x)y]

= r(x)
= r(x)e

p(x) dx

The LHS can be written as:


e
Thus:

p(x) dx

h R
i0
[y 0 + p(x)y] = ye p(x) dx .

h R
i0
R
ye p(x) dx = r(x)e p(x) dx .

By integrating with respect to x:


Z
R
R
ye p(x) dx = r(x)e p(x) dx dx + const
Set h =

p(x) dx and divide LHS and RHS by eh


Z

y(x) = eh
r(x)eh dx + const .

This is the general solution of our DE.

54

5.3.1

Examples: Non-homogeneous equations

Example 17 (Non-homogeneous linear differential equation). Consider the differential equation


y 0 + 3y = x.
Solution
Here, p(x) = 3 and r(x) = x.
Since the general solution is:
y(x) = e

R
p(x) dx

Z
r(x)e

p(x) dx

3 dx


dx + const

then
y(x)

= e

R
3 dx

= e3x

Z

Z

xe

dx + const

3x
xe dx + const .

To solve thisR integral we use


R the method of integration by parts.
Remember: udv = uv vdu.
Set
1
u = x, du = dx, dv = e3x dx, v = e3x .
3
So:
Z
Z
e3x
1
xe3x dx = x

e3x dx
3
3


1
e3x
e3x
1
e3x =
= x
x
.
3
9
3
3
And the general solution becomes:
y(x) =

5.3.2

x 1
+ Ce3x .
3 9

Application: Art forgery

Art Forgery
When Belgium was liberated in World War II, the hunt for Nazi collaborators
started. During the hunt, the Dutch painter H.A. Van Meegeren was arrested
in May 1945 and charged for selling a 17th century painting to Goering. This
painting, Woman taken in Adultery (see Figure 24) was allegedly executed by
the very famous Dutch painter Jan Vermeer. The sentence for treason was
death.

55

It was in July of the same year that Van Meegeren surprised the art world by
claiming not only that he had never sold Woman taken in Adultery to Goering,
but also that this painting was his own. And, as if this were not enough, he
stated that the very famous painting Disciples at Emmaus was also his own creation. He continued saying that he had forged another four paintings attributed
to Vermeer and two attributed to de Hooghs.

Figure 24: Painting of Woman taken in Adultery. (Credit: http://www.tnunn.


ndtilda.co.uk/vm3.htm.)

Most people believed that Van Meegeren was trying to save his head by
lying, but then he started reproducing in his prison cell a very famous painting
by Vermeer: Jesus Among the Doctors (Figure 25). This convinced most of
the skeptics and therefore the charge of treason was changed to that of forgery
carrying a one year prison sentence. At this point, Van Meegeren refused to age
the painting so that his aging secrets wouldnt be divulged to the whole world.
Van Meegeren was convicted in October 1947 and died in the same year of heart
attack.
Because of this refusal, the art world appointed an international panel made
up by chemists, physicists and art historians to settle once and forever the
question of whether these famous paintings were genuine or just forgeries.
At the end of their studies, the panel decided that the painting were not
genuine 17th century paintings, but forgeries. In particular, the analysis of the
pigments (colours) revealed the use of cobalt blue, which is a modern pigment,
totally unknown in the 17th century. They also found traces of phenoformaldehyde (discovered only in the 19th century) that Van Meegeren used to age his
paintings. This chemical was mixed into his pigments and then, by putting the
canvas in the oven, it hardened into bakelite, making the painting look old and
cracked.
56

Figure 25: Painting of Jesus among the Doctors. (Credit: http://www.tnunn.


ndtilda.co.uk/vm3.htm.)

However, even after all this, most art critics refused to believe that the
famous and beautiful Disciples at Emmaus (Figure 26) was a fake. Thus, the
noted art historian Bredius certified it as an authentic Vermeer and was sold to
the Rembrandt Society for US$ 170,000. This was a lot of money.
Finally, in 1967, scientists at Carnegie Mellon University took the matter
into their own hands. This is how they proved that Disciples at Emmaus was a
fake.
All paintings contain white lead. This pigment has been used by artists for
thousands of years. We know that all rocks on Earth contain a certain amount
of uranium, which decays into other radio-active substances, which, in turn, also
decay until they reach the lead stage, which is not radio-active. The uranium
has a half-life of more than 4 billion years and this element keeps on feeding the
radio-active decay chain.
The white lead used by artists contains a small amount of Pb210 , which is
a radioactive isotope of lead with half-life of only 22 years. Lead is extracted
from ores containing uranium and other elements produced by the decaying
of uranium, such as Radium 226 (Ra226 ), whose half-life is 1,600 years. Ra226
decays into Pb210 . The amount of Pb210 in the ore is in radio-active equilibrium
with the amount of Ra226 . This means that in the ore the amount of Ra226
decaying into Pb210 is the same as the amount of Pb210 decaying into inert
lead. During the process of extraction of lead from the ore (smelting), up to
95% of the radium and all its descendents are removed. Thus, Pb210 is not
in radioactive equilibrium with Ra226 and thus starts decaying very fast, until
balance is reached again between Pb210 and the residual amount of Ra226 (about

57

Figure 26: Painting of Disciples at Emmaus. (Credit: http://www.tnunn.


ndtilda.co.uk/vm3.htm.)

5% of original).
Now we want to calculate the amount of Pb210 present in the painting in
terms of the original amount present when it was manufactured.
If y(t) is the amount of lead Pb210 per gram of white lead at time t, y0 is the
amount of lead Pb210 at time t0 (manufacturing time) and r(t) is the number
of disintegration of Ra226 per minute per gram of white lead paint at time t. If
k the constant of decay for Pb210 , then:
dy(t)
= ky(t) + r(t).
dt
This is a first order non-homogeneous linear differential equation of the type:
y(t)0 + p(t)y(t) = r(t).
whose solution is:
y(t) = e

R
p(t) dt

Z
r(t)e

p(t) dt


dt + const .

In our problem, p(t) = k. Also, since the half-life of Ra226 is much much
longer that of Pb210 (1,600 years against 22), we can take r(t) constant over
a period of about 300-400 years, which is the maximum age which could be

58

attributed the painting. Therefore r(t) = r and:


Z

R
R
k dt
k dt
y(t) = e
re
dt + const
 Z

kt
kt
= e
r e dt + const
hr
i
= ekt ekt + const
k
i
hr
+ const ekt .
=
k
At t = t0 :
y(t0 ) =
Thus:

hr
k

i
+ const ekt0 .

h
ri
const = ekt0 y0 .
k

And the solution is:


y(t)

=
=

h
ri
r
+ ekt0 y0 ekt
k h
k
r
r i k(tt0 )
+ y0
e
.
k
k

The value of k is known and we can measure the values that y(t) has today.
So, if we know y0 we can then determine t t0 and establish whether this is
closer to 300 or 0! But we do not know the value of y0 .... So, what do we do
now?
We said that in the ore, the amount of Pb210 is in radio-active equilibrium
with Ra226 , therefore there is no change in the amount of lead that is created
and is disintegrated. This means that in the ore, at the time of manufacturing
of the pigment:

dy
= ky0 + r0 = 0

r0 = ky0 .
dt t=0
Different ores contain different amounts of Ra226 . This amount depends on
where on Earth this ore was mined. The quantity r0 can vary from about 0.15
to 140 disintegrations per minute per gram of white lead.
Therefore, although we cannot deduce an accurate age of the painting, we
still can find out whether the painting is a fake by calculating the value of ky0
if we assume that the painting is, say, 300 years old. Set t t0 = 300 in our
solution and solve for ky0 :
r i 300k
r h
+ y0
e
y(t) =
k
k


ky0 = ky(t)e300k r e300k 1 .
59

The measured values of ky and r are 8.5 and 0.8 respectively. Thus, since
k = 3.151 102 , we get ky0 = r0 = 98, 150 disintegrations per minute per
gram of white lead, which is a huge value, well above what is expected in lead
ores (0.15-140). In fact, even the very rare ores with uranium contents of up to
3% would give a maximum of about 30,000 disintegrations per minute per gram
of white lead.
The Disciples at Emmaus is a fake.
The numerical simulation shown in Figure 27 also shows that the initial lead
content must be very high to get the current reading.
Matlab code to model the lead content given different initial conditions
M-file
% decay model
% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
f u n c t i o n rhs=ddecay ( x , y )
r = 0.8;
k = 3 . 1 5 1 E 2;
rhs = ky+r ;
Main routine
hold
g r i d on
% s e t t h e time i n t e r v a l
ts = 1 : 1 0 : 3 0 0 ;
% define a set of i n i t i a l conditions
y0 = 1 0 0 0 : 5 0 0 0 0 0 : 1 0 0 0 0 0 0 0 ;
% solve equation fo r d i f f e r e n t i n i t i a l conditions
n = l e n g t h ( y0 )
for i = 1:n
y0 ( i )
[ t , y ] = ode45 ( @ddecay , ts , y0 ( i ) ) ;
plot (t , log10 (y) )
end
% l a b e l the p l o t s
t i t l e ( ' Change i n l e a d c o n t e n t with d i f f e r e n t i n i t i a l conditions ' )
xlabel ( ' t ' )
60

ylabel ( ' log10 (y) ' )


hold

Change in lead content with different initial conditions


7

log10(y)

50

100

150
t

200

250

300

Figure 27: Change in lead content with different initial conditions

5.3.3

Application: Radiation transfer

Radiation Transfer
Consider radiation of intensity I that is propagating along the xaxis through
matter in an astronomical object. This matter absorbs the radiation impinging
on it at a rate I per unit volume and also emits blackbody radiation according to Plancks law at a rate B per unit volume. See Figure 28. Here, is
the density of the matter, its opacity and B is the Planck function. All these
quantities are functions of x. The intensity of radiation I satisfies the equation:
dI
= (I B).
dx
which can be written as:

dI
+ I = B.
dx

To find the general solution, we note that the differential equation is nonhomogeneous, of the type:


dy
y 0 + p(x)y = r(x)
y0 =
dx
61

Figure 28: Radiation transfer through a slab of matter

with the general solution


y(x) = eh
where h =
Since

Z

r(x)eh dx + const

p(x) dx.
p(x) =

and

r(x) = B

the general solution is given by


I(x) = e

dx

Z
Be

dx


dx + const .

As noted before, , and B are all functions of x. However, we can try to


understand the mathematical and physical meaning of the above equations by
assuming that , and B are constants and can therefore be taken out of the
integral sign. This assumption is correct if we consider short paths over which
these quantities dont change much with x.
In this case


Z
R
R
dx
dx
I(x) = e
B e
dx + const


Z
x
x
= e
B e
dx + const


1 x
x
= e
B e
+ const

= ex [Bex + const]
= B + const ex .
If the incident radiation is I(0) = I0 , then
I0 = B + const const = I0 B.
So, the solution is:
I(x)

= B + (I0 B)ex

= I0 ex + B 1 ex .
62

(2)

This means that the incident radiation I0 is attenuated by ex as it goes


through a slab of matter of thickness x and that the radiation emitted by the
slab itself is also attenuated by 1 ex as it goes through the matter.
See Figure 29.

Figure 29: Supernova precursor.

5.4

Reduction to linear form. Bernoulli equation

Bernoulli equations
In some cases, it is possible to convert non-linear DEs into linear DEs. The
most famous of these reducible equations is Bernoulli Equation:
y 0 + p(x)y = g(x)y a
where a is any real number.
You can see immediately that if a = 0 or a = 1 the DE is linear, otherwise
it is not. In this case, we set
u(x) = [y(x)]1a .

Lets differentiate this:


u0

(1 a)y a y 0

(1 a)y a (gy a py)

(1 a)(g py 1a )

(1 a)(g pu)

(1 a)g + (a 1)pu
63

thus:
u0 + (1 a)pu = (1 a)g
which is now linear and can be solved through the method we saw earlier for
non-homogeneous linear DEs.
5.4.1

Example: Bernoulli equations

Example 18. Consider the differential equation


y 0 3y = 5xy 3 .
Solution
This is Bernoulli equation with a = 3, p(x) = 3 and g(x) = 5x.
We want to make this equation linear, so we have to make a change of
variables by setting
u(x) = [y(x)]1a = y 2
and
u0 + (1 a)pu = (1 a)g.
Thus:
u0 + 6u = 10x.
We can now solve this DE using the method we learnt earlier. Remember
that the general solution is given by:
Z

R
R
p(x) dx
p(x) dx
u=e
r(x)e
dx + C .
Here, p(x) = 6 and r(x) = 10x. So
Z

R
R
u = e 6 dx
10xe 6 dx dx + C
Z

= e6x
10xe6x dx + C .
To solve this
R integral we use the method of integration by parts. Remember:
f dg = f g gdf .
Set
1
f = x, df = dx, dg = e6x dx, g = e6x .
6
which gives (check!):


10 6x
6x
6x 10
u = e
xe e + C
6
36
5
5
=
x
+ Ce6x .
3
18
R

64

Now we must remember that right at the beginning we set


u = y 2
in order to linearise the original DE. So the general solution to the original DE
will be given by:
5
5
y 2 = x
+ Ce6x .
3
18
In this equation we have lost the solution y = 0, since we divided the original
DE by y 3 !!
Figure 30 shows some solution curves.

y(x) 0

-1

-2

-0.5

0.5

1.5

Figure 30: Some solution curves of the differential equation y 0 3y = 5xy 3 .

5.4.2

Application: the logistic equation

The logistic equation


As a model for the growth of a population, the simple exponential growth
we saw earlier (also called the Malthusian law of population growth):
dx
= kx
dt
65

is satisfactory, as long as the population is not too large.


It becomes inaccurate as the population grows larger and overcrowding sets
in, when competition for resources such as food, space and so on starts to limit
the growth rate.
We now extend our model and apply it to the population growth of rabbits,
see Figure 31.

Figure 31: The rabbits in Australia are an example of a fast growing population!
The rabbit is well suited to Australia - from as few as 24 rabbits bred by
Thomas Austin near Winchelsea, Victoria (1859) we had easily more than a
billion rabbits by 1900!
We modify our model to allow for larger populations. One way to do this is
to add a term to represent overcrowding.
dx
= kx bx2 ,
dt
(the idea being that the average number of encounters of two individuals per
unit time is proportional to x2 ).
This is the logistic equation. This equation is not linear (because of the x2
term) and can be solved either by using the technique of separation of variables
or by noting that it is of the Bernoullis type. We will use the latter.
We can rewrite the last equation as
x0 kx = bx2 .
Here, the independent variable is the time t and the dependent variable is
the population of rabbits x, p(t) = k, and g(t) = b and a = 2. We have to
make a change of variable. We set
u(t) = [x(t)]1a = x1 .
So:
u0 + (1 a)pu = (1 a)g
66

u0 + ku = b.

The general solution is given by


Z

R
R
p(t) dt
p(t) dt
u=e
r(t)e
dt + C .
Here, p(t) = k and r(t) = b. So
u = e

k dt

Z
be

k dt

dt + C
 Z

= ekt b ekt dt + C


b kt
= ekt
e +C
k
b
+ Cekt .
=
k

Now we must remember that u =


x(t) =

1
x

1
=
u

so
b
k

1
,
+ Cekt

where C is a constant.
The interesting property of this equation is that the so-called braking term
bx2 stops the population of rabbits (or humans, for that matter!) to grow to
infinity. In fact, initially small populations (0 < x(0) < k/b) increase monotonically to k/b, whilst large populations (x(0) > k/b) decrease monotonically to
k/b. The term k/b is also called the carrying capacity of the ecological system
and reflects the fact that any ecological system can support only a certain number of inhabitants (rabbits in this case). Once the population has reached the
carrying capacity, the population should hold steady (neither grow nor shrink).
See Figure 32 for the solution curves.
But what about people? In Figure 33 we can compare solution curves obtained with the simple exponential law and with the logistic equation. The data
are from the USA census.
Separation of variables to find the general solution of the Logistic
Equation
The logistic equation can be solved also by using the separation of variables
method. Lets see how.
The logistic equation is
dx
= kx bx2 .
dt
If we write m = k/b, we can rewrite the last equations as

dx
x
= kx 1
.
dt
m
67

Figure 32: Some solution curves to the logistic equation.

Lets apply the separation of variables method:



x
dx
= kx 1
.
dt
m
We can write:

then:

dx
x 1
Z

dx
x 1

x
m

 = kdt,
Z

x
m

=

kdt.

The right hand integral gives:


Z
k dt = kt + C
where C is a constant of integration.
The left hand integral is (using the partial fraction method):
Z
Z
dx
1
1

=
+
dx
x
x mx
x 1 m


x
0

+ C0
= ln |x| ln |m x| + C = ln
m x
68

Figure 33: Some solution curves for exponential law and logistic equation compared to data from the USA census.

69

where C 0 is another constant of integration.


So:


x

+ C 0 = kt + C
ln
m x


x

= kt + C 00
ln
m x


x
00
kt+C 00


= eC ekt
m x = e
where C 00 = C + C 0 is another constant.
00
Since eC is also a constant, we can write:
x
= Aekt ,
mx
00

where A = eC .
Now we can solve for x:
x = (m x)Aekt

= mAekt xAkt

x(1 + Aekt )

= mAekt
mA
.
=
A + ekt

If we now substitute m = k/b, the solution becomes:


x=

b
k

1
+ Dekt

where D is a constant.
The result is the same as before. Which method do you think is easier to
apply?

5.5

Electric circuits

Electric circuits
This is a very brief introduction to electric circuits. In the electric circuits
world, the most important laws are Kirchoffs laws. So, we will talk about voltages, currents, resistors, capacitors, etc. But first of all... What is a current?
A current is the rate of flow of charges measured in coulomb per unit time
crossing a certain surface, such as the cross-section of a wire. That is:
I=

dQ
.
dt

Current is measured in amperes and the time is in seconds. 1 ampere corresponds to the flow of one coulomb per second. Charges are carried by electrons
70

(negative charge of 1.6 1019 coulomb) and protons (of equal but positive
charge).
Charges flow between two points (thus producing a current) because of the
difference in voltage between these two points. The voltage is measured in volts
with a voltmeter.
The simplest electric circuit is a series circuit and consists of a source of
electric energy (electromotive force), such as a generator or battery and a resistor
which uses energy (e.g. a light bulb).
If we close the circuit, the current I through the resistor will cause a voltage
drop. This means that the electric potential at the two ends of the resistor
is different. The voltage drop ER across the resistor is proportional to the
instantaneous current I.
Definition 14 (Ohms law).
ER = RI.
where the constant of proportionality R is called the resistance and is measured
in ohms.
Physically, a resistor is a device often made of carbon which has a certain
specified resistance (20, 50, 100 whatever ohms).
Electric circuits also have inductors and capacitors.
The voltage drop EL across an inductor is proportional to the time rate of
change of current through it:
dI
EL = L
dt
where the constant of proportionality L is called the inductance of the inductor
and is measured in henrys. An inductor often consists of a coil of wire.
A capacitor stores energy and the voltage drop is proportional to the instantaneous charge Q on the capacitor:
Q
C

EC =

where C is called the capacitance and is measured in farads. Since


dQ
dt

I(t) =
then
EC =

1
C

I( )d.
t0

Now that we know about the various elements, we can determine the current I in a circuit by solving the equations resulting from the applications of
Kirchoff s voltage law and Kirchoff s current law.
Definition 15 (Kirchoffs voltage law). Kirchoff s voltage law states that the
algebraic sum of the voltage drops around any closed loop of a circuit is zero.
71

That is, if we consider the RLC-circuit shown in Figure 34, then


(Va Vd ) + (Vb Va ) + (Vc Vb ) + (Vd Vc ) = 0.
If E(t) is the externally imposed drop in voltage (electromotive force), which
is provided by a generator or battery, then:
E(t) = (Vd Va ) = (Vb Va ) + (Vc Vb ) + (Vd Vc ).

Figure 34: An example of a closed circuit

Definition 16 (Kirchoffs current law). Kirchoff s current law states that at


any point, the algebraic sum of the currents flowing in is the same as the currents
flowing out. That is, (see Figure 35):
I1 + I2 = I3 + I4 + I5 .

5.5.1

Example: RL-Circuit

Example 19 (RL-Circuit). A diagram of a RL-circuit is shown in Figure 36.


The voltage drop across the resistor ER = RI, the voltage drop across the
inductor is EL = LdI/dt.
Thus, by Kirchoffs voltage law, their sum must be equal to the imposed
electromotive force E(t):
dI
L
+ RI = E(t)
dt
72

Figure 35: The current flowing into a node must the same as the current flowing
out

Figure 36: RL-circult

73

or

dI
RI
E(t)
+
=
.
dt
L
L

To find the general solution, we note that the differential equation is nonhomogeneous, of the type:
y 0 + p(t)y = r(t)
with the general solution
y(t) = e

Z

r(t)e dt + const

R
where h = p(t) dt. Note that in our problem, the independent variable is now
the time t, not x!
Since
R
E(t)
p(t) =
and r(t) =
.
L
L
Then general solution is given by
Z

R
E R R dt
R
dt
L
L
I(t) = e
e
dt + const
L
Z

E Rt
R
t
L
L
= e
e dt + const .
L

Case A: Electromotive force is constant


If the electromotive force is constant E = E0 , then


Z
R
R
E0
I(t) = e L t
e L t dt + const
L


R
E0 L R t
= e L t
e L + const
L R


R
E0 R t
= e L t
e L + const
R
R
E0
=
+ const e L t .
R
As you can see

lim


E0
E0
t
R
L
+ const e
=
.
R
R
R

We call the term ER0 the steady-state solution and the term const e L t the
transient part of the solution. In practical terms, this means that after a certain
time, the current will be constant equal to ER0 , independently of the initial value
of the current I0 . Before reaching the steady-state, a circuit is in the transient
74

state. These transient periods in electric circuits occur because elements such
as inductors and capacitors store energy. This means that a variation in electromotive force cannot have an instant circuit response, since inductor currents
and capacitor voltages delay such a response.
t
The transient part decays on a time scale t = L/R, because of the term e t

in the solution. The quantity t = L/R is called the inductive time constant of
the circuit.
If the value of the current at t = 0 is I(0) = I0 , then the solution to the
initial value problem
L

dI
+ RI = E(t)
dt

I(0) = I0

can be obtained by setting t = 0 and I = I0 in the general solution:


I(t) =

R
E0
+ const e L t
R

which gives
I0 =

E0
+ const
R

const = I0

E0
.
R

Thus the particular solution is


I(t)


E0
+ I0
R

E0
+ I0
R

=
=


R
E0
e L t
R

t
E0
e t .
R

Note again the transient term that decays on a time-scale t .


We show in Figure 37 some solution curves obtained for different initial conditions. Note the approach to the steady-state I(t) = ER0 . The other parameters
are: L=0.2 henry, R=10 ohms and E0 =12 volt (battery).
Case B: Electromotive force is periodic
If we now have an electromotive force that is periodic, that is:
E(t) = E0 sin(t)


Z
R
R
E0
I(t) = e L t
sin(t)e L t dt + const .
L
Lets solve the integral:
Z

sin(t)e L t dt.

This
R integral can be solved through integration by parts (Remember:
U V V dU ).
75

U dV =

0.02

0.04

0.06

0.08

0.1

0.12

0.14

Figure 37: Some solution curves for the current I(t) in a RL circuit obtained
with different initial conditions and a constant electromotive force.

76

Set
U = sin(t),

dV = e L t

so:
dU = cos(t),

V =

L Rt
eL .
R

And:
Z
sin(t)e

R
Lt

dt

=
=

Z
R
L
L Rt
t
L
sin(t)e
e L cos(t) dt
R
R
Z
R
R
L
L
e L t cos(t) dt.
sin(t)e L t
R
R

Lets apply integration by parts again:


U = cos(t),

dV = e L t

so:
dU = sin(t),

V =

L Rt
eL
R

and:
Z
e

R
Lt

cos(t) dt

Z
L Rt
L Rt
L
e L ( sin(t)) dt
= cos(t) e
R
R
Z
R
L Rt
L
cos(t)e L t +
e L sin(t) dt
=
R
R
Z
R
R
L
L
=
cos(t)e L t +
e L t sin(t) dt.
R
R

Now, the integral on the RHS is identical to the integral we started with, so
we can solve for this integral as follows:
Z
R
R
L
sin(t)e L t dt =
sin(t)e L t
R


Z
R
R
L L
L
t
t
L
L

cos(t)e +
e sin(t) dt ,
R R
R



Z
R
L2 2
L Rt
L
t dt
L
L
1+
= e
sin(t)
cos(t) ,
sin(t)e
R2
R
R
Z
R
R [R sin(t) L cos(t)]
sin(t)e L t dt = Le L t
.
R2 + L2 2
Well, we have the solution of our integral, at last!!
Now we must remember where we started. It was:


Z
R
R
E0
I(t) = e L t
sin(t)e L t dt + const .
L
77

If we substitute the integral with its solution, we get:




R
E0 R t [R sin(t) L cos(t)]
I(t) = e L t
+
const
Le L
L
R2 + L2 2
R
[R sin(t) L cos(t)]
= E0
+ const e L t .
R2 + L2 2
Use now the following trigonometric identity:
"
#
p

2
2
sin x cos x =
+ p
sin x p
cos x
2 + 2
2 + 2
 
p

2
2
=
+ sin(x ),
= arctan

where in our case


= R,

= L

and

= arctan

L
.
R

We get the form that is usually seen in electrical engineering applications, that
is:
R
E0
I(t) =
sin(t ) + const e L t .
R2 + 2 L2
We note again that as t the exponential term goes to zero on a timescale t and the current will oscillate harmonically. In this case the steady-state
solution is the first term in the equation (which is oscillatory) while the transient
part is given by the exponential term.
When L = 0, the phase-angle = 0 and the oscillations of the current I(t)
are in phase with those of the electromotive force E(t) (in general they are not).
We show in Figure 38 one of these solution curves.
5.5.2

Example: RC-Circuit

Example 20 (RC-Circuit). A diagram of a RC-circuit is shown in Figure 39.


Rt
The voltage drop across the capacitor is EC = Q/C = t0 I( ) d /C, the
voltage drop across the resistor is ER = RI. Thus, by Kirchoffs voltage law,
their sum must be equal to the source of electric energy, which is the electromotive force E(t), which is a continuous function of time:
Z
1 t
I( ) d + RI = E(t)
C t0
or, by eliminating the integral:
dI
1
+ I
dt
C
dI
1

+
I
dt
RC
R

78

=
=

dE(t)
dt
1 dE(t)
.
R dt

1.5

0.5

10

15

20

25

30

35

-0.5

-1

Figure 38: A solution curve for the current I(t) in a RL circuit obtained with a
periodic electromotive force.

Figure 39: An example RC-circuit

79

We must find the general solution of this differential equation.


We note that the differential equation is first order and non-homogeneous,
of the type:
y 0 + p(t)y = r(t)
with the general solution
y(t) = e
where h =
Since

Z

r(t)e dt + const

p(t) dt.

1
RC
the general solution is given by
p(t) =

I(t)

and

1
RC

e RC t

1
R
Z

dt

1
R

r(t) =

1 dE(t)
R dt

Z

dE R 1 dt
e RC dt + const
dt

dE 1 t
RC
dt + const .
e
dt

Case A: Electromotive force is constant


If the electromotive force is constant E = E0 , then
dE(t)
=0
dt
and the solution becomes:
I(t) =

t
1
const e RC .
R

Note that the time constant is now t = RC.


Case B: Electromotive force is periodic
If we now have an electromotive force that is periodic, that is:
E(t) = E0 sin(t).
Then

dE(t)
= E0 cos(t).
dt
And the solution becomes:
Z

R 1
dE R 1 dt
RC
dt 1
RC
e
dt + const
I(t) = e
R
dt
Z

1
1
RC
t E0
t
RC
= e
cos(t)e
dt + const .
R
80

This can be solved using the method of integration by parts (I omit the
evaluation of the integral here!!). The general solution is:


t
E0 C
1
I(t) = p
sin(t ) + const e RC , = arctan
.
RC
1 + (RC)2
We have again that as t the exponential term (the transient term) will
go to zero and the current will oscillate harmonically.

81

Second order homogeneous linear differential


equations

6.1

Definitions and notation

Definition 17 (Second order linear differential equation). The following differential equation:
y 00 + p(x)y 0 + q(x)y = r(x)
which we can also write as
dy
d2 y
+ p(x)
+ q(x)y = r(x)
dx2
dx
is a second order linear differential equation. This equation is linear in the
dependent variable y and its derivatives.
As in first order linear DEs, second order linear DEs are homogeneous if
r(x) = 0 and non-homogeneous if r(x) 6= 0.
6.1.1

Homogeneous differential equations

Linear combinations
Theorem 2 (Linear combination of solutions). Let y1 and y2 be linearly independent solutions to the homogeneous equation:
y 00 + p(x)y 0 + q(x)y = 0.
Then any linear combination
c1 y1 + c2 y2
with c1 and c2 are constants is also a solution of the DE.
Proof
Since y1 (x) and y2 (x) are solution of
y 00 + p(x)y 0 + q(x)y = 0
then
y1 (x)00 + p(x)y1 (x)0 + q(x)y1 (x)

0,

y2 (x)00 + p(x)y2 (x)0 + q(x)y2 (x)

0.

If we multiply the first equation by c1 and the second by c2 and add, we get:
c1 y1 (x)00 + c2 y2 (x)00 + p(x) [c1 y1 (x)0 + c2 y2 (x)0 ]
+q(x) [c1 y1 (x) + c2 y2 (x)] = 0
Note that this theorem does not hold for non-homogeneous linear equations
(or non-linear equations)!
82

6.1.2

Example: Linear combinations

Example 21 (Linear combination of solutions). Consider the following homogeneous linear differential equation
y 00 6y 0 + 9y = 0.
The functions
y1 (x) = e3x

and

y2 (x) = xe3x

are solutions of the above DE.


Lets multiply them by any constants. For example, lets multiply the first
by 2 and the second by 5 and take their sum.
y(x) = 2e3x + 5xe3x .
Solution
Lets now verify that this is also a solution to y 00 6y 0 + 9y = 0.
 3x
00

0


2e + 5xe3x 6 2e3x + 5xe3x + 9 2e3x + 5xe3x

0
= 11e3x + 15xe3x 66e3x 90xe3x + 18e3x + 45xe3x
= 48e3x + 45xe3x 66e3x 90xe3x + 18e3x + 45xe3x
= 0.

6.1.3

General solution

General solutions
A general solution of a first order differential equation had an arbitrary
constant c in it and an Initial Value Problem had one initial condition y(0) = y0 .
This initial condition allowed us to determine the constant c and thus to obtain
the solution to the IVP.
In second order linear differential equations, a general solution consists of a
linear combination of two suitable solutions y1 and y2 :
y(x) = c1 y1 (x) + c2 y2 (x)
where c1 and c2 are two arbitrary constants.

6.2

Initial Value Problems

IVP
For second order homogeneous linear differential equations an initial value
problem consists of the DE together with two initial conditions:
y 00 + p(x)y 0 + q(x)y = 0,

y(x0 ) = K0

and y 0 (x0 ) = K1 .

With these initial conditions we can find the values of the constants c1 and
c2 and thus a particular solution to the DE.
83

6.2.1

Example: Initial value problems

Example 22. Consider again the second order homogeneous linear differential
equation we saw in the previous example now with two initial conditions:
y 00 6y 0 + 9y = 0,

y(0) = 0,

y 0 (0) = 1.

Solution
The general solution is
y(x) = c1 e3x + c2 xe3x .
Since:
y 0 (x) = 3c1 e3x + c2 e3x (1 + 3x)
we can determine the value of the constants from the initial conditions:
y(0) = c1 = 0.
y 0 (0) = 3c1 + c2 = c2 = 1.
c1 = 0,

c2 = 1.

Thus, the solution to the initial value problem is:


y(x) = xe3x .

6.3
6.3.1

Method of reduction of order


Basis

Basis solutions
Definition 18 (Basis solutions). A basis of solutions of a second order homogeneous linear differential equation
y 00 + p(x)y 0 + q(x)y = 0
on a certain interval I is a pair of linearly independent solutions y1 (x) and y2 (x)
of the DE on I.
A general solution is obtained through any linear combination of y1 (x) and
y2 (x):
y(x) = c1 y1 (x) + c2 y2 (x).
A particular solution of the equation is then obtained by assigning values to
the constants c1 and c2 .
Remember: two functions y1 and y2 are linearly dependent on an interval
I if there exist two constants c1 and c2 , not both zero, such that
c1 y1 (x) + c2 y2 (x) = 0.

84

6.3.2

How to find one solution if the other is known

Finding both solutions


Given the second order homogeneous linear differential equation
y 00 + p(x)y 0 + q(x)y = 0
there is a method, called method of reduction of order that can be used to find
a basis if one solution is known. Lets see how we can do this.
Lets assume that we know y1 . To obtain a basis, we need a second linearly
independent solution y2 . Set
y2 = uy1
So:
y20

= u0 y1 + uy10

y200

= u00 y1 + 2u0 y10 + uy100

Lets substitute y2 , y20 and y200 into y 00 + p(x)y 0 + q(x)y = 0:


u00 y1 + 2u0 y10 + uy100 + p(u0 y1 + uy10 ) + quy1
00

u y1 + u

(2y10

+ py1 ) +

u(y100

py10

+ qy1 )

0,

0.

By assumption, y1 is a solution of the DE, so the last term in the equation above
must be equal to zero. Well have:
u00 y1 + u0 (2y10 + py1 ) = 0.
Lets divide by y1 :
u00 + u0

2y10 + py1
= 0.
y1

Now set v = u0 and v 0 = u00 :


v0 +

2y10 + py1
v = 0.
y1

This is a first order homogeneous linear differential equation. It can be solved


with the method of separation of variables.
2y 0 + py1
dv
+ 1
v = 0.
dx
y1
2y 0 + py1
dv
= 1
dx.
v
y1
Z
Z
dv
2y10 + py1

=
dx.
v
y1
Z
ln |v| = 2 ln |y1 | p dx.

85

v = exp ln |y1 |

R

e p dx
p dx =
.
y12

But v = u0 , therefore to obtain u, and hence y2 , we must integrate:


Z
u =
v dx
e

Z
=

p dx

dx.

y12

Thus
Z
y2 (x) = y1 (x)

6.3.3

p dx

y12

dx.

Example: Method of reduction of order

Example 23 (Method of reduction of order). Consider the differential equation


y 00 2y 0 + y = 0,
the function y1 = ex is a solution of this DE. We want to find a second linearly
independent solution.
Solution
We can use the reduction of order formula:
Z R p dx
e
dx.
y2 (x) = y1 (x)
y12
Here, y1 = ex and p(x) = 2. So:
Z R 2 dx
Z
e
x
x
y2 (x) = e
dx
=
e
dx = xex .
e2x
This is the second linearly independent solution of the DE.

6.4
6.4.1

Constant coefficients case


Characteristic equations

Characteristic equation
Consider the differential equation
y 00 + ay 0 + by = 0
where, a and b are now constants. If we can find two linearly independent
solutions y1 and y2 , then we can write a general solution in the form:
y = c1 y1 (x) + c2 y2 (x)
86

where c1 and c2 are arbitrary constants.


The differential equation suggests a solution of the form:
y = ex
since the derivatives of the above function are the function itself multiplied by
some constants.
Thus, lets substitute y = ex into y 00 + ay 0 + by = 0:
2 ex + aex + bex

ex 2 + a + b

since ex can never be zero, we can divide the above expression by this function
to obtain:
2 + a + b = 0.
This is called the characteristic equation or the auxiliary equation of the DE,
which is satisfied when

a + a2 4b
a a2 4b
,
2 =
1 =
2
2
so that the functions
y1 (x) = e1 x ,

y2 (x) = e2 x

are solutions of the DE.


We can have three different cases depending on the sign of the discriminant
a2 4b:
Case I: we have two real roots if a2 4b > 0.
Case II: we have one real double root if a2 4b = 0.
Case III: we have complex conjugate roots if a2 4b < 0.
Case I: two distinct real roots
If the characteristic equation has distinct real roots (a2 4b > 0), then
y1 (x) = e1 x ,

y2 (x) = e2 x

are linearly independent solutions of the differential equation y 00 + ay 0 + by = 0


and a general solution is given by:
y(x) = c1 e1 x + c2 e2 x
where c1 and c2 are arbitrary constants.
Example 24 (Characteristic equation - real roots). Find a general solution of
y 00 + 5y 0 + 4y = 0.
87

Solution
The characteristic equations is:
2 + 5 + 4 = 0.
Using the quadratic formula:

a + a2 4b
,
1 =
2

2 =

a2 4b
2

we obtain:
1 = 1,

2 = 4

and a general solution is:


y(x) = c1 ex + c2 e4x .

Case II: two repeated real roots


If the characteristic equation has two repeated real roots (a2 4b = 0), then
from:

a + a2 4b
a a2 4b
1 =
,
2 =
2
2
it is obvious that we get only one solution: 1 = 2 = = a2 and
y1 (x) = ex .
To obtain a second linearly independent solution y2 (x) we can use the method
of reduction of order which gives:
Z R p(x) dx
e
dx.
y2 (x) = y1 (x)
y1 (x)2
In our case, y1 = ex and p(x) = a, so:
Z R a dx
e
x
y2 (x) = e
2 dx
[ex ]
Z ax
e
x
= e
dx,
eax
Z
= ex dx
=

since =

xex .

Thus, a general solution is:


y(x) = c1 ex + c2 xex
where c1 and c2 are arbitrary constants.
88

a
2

Example 25 (Characteristic equation - repeated roots). Find a general solution


of:
y 00 + 4y 0 + 4y = 0.
Solution
The characteristic equation is
2 + 4 + 4 = 0,
and has a double root at = 2.
Thus a basis of linearly independent solutions is given by
y1 (x) = e2x ,

y2 (x) = xe2x

and a general solution is:


y(x) = c1 e2x + c2 xe2x
where c1 and c2 are arbitrary constants.
Case III: Complex Roots
Consider the homogeneous linear differential equation with constant coefficients
y 00 + ay 0 + by = 0.
If the characteristic equation
2 + a + b = 0
has a negative discriminant (a2 4b < 0) in:

a a2 4b
a + a2 4b
2 =
1 =
2
2
then it has complex roots.
Before proceeding, we have to remember that

i2 = 1
or
i = 1.
and (Eulers formula)
eiy = cos y + i sin y

and

eiy = cos y i sin y

Therefore, if z is a complex number (z = x + iy), then:


ez = ex+iy = ex eiy = ex (cos y + i sin y) .
Now, if the discriminant is negative, we can re-write the roots:

a + a2 4b
a a2 4b
1 =
,
2 =
2
2
89

as follows:
1

=
=
=
=
=

a2 4b
2
p
a + i2 (4b a2 )
2
a + i 4b a2
2

a i 4b a2
+
2
r 2
a
a2
+i b .
2
4
a +

For 2 :
r
a2
a
2 = i b .
2
4
If we now set =

q
b

a2
4

and = a2 :

1 = + i

and

2 = i.

We can now write:


v1 = e1 x

= e(+i)x
= ex (cos(x) + i sin(x))

and
v2 = e2 x

= e(i)x
= ex (cos(x) i sin(x)).

The above two solutions satisfy the DE, however they are complex.
We can find two real solutions by taking suitable linear combinations of the
above two solutions as follows. The first is obtained by adding the solutions and
dividing by 2:
v1 + v2
y1 =
= ex cos(x)
2
and the other by subtracting the two solutions and dividing by 2i:
y2 =

v1 v2
= ex sin(x).
2i

Note that y1 and y2 are the real and imaginary parts of e1 x (or of e2 x ).
Therefore we can summarise our results as follows. If the characteristic
equation has roots which are complex conjugates, 1 = + i and 2 = i,
then a general and real solution is given by:
y(x) = y1 (x) + y2 (x) = ex (A cos(x) + B sin(x))
90

where A and B are arbitrary constants.


However, be careful! If the constants a and b in the differential equation:
y 00 (x) + ay 0 (x) + by(x) = 0
are complex numbers, then the roots 1 and 2 of the characteristic equation
are also complex numbers (in general), but not complex conjugates of each other
(again in general). In this case a general solution is:
y(x) = c1 e1 x + c2 e2 x
where c1 and c2 are arbitrary constants which can be complex.
Example 26 (Characteristic equation - complex roots). Find a general solution
of the following DE:
y 00 + 4y 0 + 5y = 0.
Solution
The characteristic equation is:
2 + 4 + 5 = 0
with roots:
1 =

4 +

16 20
= 2 + i,
2

2 =

16 20
= 2 i.
2

and a general solution:


y(x) = ex (A cos(x) + B sin(x)) .
In our case, = 2 and = 1. Therefore:
y(x) = e2x (A cos(x) + B sin(x)) .

Matlab code to solve a second order equation


M-file. Note that the equation has to be rewritten as a collection of first
order equations.
% Complex r o o t s example
% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
f u n c t i o n rhs=dsecond1 ( t , y )
rhs = [ y ( 2 ) ; 4y ( 2 ) 5y ( 1 ) ] ;
Main routine

91

% s e t t h e time i n t e r v a l
ts = 0 : 0 . 1 : 3 ;
% define a set of i n i t i a l conditions
y0 = [ 1 ; 1 ] ;
% s o l v e the equation
[ t , y ] = ode45 ( @dsecond1 , ts , y0 ) ;
plot (t , y (: ,1) )
t i t l e ( ' C h a r a c t e r i s t i c Equation Example ' )
xlabel ( ' t ' )
ylabel ( 'y ' )
Figure 40 shows the solution if y(0) = y 0 (0) = 1.
Characteristic Equation Example
1.2

0.8

0.6

0.4

0.2

0.2

0.5

1.5
t

2.5

Figure 40: Example solution of a second order equation

6.4.2

Application: Mass-Spring System

Undamped system
An elastic string or spring obeys Hookes law. An elastic string can only be
stretched (when it is slack the tension is zero). A spring can be stretched or
92

compressed. See Figure 41.


The tension (restoring force) of a stretched string or the tension or thrust of
a spring is given by:
y
T =
= ky
a
where is the modulus of elasticity, a is the natural length and y is the extension
(positive for a string and positive or negative for a spring). If we set k = /a,
then k is called the spring constant or spring modulus.

Figure 41: The tension of a stretch string. a is the natural length and y is the
extension.
For a particle of mass m attached to the end of an elastic string in equilibrium
under gravity:
mg = T0 = kd.
For motion under gravity:
m

d2 y
dt2

= mg T
= mg k(y + d)

where d is the extension of the spring in equilibrium. See Figure 42


Since (from above)
mg
d=
.
k
Then
d2 y
k
= y
dt2
m
with general solution:
r
k
y(t) = A cos(0 t) + B sin(0 t),
0 =
.
m
93

Figure 42: The tension of a string with a mass m attached to the end. d is the
extension of the spring in equilibrium.

94

Or:
y(t) = C cos(0 t ),

C=

A2 + B 2 ,

tan =

B
.
A

The corresponding motion is called a harmonic oscillation.


Damped system
Lets connect now the mass to a device designed to damp vibrations, such
as a piston moving in a cylinder containing liquid (a dashpot). Engineers build
and use dashpots to damp vibration that could be causing either mechanical
failure or that could be uncomfortable to people experiencing them. The shock
absorbers in a car are a typical example where dashpots, consisting of an oil
filled device, are used to control spring oscillation in the suspension system.
Suspensions allow us to reduce as much as possible unwanted vibrations while
travelling on uneven roads. Each car wheel has at least one shock absorber.
What do the car in Figure 43 and the Rosetta landing probe shown in Figure
44 have in common (apart from the fact that they cost a fortune)?

Figure 43: A Lamborghini Murcielago (http://www.lamborghini registry.


com /Murcielago/2001/index.html)
.
The damping force has to oppose motion and therefore is linearly proportional to the velocity. That is:
Fdamp = cv = c

dy
= cy 0
dt

where v is the velocity and c the (positive) damping constant. This approximation is reasonable for small velocities.
The forces acting on the body of mass m are:
Ftot = Fgrav T + Fdamp .
Thus:
my 00 = ky cy 0 ,
95

Homepage > ESA Science missions > Our Missions > Under development > Exploring

jump to:

our Solar System > Rosetta

Rosetta - a comet ride to


solve planetary mysteries

Search

ESA INFO 1-2003

this section

8-Jan-2003 ESAs

Advanced Search

Artists impression of the


Rosetta orbiter and lander
approaching Comet Wirtanen

Rosetta orbiter will swoop


over the lander after
touchdown on Wirtanen

Rosettas lander on the


surface of Wirtanen

Rosetta will be the first mission to


orbit and land on a comet. Comets are icy bodies
that travel throughout the Solar System and develop
a characteristic tail when they approach the Sun.
Rosetta is scheduled to be launched on-board an
Ariane-5 rocket in January 2003 from Kourou,
French Guiana.
The decision on the
launch date will be
More about Rosetta
taken by Tuesday 14
ESA Information note no.
January 2003 (See
1-2003
Arianspaces press
Arianspaces press release
release number
03/02 of 7 January 2003
03/02 of 7 January
2003 or look at the web site
http://www.arianespace.com). The mission target is
Comet Wirtanen and the encounter will occur in
2011. Rosettas name comes from the famous
Rosetta Stone that, almost 200 years ago, led to the
deciphering of Egyptian hieroglyphics. In a similar
way, scientists hope that the Rosetta spacecraft will
unlock the mysteries of the Solar System.
Comets are very interesting objects for scientists
since their composition reflects how the Solar
System was when it was very young and still
unfinished, more than 4600 million years ago.
Comets have not changed much since then. By
orbiting Comet Wirtanen and landing on it, Rosetta
will collect essential information to understand the
origin and evolution of our Solar System. It will
also help discover whether comets contributed to
the beginnings of life on Earth. Comets are carriers
of complex organic molecules that, when delivered
to Earth through impacts, perhaps played a role in
the origin of living forms. Furthermore, volatile
light elements carried by comets may have also
played an important role in forming the Earths
oceans and atmosphere.
"Rosetta is one of the most challenging missions
ever undertaken so far," says Prof. David
Southwood, ESA Director of Science. "No one
before has attempted a simular mission, unique for
its scientific implications as well as for its complex
and spectacular interplanetary space manoeuvres."
Before reaching its target in 2011, Rosetta will
circle the Sun almost four times on wide loops in
the inner Solar System. During its long trek, the
spacecraft will have to endure some extreme
thermal conditions. Once it is close to Comet

96

Figure 44: Artists impression of the Rosettas lander on the surface of Comet
Wirtanen (Rosetta is an ESA space mission: http://sci.esa.int/).

or:
y 00 +

c 0
k
y + y = 0.
m
m

This is a second order homogeneous linear differential equation which has


characteristic equation:
k
c
2 + +
=0
m
m
with roots:
c
c
1 p 2
1 p 2
c 4mk,
2 =
c 4mk.
1 =
+

2m 2m
2m 2m

Set = c/2m and = c2 4mk/2m, so that:


1 = + ,

2 = .

There are three different cases:


(1) Over-damping
c2 > 4mk

2 distinct real roots

1 , 2 .

(2) Critical damping


c2 = 4mk

one real double root.

(3) Under-damping
c2 < 4mk

Complex conjugate roots.

Overdamping
If the damping constant c is large enough, then c2 > 4mk and we have two
distinct real roots with general solution:
y(t) = c1 e()t + c2 e(+)t .
For t > 0 both exponents are negative, since > 0 and > 0 and 2 =
k/m < 2 so that both terms tend to zero as t increases. This means that
for t large enough, the mass will be at rest at the equilibrium position y = 0
and there will be no oscillatory motion.
2

Critical damping
If c2 = 4mk, then = 0 and 1 = 2 = and the general solution is:
y(t) = (c1 + c2 t) et .
The exponential function can never be zero so y(t) can be equal to zero only
if c1 + c2 t = 0. This can happen at most once. But if the initial conditions are
such that c1 and c2 are both positive (or negative), then y is never equal to zero
and thus the body never passes through the equilibrium point. This case is a
borderline case between non-oscillatory motion and oscillatory motion (thats
why it is called critical).
97

Under-damping
If the damping constant is so small that c2 < 4mk, then the roots of the
characteristic equation are complex conjugate:
1 = + i ,
where

2 = i

4mk c2
=
2m

k
c2

m 4m2

and = c/2m.
The corresponding general solution is:
y(t)

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


= Cet cos( t )

where C 2 = A2 + B 2 and tan = B/A.


The cos( t ) varies between 1 and 1, so the solution curve (see Figure
45) lies between the curves
y = Cet

and

y = Cet

and touches them when cos( t ) is a multiple of . The frequency is /2


cycles per second. Also, the smaller c is, the largerp
is and thus the more

rapid the oscillations become. As c 0, 0 = k/m and the solution is


that corresponding to the harmonic oscillation (no damping).
6.4.3

Application: Euler-Cauchy equation

Euler-Cauchy equation
Definition 19 (Second order Euler-Cauchy equation). Consider the linear differential equation
x2 y 00 + axy 0 + by = 0
where a and b are constants. This is the Euler-Cauchy equation.
By looking at this DE, one may guess that a solution of the type y = xm
could solve it, since differentiation of y = xm gives y 0 = mxm1 and further
differentiation gives y 00 = m(m 1)xm2 . So, if we multiply y 00 by x2 and y 0 by
x the loss in the exponent will be compensated by the power of x.
We assume that x > 0. Results for x < 0 can be found by an appropriate
change of variable.
So, lets substitute
y(x) = xm
into the DE:
x2 [m(m 1)xm2 ] + ax[mxm1 ] + bxm = m(m 1)xm + amxm + bxm = 0

98

0.5

10

20
t

30

40

-0.5

-1

Figure 45: Damped oscillations: complex roots

so:
m(m 1) + am + b = 0.
This gives the auxiliary equation:
m2 + (a 1)m + b = 0
with roots:
m1 =

(a 1) +

(a 1)2 4b
,
2

m2 =

(a 1)

(a 1)2 4b
.
2

We have (again) three cases depending on the discriminant (a 1)2 4b:


Case I: we have two real roots if (a 1)2 4b > 0.
Case II: we have one real double root if (a 1)2 4b = 0.
Case III: we have complex conjugate roots if (a 1)2 4b < 0.
Case I: Two distinct real roots
Consider the linear differential equation
x2 y 00 + axy 0 + by = 0.
99

If the characteristic equation


m2 + (a 1)m + b = 0
has distinct real roots ((a 1)2 4b > 0), then the general solution is given by:
y(x) = c1 xm1 + c2 xm2
where c1 and c2 are arbitrary constants.
Example 27. Find a general solution of:
3x2 y 00 + 12xy 0 12y = 0.
Solution
Lets divide the DE by 3:
x2 y 00 + 4xy 0 4y = 0.
The auxiliary equation is
m2 + (a 1)m + b = 0.
Here, a = 4 and b = 4. Thus:
m2 + (4 1)m + b = m2 + 3m 4 = 0
with roots:
m1 =

3 +

32 + 16
= 1,
2

m2 =

32 + 16
= 4.
2

And the general solution is


y(x) = c1 x + c2 x4 = c1 x +
valid for all positive x.
Case II: Double root
Consider the linear differential equation
x2 y 00 + axy 0 + by = 0.
If the characteristic equation
m2 + (a 1)m + b = 0
has a double root ((a 1)2 4b = 0), then this is:
m=

1a
2

100

c2
x4

and the first solution is:


y1 = x

1a
2

We can find the second solution using the reduction of order method.
We set:
y2 (x) = uy1 (x)
so:
y20 (x) = u0 y1 + uy10 ,

y200 (x) = u00 y1 + 2y10 u0 + uy100 .

Now we substitute y200 and y20 into the DE:


x2 (u00 y1 + 2y10 u0 + uy100 ) + ax(u0 y1 + uy10 ) + buy1

00 2

u x y1 + u

x(2xy10

+ ay1 ) +

u(x2 y100

axy10

+ by1 )

0.

The last bit is equal to zero, since y1 is a solution to the DE. So we are left
with:
u00 x2 y1 + u0 x(2xy10 + ay1 ) = 0.
1a

Now we replace y1 = x 2 and its derivative y10 =


equation, then we separate the variables and we get:

1a (a+1)
2
2 x

1
u00
=
u0
x
ln |u0 | = ln x
1
u0 =
x
u = ln x
Therefore, since y2 = uy1 , the second solution is
y2 (x) = ln x y1 (x) = x

1a
2

ln x

and the general solution is:


y(x) = (c1 + c2 ln x)x(1a)/2
where c1 and c2 are arbitrary constants.
Example 28. Find a general solution of:
x2 y 00 + 5xy 0 + 4y = 0.
Solution
Here, a = 5 and b = 4. The characteristic equation is:
m2 + (a 1)m + b = m2 + 4m + 4 = 0.

101

in the above

This equation has a double solution for m = 2. Therefore, the two solutions
are:
ln x
1
y2 = 2 ,
x > 0.
y1 = 2 ,
x
x
The general solution is:
y(x) =

c1
ln x
+ c2 2
x2
x

x>0

where c1 and c2 are arbitrary constants.


Case III: Complex conjugate roots
Consider again the linear differential equation
x2 y 00 + axy 0 + by = 0.
If the characteristic equation
m2 + (a 1)m + b = 0
has complex roots ((a 1)2 4b < 0), then these are complex conjugate, that
is:
m1 = + i,
m2 = i.
Now, all we need is a trick! We will write:
i
xi = eln x
= ei ln x
and apply Eulers formula:
xm1

x xi = x ei ln x = x [cos( ln x) + i sin( ln x)]

m2

x xi = x ei ln x = x [cos( ln x) i sin( ln x)].

We can now find two real solutions by taking suitable linear combinations
of the above two solutions as follows.
The first is obtained by adding the solutions and dividing by 2:
y1 = x cos( ln x)
and the other by subtracting the two solutions and dividing by 2i:
y2 = x sin( ln x).
A general solution (for x > 0) is:
y(x) = x [A cos( ln x) + B sin( ln x)]
where A and B are arbitrary constants.
102

Example 29. Find a general solution of:


x2 y 00 + 5xy 0 + 5y = 0.
Solution
Here, a = 5 and b = 5. The characteristic equation is:
m2 + (a 1)m + b = m2 + 4m + 5 = 0.
This equation has complex conjugate roots:

4 + 42 20
4 42 20
m1 =
= 2 + i,
m2 =
= 2 i.
2
2
And a general solution (for x > 0) is:
y(x) =

1
[A cos(ln x) + B sin(ln x)]
x2

where A and B are arbitrary constants.

6.5

Existence and uniqueness theory

Uniqueness of solution for IVPs


Theorem 3 (Uniqueness of solution for IVPs). Consider the Initial Value Problem:
y 00 + p(x)y 0 + q(x)y = 0,
y(x0 ) = K0 ,
y 0 (x0 ) = K1 .
If p(x) and q(x) are continuous functions on some open interval I and x0 is
a point in I, then the above IVP has a unique solution y(x) on I.
6.5.1

Wronskian

Wronskian and linear independence of solutions


As you already know, a general solution of a second order homogeneous
linear differential equation
y 00 + p(x)y 0 + q(x)y = 0
in an open interval I consists of a linear combination of a pair of linearly independent solutions y1 and y2 .
If y1 and y2 are linearly independent then
c1 y1 (x) + c2 y2 (x) = 0
on I only if c1 = 0 and c2 = 0.
Conversely, y1 and y2 are linearly dependent on I if they are proportional.
This means that
y1 (x) = k1 y2 (x)

or
103

y2 (x) = k2 y1 (x)

where k1 and k2 are constants.


To establish whether two solutions y1 (x) and y2 (x) of the differential equation
y 00 + p(x)y 0 + q(x)y = 0
where p(x) and q(x) are continuous functions of x are linearly independent, we
can use the Wronski determinant (or wronskian). This is given by:


y y2

W (y1 , y2 ) = 10
y1 y20
where y10 (x) and y20 (x) are the first derivatives of the solutions.
Theorem 4 (Wronskian and linear independence of solutions). The two solutions y1 (x) and y2 (x) are linearly dependent in an open interval I if and only
if their wronskian is equal to zero at some point x = x0 in I. Furthermore,
it is possible to show that if W (y1 , y2 ) = 0 at any point x = x0 in I, then
W (y1 , y2 ) = 0 at all points in I. From this, it follows that if there exists a point
in I where W (y1 , y2 ) 6= 0, then y1 and y2 are linearly independent on I.
6.5.2

Example: Test of linear independence

Example 30 (Linear independence). Are the functions:


y1 (x) = ex ,

y2 (x) = xex

linearly independent solutions of the differential equation:


y 00 2y 0 + y = 0.
Solution
Their wronskian is
x
e
W (e , xe ) = x
e
x



xex
2x
2x

= e2x 6= 0
x
x = e (1 + x) xe
e + xe

since the wronskian is not zero, the two solutions are linearly independent and
the general solution is:
y(x) = c1 ex + c2 xex
where c1 and c2 are constants.
Existence of a general solution
Theorem 5 (Existence of a general solution). If p(x) and q(x) are continuous
over an open interval I, then the homogeneous linear differential equation
y 00 + p(x)y 0 + q(x)y = 0
has a general solution on I.
104

General solution
Theorem 6 (General solution). If p(x) and q(x) are continuous over an open
interval I, then every solution y(x) of the homogeneous linear differential equation
y 00 + p(x)y 0 + q(x)y = 0
on I, has the form:
y(x) = c1 y1 (x) + c2 y2 (x)
where c1 and c2 are constants and y1 and y2 are a basis of solutions on I
and the differential equation does not have any other singular solutions which
cannot be obtained from a general solution.

105

7
7.1

Non-homogeneous differential equations


Notation and definitions

Non-homogeneous differential equations


Definition 20 (Non-homogeneous differential equations). The following second
order linear differential equation:
y 00 + p(x)y 0 + q(x)y = r(x)
which we can also be written as
dy
d2 y
+ p(x)
+ q(x)y = r(x)
2
dx
dx
is non-homogeneous if r(x) 6= 0.
There are two relations between the solutions of the non-homogeneous DE
and the solutions of the associated homogeneous DE:
y 00 + p(x)y 0 + q(x)y = 0
(a) The difference of two solutions of the non-homogeneous DE on some open
interval I is a solution of the corresponding homogeneous DE on I.
(b) The sum of a solution of the non-homogeneous DE on I and a solution
of the corresponding homogeneous DE on I is a solution of the nonhomogeneous DE on I.
7.1.1

General solution and particular solution

Definition 21 (General solution). A general solution of the non-homogeneous


linear DE
y 00 + p(x)y 0 + q(x)y = r(x)
on an open interval I has the form:
y(x) = yh (x) + yp (x).
Where yh (x) is a general solution on I of the corresponding homogeneous
DE:
y 00 + p(x)y 0 + q(x)y = 0
which is given by:
yh (x) = c1 y1 (x) + c2 y2 (x)
And yp (x) is any solution of the non-homogeneous DE on I with arbitrary
constants.

106

Particular solution
A particular solution of the non-homogeneous DE is obtained by giving values to the constants c1 and c2 .

7.2

Solution by undetermined coefficients

Method of undetermined coefficients


As we have just seen, a general solution of the non-homogeneous linear
y 00 + p(x)y 0 + q(x)y = r(x)
has the form:
y(x) = yh (x) + yp (x)
where yh (x) is a general solution of the corresponding homogeneous DE and
yp (x) is any solution of the non-homogeneous DE.
So, our main task now is to find yp !
The method of undetermined coefficients can be used with DEs of the type:
y 00 + ay 0 + by = r(x)
where a and b are constant coefficients and r(x) are:
exponential functions,
polynomials,
cosines,
sines,
sums or products of the above functions.
The reason is that these types of r(x) have derivatives similar to r(x) itself.
So, the basic idea is to use as a particular solution yp a function similar to
r(x) which involves unknown coefficients to be determined.
To use this method do the following:
(a) First of all, make sure that the DE has constant coefficients and that r(x)
is one of the functions listed in the first column of the table below.
(b) Solve the corresponding homogeneous DE (set r(x) = 0).
(c) Establish the correct form of yp by looking at the form of r(x). Then
If one of the terms of your choice of yp happens to be a solution of the
corresponding homogeneous equation, then multiply your choice of
yp by x (or by x2 if this solution is a double root of the corresponding
homogeneous equation).

107

if r(x) consists of the sum of several of the functions listed in the table,
then choose for yp the sum of the functions in the corresponding lines
of the second column.
(d) Since we want yp00 + ayp0 + byp = r(x), then we set the corresponding
coefficients of LHS and RHS equal to each other and form a system of
linear equations.
(e) By solving the system of linear equations we find the coefficients of yp .
The good thing in all this is that if you choose the wrong form of yp this
method will lead to a contradiction.
The table below gives the form of a particular solution yp when the DE has
constant coefficients.
Term in r(x)

Choice for yp

kex

Cex

kxn (n = 0, 1, )

Kn xn + Kn1 xn1 + + K1 x + K0

k cos(x)

K cos(x) + M sin(x)

k sin(x)
ke

ke

7.2.1

K cos(x) + M sin(x)

cos(x)

sin(x)

[K cos(x) + M sin(x)]

[K cos(x) + M sin(x)]

Examples: Method of undetermined coefficients

Example 31 (Method of undetermined coefficients). Solve the non-homogeneous


DE:
y 00 + 2y = 4x3 .
Solution
This is a second order linear non-homogeneous DE with constant coefficients.
The function r(x) is of the right type to apply the method of undetermined
coefficients.
We first have to solve the corresponding homogeneous DE:
y 00 + 2y = 0.
The characteristic equation is:
2 + 2 = 0
with complex roots:

1 = i 2,

2 = i 2.

108

Thus, the general solution is:

yh (x) = A cos( 2x) + B sin( 2x).


Now we have to find a particular solution yp of the non-homogeneous DE.
After looking at the table, we choose:
yp = K3 x3 + K2 x2 + K1 x + K0 .
So:
yp0

3K3 x2 + 2K2 x + K1 ,

yp00

6K3 x + 2K2 .

Now we substitute this in the DE:


6K3 x + 2K2 + 2(K3 x3 + K2 x2 + K1 x + K0 ) = 4x3 .
Equate the coefficients of x3 , x2 , x and x0 on both sides:
2K3

2K2

6K3 + 2K1

2K2 + 2K0

So, K3 = 2, K2 = 0, K1 = 6, K0 = 0. Therefore, the particular solution is:


yp (x) = 2x3 6x
and a general solution to the non-homogeneous DE is:

y(x) = yh (x) + yp (x) = A cos( 2x) + B sin( 2x) + 2x3 6x.

Example 32 (Method of undetermined coefficients). Find a general solution


of:
2y 00 + y 0 y = 9x2 e2x .
Solution
We divide by 2 and solve the corresponding homogeneous DE first:
y 00 +

y
y0
=0
2
2

2 +

1
=0
2
2

the characteristic equation is:

109

with roots 1 = 1 and 2 = 1/2.


A general solution to the homogeneous DE is:
yh (x) = c1 ex + c2 ex/2 .
Now we need a particular solution to the non-homogeneous DE. The function
r(x) = 9x2 e2x is the product of terms like those listed in the first column of the
table, that is, an exponential function and a polynomial. We should choose the
following yp :
yp = e2x (K2 x2 + K1 x + K0 ).
Lets differentiate to find yp0 and yp00 :
yp0

e2x (2K2 x + K1 + 2K2 x2 + 2K1 x + 2K0 ),

yp00

2e2x (K2 + 4K2 x + 2K1 + 2K2 x2 + 2K1 x + 2K0 ),

Now we substitute these in the DE:


4e2x (K2 + 4K2 x + 2K1 + 2K2 x2 + 2K1 x + 2K0 )+
e2x (2K2 x + K1 + 2K2 x2 + 2K1 x + 2K0 )
e2x (K2 x2 + K1 x + K0 ) =9x2 e2x
that is:
e2x (4K2 + 18K2 x + 9K1 + 9K2 x2 + 9K1 x + 9K0 ) = 9x2 e2x .
So:
9K2

9,

18K2 + 9K1

0,

4K2 + 9K1 + 9K0

.0

Thus K2 = 1, K1 = 2 and K0 = 14/9 and the particular solution is:


yp (x) = e2x (x2 2x +

14
).
9

A general solution to the non-homogeneous DE is:


y(x) = yh (x) + yp (x) = c1 ex + c2 ex/2 + e2x (x2 2x +

110

14
).
9

7.3

Solution by variation of parameters

Method of variation of parameters


The method that we saw in the earlier section only applied to DEs with
constant coefficients and special functions r(x) on the RHS.
We are now going to see a much more general (though much more complicated) way to solve second order non-homogeneous linear differential equations.
This method is called method of variations of parameters and works as follows.
Consider:
y 00 + p(x)y 0 + q(x)y = r(x)
where p(x), q(x) and r(x) are continuous functions of any kind on some interval
I.
A particular solution is given by:
Z
Z
y1 (x)r(x)
y2 (x)r(x)
dx + y2 (x)
dx
yp (x) = y1 (x)
W (y1 , y2 )
W (y1 , y2 )
where y1 (x) and y2 (x) are linearly independent solutions of the corresponding
homogeneous DE:
y 00 + p(x)y 0 + q(x)y = 0
and
W (y1 , y2 ) = y1 (x)y20 (x) y2 (x)y10 (x)
is the Wronskian of y1 (x) and y2 (x).
This appears to be simple enough, but unfortunately, the integral in the
expression above is often difficult to solve.
Where does the above expression come from?
Well, assume that you have found two linearly independent solutions of the
corresponding homogeneous DE y1 (x) and y2 (x), so that its general solution is:
yh (x) = c1 y1 (x) + c2 y2 (x).
Thus, any particular solution yp (x) to the non-homogeneous must have the
property:
yp
yp
6= constant
and
6 constant
=
y1
y2
which means that
yp (x) = u(x)y1 (x) + v(x)y2 (x).
Take the first derivative:
yp0 (x) = u0 (x)y1 (x) + u(x)y10 (x) + v 0 (x)y2 (x) + v(x)y20 (x).
Now, if we take the second derivative of this expression and then we insert it
in the DE, we would end up with a second order linear DE in v 00 (x) and u00 (x),
thus something much more complicated than the DE we started off with!

111

So, we can simplify the expression for yp0 (x) by setting


u0 (x)y1 (x) + v 0 (x)y2 (x) = 0
and we get
yp0 (x) = u(x)y10 (x) + v(x)y20 (x).
Take now the second derivative:
yp00 (x) = u0 (x)y10 (x) + u(x)y100 (x) + v 0 (x)y20 (x) + v(x)y200 (x).
With these derivatives the DE becomes:
u(y100 + py10 + qy1 ) + v(y200 + py20 + qy2 ) + u0 y10 + v 0 y20 = r.
Since y1 and y2 are solutions of the corresponding homogeneous DE, then
the equation above reduces to:
u0 y10 + v 0 y20 = r
This equation together with the condition imposed previously:
u0 y1 + v 0 y2 = 0
form a system of two algebraic equations for the unknown functions u0 and v 0 .
These equations uniquely determine u0 (x) and v 0 (x), so that u(x) and v(x) can
be obtained by integration.
Now multiply the first of these two equation by y2 and the second by y20 ,
and then add to find u0 (x):
y2 u0 y10 + y2 v 0 y20

= y2 r

y20 u0 y1 y20 v 0 y2
u0 (y1 y20 y2 y10 )
u0 W (y1 , y2 )

= y2 r
= y2 r.

where W (y1 , y2 ) is the Wronskian of y1 and y2 .


Similarly, if we now multiply the first equation by y1 and the second by y10
and add we get:

Thus:
u0 =

y1 u0 y10 + y1 v 0 y20

y1 r

y10 u0 y1 y10 v 0 y2
v 0 (y1 y20 y2 y10 )
v 0 W (y1 , y2 )

y1 r

y1 r.

y2 (x)r(x)
,
W (y1 (x), y2 (x))
112

v0 =

y1 (x)r(x)
.
W (y1 (x), y2 (x))

Note: W 6= 0 since y1 and y2 are linearly independent functions.


All we need to do now is to integrate to find u and v:
Z
Z
y2 (x)r(x)
y1 (x)r(x)
u=
dx,
v=
dx.
W (y1 (x), y2 (x))
W (y1 (x), y2 (x))
These integrals exist because the function r(x) is continuous. Therefore, a
particular solution is given by:
yp (x) = u(x)y1 (x) + v(x)y2 (x).

7.3.1

Examples: Method of variation of parameters

Example 33 (Method of variation of parameters). Solve


y 00 + y = tan x.
Solution
Here, we cannot use the method of undetermined coefficients, since the function r(x) = tan x is not of the right type to apply this method. To solve this
DE, we first must find the general solution to the corresponding homogeneous
DE:
y 00 + y = 0.
The characteristic equation is:
2 + 1 = 0
with roots 1 = i and 1 = i. Thus the solutions are:
y1 (x) = cos(x),
The Wronskian is:

y
W (y1 , y2 ) = 10
y1

y2 (x) = sin(x).


y2 cos x
sin x
=
y20 sin x cos x



= cos2 x + sin2 x = 1

Now we can find u0 and v 0 (here r(x) = tan x):


u0 =

sin2 x
1 cos2 x
y2 r
=
=
= sec x + cos x
W (y1 , y2 )
cos x
cos x

and:
v0 =

y1 r
= cos x tan x = sin x.
W (y1 , y2 )

113

Integration gives us u(x) and v(x):


Z
u(x) = [ sec x + cos x] dx = sin x log | sec x + tan x|
and

Z
v(x) =

sin x dx = cos x.

So a particular solution is:


yp (x)

u(x)y1 (x) + v(x)y2 (x)

[sin(x) log | sec(x) + tan(x)|] cos(x) cos(x) sin(x)

cos(x) log | sec(x) + tan(x)|.

Thus, the general solution is:


y(x)

7.4

yh (x) + yp (x)

c1 cos(x) + c2 sin(x) cos(x) log |sec(x) + tan(x)|.

Modelling: Forced oscillations, resonance

Forced Oscillations
We have already seen that the free motion of a mass-spring system is dictated
by the homogeneous linear DE:
my 00 + cy 0 + ky = 0
where y is the displacement of the body from the rest position, m is the mass
of the body, my 00 is the force of inertia, cy 0 is the damping force and ky is the
spring force.
We can model forced motions by adding the contribution of an external force
r(t) acting on the body:
my 00 + cy 0 + ky = r(t).
The term r(t) is called the input term or driving force. The solution is called
an output or a response of the system to the driving force.
Particularly interesting are those inputs that are period (periodic inputs), so
we will look at the case where the driving force is:
r(t) = F0 cos(t)

(F0 > 0,

> 0).

Thus, now we have the equation:


my 00 + cy 0 + ky = F0 cos(t)
114

with general solution:


y(t) = yh (t) + yp (t)
where yh (t) is the solution to the corresponding homogeneous DE and yp (t) is
a particular solution to the non-homogeneous DE.
We already know yh (t), so now we have to find yp (t).
We can use the method of undetermined coefficients. A look at the usual
table suggests that we should use:
yp = a cos(t) + b sin(t).
Lets differentiate yp to find yp0 and yp00 :
yp0

a sin(t) + b cos(t),

yp00

2 a cos(t) 2 b sin(t).

Now we substitute these in the DE:




m 2 a cos(t) 2 b sin(t) + c [a sin(t) + b cos(t)]
+ k [a cos(t) + b sin(t)]
= F0 cos(t).
Collect the terms with cos and sin and we get:




(k m 2 )a + cb cos(t) + (k m 2 )b ca sin(t) = F0 cos(t).
Now we can equate the various coefficients to find a and b:
(k m 2 )a
ca

cb = F0

(k m 2 )b

0.

We can use Cramers rule (if you have forgotten how to use this rule, have
a look at 6.6 of Kreyszig) to solve this linear system:


F0 c



2
0
(k m )
(k m 2 )F0


=
.
a=
2

(k m 2 )2 + 2 c2
(k m ) c

c
(k m 2 )

b =



(k m 2 ) F0


c
0
(k m 2 ) c
c
(k m 2 )

F0 c
=
.
2 )2 + 2 c2

(k

2 2
2 2
which is OK provided
p that (k m ) + c 6= 0.
Now set 0 = k/m so we get (check!):

a = F0

m(02 2 )
,
m2 (02 2 )2 + 2 c2

b = F0
115

c
.
m2 (02 2 )2 + 2 c2

So, to summarise, a particular solution yp (t) of


my 00 + cy 0 + ky = F0 cos(t)
is:
yp (t) = a cos(t) + b sin(t)
where the coefficients a and b are given above.
7.4.1

Undamped forced oscillations

Undamped forced oscillations - Description


If c = 0, then there is no damping and the constant a and b become:
a =
b =

m( 2 2 )
F0
m(02 2 )
= F0 2 02
=
,
2
2
2
2
) + c
m (0 2 )2
m(02 2 )
c
F0 2 2
= 0.
m (0 2 )2 + 2 c2

F0

m2 (02

The general solution becomes:


y(t) = yh (t) + yp (t)

=
=

Cet cos(0 t ) + a cos(t) + b sin(t),


F0
Cet cos(0 t ) +
cos(t).
m(02 2 )

As you can see, what we have here is the superposition of two harmonic
oscillations with frequencies 0 /2 cycles per second (the natural frequency of
the system) and /2 cycles per second of the input.
Since k = m02 , the amplitude of yp can be written as:
a=

F0
,
k

where

=
1

1
 2 .

If 0 , then a !! So, when the natural frequency (0 ) is equal to


the input frequency () we have resonance which is of crucial importance in the
study of vibrating systems. The quantity is called the resonance factor.
In the case of resonance, c = 0 and = 0 and the DE can be written:
my 00 + ky = F0 cos(0 t).
The solution to the homogeneous equation is:
yh (t) = C cos(0 t ),
but now a particular solution of the non-homogeneous DE has to be multiplied
by t, since the obvious choice of yp (see the famous table) happens also to be a
solution of the corresponding homogeneous DE. So:
yp (t) = t [a cos(0 t) + b sin(0 t)] .
116

By substituting this into the non-homogeneous DE we get a = 0 and b =


F0 /2m0 (check!) and:
yp (t) =

F0
t sin(0 t).
2m0

40

20

10

20

30

40

50

-20

-40

Figure 46: Particular solution in the case of resonance

We see that as the time t goes by, yp (t) becomes larger and larger! This
means that if there is very little damping (c 0), the system may undergo
vibrations so large that can destroy it (see Figure 46). For structures (e.g.
buildings, bridges) this can have very dangerous implications so that engineers
and architects must watch out for resonance.
Two very famous cases when resonance proved to be disastrous are:
(a) Broughton Suspension Bridge (near Manchaster, England) in 1831. A
column of soldiers marching on the bridge setup a periodic force whose
frequency was too close to one of the natural frequencies of the bridge, so
the bridge collapsed. These days soldiers break steps when they cross a
bridge.
(b) Tacoma Narrows Bridge (Washington) in 1940. This bridge was opened
on the 1st of July 1940 and from the very first day it started oscillating
vertically (it was nicknamed Galloping Gertie and people used to travel
117

long distances to experience the thrill of crossing it). Unfortunately, on


the 7th of November the bridged cracked up and finally collapsed. See
figures 47 and 48

Figure 47: The collapse of Tacoma Narrows Bridge due to resonance.

7.4.2

Application: NASA tethered satellite system

NASA Tethered Satellite System


The main objective of the NASA Tethered Satellite System (TSS) was to
show that satellites can be deployed, stabilised, and retrieved on a long tether
in space (up to 20km long!) and that an electrically conducting system can be
operated successfully. This is a very challenging engineering goal, because of all
the different forces acting on the satellite and Space Shuttle. These are gravity,
centrifugal force, and atmospheric drag which vary with altitude and thus are
different on each of the two bodies in a tethered system.
The Space Shuttle orbits around the Earth at a speed of about 7.6 km per
second. Such a speed is necessary to balance gravity and centrifugal force.
However, if the altitude is changed, the two forces do not balance any longer
unless the Shuttle also changes its speed. If it moves upwards, it has to slow
down. If it moves downwards, it has to speed up to balance gravity. So, two
unlinked satellites which travel at different altitudes will have the one at higher
altitude travelling more slowly than the other. See figures 49 and 50
If now we connect the two satellites with a tether, the two bodies are forced
to travel together. Thus, the higher altitude satellite will travel too fast for its
orbit and the other too slowly. The tether will prevent the lower satellite from
falling back to Earth and the upper satellite from moving to a higher orbit. This
will create a tension in the tether.
118

Figure 48: The collapse of Tacoma Narrows Bridge due to resonance.

Figure 49: Satellite and Space Shuttle are not linked and travel at different
altitudes and thus speeds.

In such a linked system, the tether linking the satellite to the Shuttle can:
compress and stretch, causing the satellite to bounce up and down (longitudinal oscillations) (see Figure 51)
move in a circular (skip-rope) motion. (see Figure 51)
develop wave-like motions (transverse oscillations) (see Figure 52).
Furthermore, the satellite may start rocking back and forth about its attachment point (pendulous motion). See Figure 52.
All the motions listed above have their own frequencies, which depend on
the length and tension of the tether. If the frequencies are all different, they do

119

Figure 50: Satellite and Space Shuttle are linked and travel at different altitudes, but at the same speed. Thus, a tension is created in the tether (http://
science.ksc.nasa.gov/shuttle/missions/sts-75/mission-sts-75.html).

not cause any harm, but if some of them become close to each other, we can
have resonance.
The oscillations could be caused by the motion of the satellite or Shuttle.
Also, the conductive tether system produces an electrical current, which, in
turn, produces a magnetic field around the tether. This field will interact with
the Earths magnetic field, resulting in a force that may produce skip-rope type
oscillations.
Obviously, it is very important to keep control of a tethered satellite, thats
why much study has gone into identifying the different types of possible motions
and the methods used to control them.
7.4.3

Application: Beats

Beats
Something else happens when 0 .
Consider the IVP given by the general solution of forced mechanical oscillations:
y(t) = C cos(0 t ) +

F0
cos(t),
2 )

m(02

y(0) = 0, y 0 (0) = 0.

Differentiate to find y 0 (t):


y 0 (t) = C0 sin(0 t )

120

F0
sin(t).
m(02 2 )

Figure 51: From left: Longitudinal Oscillations; Skip-rope Oscillations (http:


//liftoff.msfc.nasa.gov/academy/TETHER/dynamics.html).

Figure 52: From left: Transverse Oscillation; Pendulous Oscillations (http:


//liftoff.msfc.nasa.gov/academy/TETHER/dynamics.html).

121

Now apply the initial conditions:


F0
m(02 2 )
= C0 sin()

= C cos() +

0
which gives:

C cos()
C0 sin()

=
=

F0
,
m(02 2 )

0.

So:
C=

= 0,
Therefore:
y(t) =

F0
.
2 )

m(02

F0
[cos(t) cos(0 t)]
2 )

m(02

which can be written:


y(t) =

2F0
sin
m(02 2 )




0 +
0
t sin
t .
2
2

Now, since
0 , then 0 is small and the period of the term

sin 02 t is large (P = 2/(0 )/2) and we obtain an oscillation of the
type shown in Figure 53. Forced undamped oscillations with 0 produce
the phenomenon called beats.
7.4.4

Application: Damped forced oscillations

Damped oscillations
Consider again:
my 00 + cy 0 + ky = F0 cos(t)
with general solution:
y(t) = yh (t) + yp (t)
where yh (t) is the general solution of the corresponding homogeneous DE.
We saw earlier in this course that in the case of underdamping this is given
by:
yh (t) = et (A cos( t) + B sin( t))
where:
c
=
2m

r
and

122

k
c2

.
m 4m2

0.5

50

100

150

200

250

300

-0.5

-1

Figure 53: Particular solution in the case of beats

We have also already seen that a particular solution yp (t) to the non-homogeneous
DE with c 6= 0 is:
yp (t) = a cos(t) + b sin(t)
where the coefficients a and b are:
a = F0

m(02 2 )
,
m2 (02 2 )2 + 2 c2

b = F0

m2 (02

c
.
2 )2 + 2 c2

Lets re-write yp (t) in the following way:


yp (t) = C cos(t )
where C (which is the amplitude of yp (t)) and the angle are (check!):
F0

C ()

p
a2 + b2 = p

tan

b
c
=
.
a
m(02 2 )

m2 (02

2 )2 + 2 c2

Thus, a general solution to the non-homogeneous DE is:


y(t) = yh (t) + yp (t) = Cet cos( t ) + C cos(t ).
123

One can see that the solution consists of two terms: the first term (yh (t))
represents damped oscillations and depends only on the parameters of the system and initial conditions. The damping factor et 0 when t . For this
reason, this term is called the transient part of the solution. The second term
(yp (t)) is due to the external force r(t) = F0 cos(t). Note that yp (t) is out of
phase with r(t) by an angle which is called the phase angle or phase lag since
it measures the lag of the output behind the input. Also, the magnitude of r(t)
is different from the magnitude of yp (t) by a factor C /F0 :
1
p

m2 (02

2 )2 + 2 c2

This magnification factor is called the frequency gain factor.


As time t goes by, the motion of the mass-spring system becomes increasingly
dominated by the yp (t) term, since the yh (t) term dies down exponentially.
Therefore, the yp (t) term is called the steady-state solution. This means that
after a sufficiently long time the output corresponding to a sinusoidal input will
be a harmonic oscillation with frequency equal to that of the input (see Figure
54).

0.06

0.04

0.02

10

12

14

-0.02

Figure 54: Behaviour of yh (t) (magenta curve), yp (t) (blue curve) and y(t) =
yh (t) + yp (t) (red curve) as a function of time t. As you can see, y(t) converges
to yp (t) at sufficiently large values of t.

124

For a given system (for which m, k and c are fixed), it may be interesting
to see how this would react to a certain sinusoidal input of frequency . For
this purpose, one can graph the amplitude C of the output as a function of .
This graph is called the frequency response curve or resonance curve.
If the input frequency = 0, then the applied force is constant (F0 cos(t) =
F0 ), there is no motion in the steady-state and C () = F0 /(m0 ) = F0 /k.
Also, if , then C () 0 since the inertia of the system doesnt
allow a response to vibrations that are too rapid.
Lets study further the amplitude term C () of the steady-state term by
looking for the maximum value obtained by this term.
We can do so by taking the derivative of C () and then by setting it equal
to zero:
"
#
d
F0
dC ()
p
=
=0
d
d
m2 (02 2 )2 + 2 c2
which gives:
F0 (4m2 0 2 + 4m2 3 + 2c2 )
2
(m 0 4 2m2 0 2 2 + m2 4 + 2 c2 )3/2

= 0.

Thus:


2m2 (02 2 ) + c2 = 0
which is verified when
r
=0

or

02

c2
.
2m2

If the system is overdamped or critically damped (c2 2mk), then the


quantity under square root becomes negative, so dC /d = 0 only if = 0. In
this case, as increases from 0 to , C () decreases from C (0) = F0 /k to
zero.
If the system is underdamped (c2 2mk), then the quantity under square
root is positive and C () has a maximum at
r
c2
max = 02
.
2m2
If we insert this value into the expression for C () we obtain:
2mF0
C (max ) = p
.
c 4m2 02 c2
You can see that C (max ) as c 0, in agreement with our previous
results. The value max /2 is called the resonance frequency for the system.
Thus, if a system is stimulated by an external force at this frequency, it is said
to be at resonance.
In Figure 55 it is shown a frequency response curve obtained for different
values of the damping constant c.
125

0.5

1
omeg

1.5

Figure 55: Frequency response curve (or amplification) C /F0 as a function


of obtained by setting m = k = 1. The curves (from bottom to the top)
correspond to a damping constant c = 3, 2, 1, 1/2, 1/4, 1/8

126

7.5

Modelling: RCL-circuit

Reminder: Kirchoffs voltage law


Lets look again at Kirchoffs voltage law. This states that the algebraic sum
of the voltage drops around any closed loop of a circuit is zero. So, if E(t) is
the externally imposed drop in voltage (electromotive force), which is provided
by a generator or battery, then (see Figure 56):
E(t) = (Vd Va ) = (Vb Va ) + (Vc Vb ) + (Vd Vc ).
The above identity can be written as:
Z
dI
1
RI + L
+
I dt = E(t).
dt
C

Figure 56: Example of a closed loop circuit

This equation is an integro-differential equation, since it has an integral and


a derivative of the unknown function I.
To eliminate the integral, differentiate with respect to the time t:


Z
d
1
dI
dE(t)
+
I dt
RI + L
=
dt
dt
C
dt
2
dI
d I
I
dE(t)
R
+L 2 +
=
dt
dt
C
dt
dI
I
dE(t)
d2 I
+
=
L 2 +R
dt
dt
C
dt
which is a non-homogeneous second-order linear differential equation.
For a sinusoidal electromotive force E(t) = E0 sin(t), the DE becomes:
L

d2 I
dI
I
+R
+
= E0 cos(t).
2
dt
dt
C
127

Table 1: Analogy of electrical and mechanical quantities


LI 00 + RI 0 + C1 I = E0 cos(t)
Current I
Inductance L
Resistance R

my 00 + cy 0 + ky = F0 cos(t)
Displacement y
Mass m
Damping constant c
Spring modulus k
Driving force
F0 cos(t)

1
C

Derivative E0 cos(t) of
electromotive force

This differential equation has the same form as that seen in the context of
a mechanical system!! The analogy between mechanical and electrical systems
is given in Table 1.
Note that since:
Z
dQ
dI
d2 Q
I=
,
= 2,
I dt = Q,
dt
dt
dt
then
Z
dI
1
+
I dt
dt
C
dQ
d2 Q Q
R
+L 2 +
dt
dt
C
dQ Q
d2 Q
+
L 2 +R
dt
dt
C
RI + L

E0 sin(t)

E0 sin(t)

E0 sin(t).

In practical electrical engineering problems, the current I(t) is more important than Q(t), so we will work with
L

dI
I
d2 I
+R
+
= E0 cos(t).
dt2
dt
C

To solve this DE we must find a general solution to the corresponding homogeneous DE and a particular solution to the non-homogeneous DE:
I(t) = Ih (t) + Ip (t).
The corresponding homogeneous DE is:
d2 I
R dI
I
+
+
=0
2
dt
L dt
LC
with characteristic equation:
2 +

1
R
+
=0
L
CL
128

with roots:
q
1 =

R
+
2L

R2

4L
C

2 =

2L

2L

R2

4L
C

2L

Like in mechanical systems, we have three cases.


There are three different cases:
4L
C

(1) Over-damping R2 >

(2) Critical damping R2 =


(3) Under-damping R2 <

4L
C

4L
C

If we set:

q
R2 4L
R
C
,
=
=
2L
2L
then 1 = + and 2 = and the general solution is:
Ih (t) = c1 e()t + c2 e(+)t .
As you can see, both exponents are negative, since > 0, > 0 and
2 = 2 1/LC < 2 . Thus, in all three cases, the general solution Ih (t) 0
as t .
A particular solution Ip (t) to the non-homogeneous can be found using the
method of undetermined coefficients. A look at the usual table tells us to use:
Ip (t) = a cos(t) + b sin(t).
Calculate the derivatives:
Ip0 (t) = (a sin(t) + b cos(t)),
Ip00 (t) = 2 (a cos(t) b sin(t)).
Substitute these into the DE, then collect the cosine terms and set them
equal to E0 cos(t). Then take the sine terms and set them equal to zero:
a
C
b
2
L (b) + R(a) +
C
L 2 (a) + Rb +

E0

0.

The solution is (check!):


a=

E0 S
,
R2 + S 2

b=

129

E0 R
.
R2 + S 2

Where S is the reactance:


S = L

1
.
C

With the above values of a and b, the particular solution becomes:


Ip (t) = I0 sin(t )
where:

p
E0
a
S
a2 + b2 =
,
tan = = .
2
2
b
R
R +S

The quantity R2 + S 2 is called the impedance.


So, a general solution to the non-homogeneous DE is:
I0 =

I(t) = Ih (t) + Ip (t) = c1 e()t + c2 e(+)t + I0 sin(t ).


After a sufficiently long time, the transient current Ih (t) 0 and the current
tends to the steady-state current Ip (t). Thus, after some time the output will
be a harmonic oscillation whose frequency is that of the input. See Figure 57.

1.5

0.5

0.005

0.01
t

0.015

0.02

-0.5

-1

-1.5

Figure 57: Transient current (red curve), steady-state current (blue curve) and
sum of the two currents (magenta curve) in a RLC circuit with sinusoidal electromotive force. You can see that after a very short time the current will oscillate
at the input frequency.

130

Finally, if the system is under-damped (R2 < 4L/C), then the frequency
response curve has a maximum at (like in mechanical systems):
r
1
R2
max =
.

LC
2L2
So, if a periodic voltage E(t) with the same frequency max were impressed
on the circuit, the electrical system would be in resonance.

7.6

Supply and Demand

Supply and Demand


We suppose that buyers and sellers in a market adapt their behaviour according to the current rate of change in price (its inflation) and to the rate of
d2 p
change of inflation. If p is the price, dp
dt is the inflation and dt2 is the rate of
change of inflation. Therefore the a consumers demand for a commodity is given
by
dp
d2 p
demand = p + m + n 2 ,
dt
dt
and supply of a commodity is be given by
supply = + p + u

dp
d2 p
+v 2,
dt
dt

where , , and are all positive.


Notice that m > 0 implies that rising prices cause demand to increase relative
to the initial model p. The economic interpretation is that buyers will
prefer to buy early in anticipation of higher prices later; by bringing forward
their orders they boost current demand.
If we assume that supply = demand,
p + m

dp
d2 p
dp
d2 p
+ n 2 = + p + u + v 2 ,
dt
dt
dt
dt

or

d2 p
dp
+ (m u) ( )p = ( + ).
dt2
dt
So, as with our previous examples, the solution will be oscillatory and we
can look at different choice of parameters to determine if the market will be
stable or unstable.
(n v)

131

Higher order linear differential equations

Higher order linear differential equations


Lets consider now linear differential equations of arbitrary order n. Their
standard form is:
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = r(x).
If r(x) 6= 0 the DE is called non-homogeneous.
If r(x) = 0, then we have:
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = 0
and the DE is called homogeneous.

8.1
8.1.1

Higher order homogeneous linear differential equations


Definitions and notation

Homogeneous linear differential equations


Consider
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = 0.
A general solution for this homogeneous DE on an open interval I has the
form:
y(x) = c1 y1 (x) + c2 y2 (x) + c3 y3 (x) + cn yn (x)
where c1 , c2 , c3 , cn are arbitrary constants and y1 , y2 , y3 yn are linearly
independent solutions of the DE on I.
Wronskian
If the coefficients p0 (x), p1 (x) pn1 (x) of the homogeneous DE are continuous functions on some open interval I, then the n solutions y1 , y2 , y3 yn
are linearly independent on I if their Wronskian is different from zero on I.
That is:


y1

y2
y3
yn
0

0
0
0
y1

y
y

y
n
2
3
00

00
00
00
y1

y
y

y
n
2
3
W (y1 , y2 , , yn ) =
6= 0.
..
..
..
..
..

.

.
.
.
.
(n1)

(n1)
(n1)
(n1)
y
yn
y
y
1

132

8.1.2

Higher order homogeneous linear differential equations with


constant coefficients

Constant coefficients
If a linear DE has constant coefficients:
y (n) + an1 y (n1) + an2 y (n2) + a1 y 0 + a0 y = 0
then it has the characteristic equation:
(n) + an1 (n1) + an2 (n2) + a1 + a0 = 0
and to find the solutions of the DE we must determine the roots of the characteristic equation.
This will generally require a numerical root-finding method.
Real and distinct roots
If all the n roots are real and distinct, then the general solution is given by:
y(x) = c1 e1 x + c2 e2 x + cn en x .

Multiple real roots


If there are multiple real roots, say, = 1 = 2 , then the two linearly
independent solutions corresponding to this root are:
y1 (x) = ex

and

y2 (x) = xex .

More generally, if is a root of order m, then the m corresponding linearly


independent solutions are:
y1 (x) = ex ,

y2 (x) = xex ,

ym (x) = xm1 ex .

Complex roots
If there are simple complex roots, they occur in conjugate pairs, that is, if
= + i is a root, then = i is also a root and the two corresponding
linearly independent solutions are:
y1 (x) = ex cos(x)

and

y2 (x) = ex sin(x).

Finally, if there are multiple complex roots (say three for example) the corresponding six linearly independent solutions are:
y1 (x)

= ex cos(x),

y3 (x)

= xex cos(x),

y5 (x)

2 x

= x e

y2 (x) = ex sin(x),
y4 (x) = xex sin(x),

cos(x),

133

y6 (x) = x2 ex sin(x).

8.1.3

Examples: Constant coefficients

Example 34 (Double root). Consider


y 000 3y 0 2y = 0.
Solution
The characteristic equation is:
3 3 2 = 0
which we can re-write as follows:
( + 1)2 ( 2) = 0.
Thus, we have a double root at = 1 and a simple root at = 2. The
general solution is:
y(x) = c1 ex + c2 xex + c3 e2x .

Example 35 (Complex root). Consider


y 000 + y 0 = 0.
Solution
The characteristic equation is:
3 + = 0
which we can re-write as follows:
(2 + 1) = 0
with roots = 0, = i and = i.
Thus, the general solution is:
y(x) = c1 + c2 cos x + c3 sin x.

8.1.4

Initial value problems

Initial value problems


An Initial Value Problems consists of the DE itself and n initial conditions:
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = 0,
y(x0 ) = K0 ,

y 0 (x0 ) = K1 ,

y 00 (x0 ) = K2 ,

, y (n1) (x0 ) = Kn1 ,

where x0 is a point on the interval I under consideration.


134

8.2

Higher order non-homogeneous linear differential equations

Non-homogeneous differential equations


Consider
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = r(x).
A general solution of this non-homogeneous DE on an open interval I has
the form (same as for second order equations):
y(x) = yh (x) + yp (x)
where
yh (x) = c1 y1 (x) + c2 y2 (x) + c3 y3 (x) + + cn yn (x)
is a general solution on I of the corresponding homogeneous DE and yp (x) is any
particular solution on I (with no arbitrary constants) of the non-homogeneous
DE.
8.2.1

Particular solution: method of undetermined coefficients

Method of undetermined coefficients


The problem now is how to find a particular solution. Fortunately, provided
that r(x) is a function of a special type (cos, sin, exp, etc.), we can still use the
method of undetermined coefficients. The following example illustrates how this
method can be used to solve a third order DE.
8.2.2

Example: Method of undetermined coefficients

Example 36 (Method of undetermined coefficients). Consider


y 000 3y 0 2y = 3ex .
Solution
We saw in a previous example that the general solution of the corresponding
homogeneous is:
yh (x) = c1 ex + c2 xex + c3 e2x .
Since both ex and xex are solutions of the corresponding homogeneous,
we will look for a particular solution yp (x) of the form
Ax2 ex
where A is a constant to be determined.
Thus:
yp0

= Aex (x2 + 2x)

yp00

= Aex (x2 4x + 2)

yp000

= Aex (x2 + 6x 6)

135

Substitution into y 000 3y 0 2y = 3ex gives:


Aex (x2 + 6x 6 + 3x2 6x 2x2 ) = 6Aex = 3ex .
Therefore:

1
3 = 6A A = .
2

Thus a particular solution is:


yp (x) =

x2 x
e .
2

And a general solution is given by:


y(x) = c1 ex + c2 xex + c3 e2x

8.2.3

x2 x
e .
2

Particular solution: method of variation of parameters

Variation of parameters
The method of variation of parameters also extends to nth order non-homogeneous
DEs:
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = r(x).
A particular solution on I to the non-homogeneous equation with continuous
coefficients is given by the formula:
Z
Z
W1 (x)r(x)
W2 (x)r(x)
yp (x) = y1 (x)
dx + y2 (x)
dx
W (x)
W (x)
Z
Wn (x)r(x)
+ + yn (x)
dx
W (x)
where y1 , y2 , yn are linearly independent solutions on I of the corresponding
homogeneous DE and W is their Wronskian. The Wj with j = 1 n are obtained from W by replacing the j th column of W with the column [0 0 0 1]T .
You can see that when n = 2 we have:


y y2
,
W (y1 , y2 ) = 10
y1 y20

0
W1 =
1


y2
= y2 ,
y20


y
W2 = 10
y1


0
= y1 ,
1

which is the result that we found earlier for second order linear non-homogeneous
DEs.

136

8.2.4

Initial value problems

An Initial value problems consists of the DE and n initial conditions:


y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = r(x),
y(x0 ) = K0 ,

y 0 (x0 ) = K1 ,

y 00 (x0 ) = K2 ,

, y (n1) (x0 ) = Kn1 ,

where x0 is a point on the interval I under consideration.

137

9
9.1

Systems of differential equations


Systems of differential equations: what are they?

First, we motive the study of systems of differential equations with an example


application.
9.1.1

Modelling: predator-prey

Model description
Consider two populations of animals, one of which preys the other. For
example, foxes and rabbits (or snakes and toads as shown in Figures 58 and
59). The population of foxes at time t will be denoted x(t) and the population
of rabbits at time t will be denoted y(t).
We will assume plenty of space and food for the rabbits, so that in the
absence of foxes they would grow exponentially. The foxes use rabbits as their
food sources, so in the absence of rabbits they would decline exponentially.
Thus, if there were no interaction between the two species we would have:
dx
dt
dy
dt

kx

my

where k is the death rate of foxes and m is the birth rate of rabbits.
Now we assume that the interaction of rabbits and foxes is jointly proportional to both populations, that is, it is proportional to xy.
dx
dt
dy
dt

kx + bxy

my cxy

or:
dx
dt
dy
dt

= x(k + by)
= y(m cx)

here, b and c are also constants. These are the Lotka-Volterra Predator-Prey
equations.
9.1.2

Investigate using Matlab

Matlab implementation
Lets enter the Predator-Prey equations in Matlab:
% P r e d a t o r Prey model
138

Figure 58: Prairie Rattlesnake (a predator?). Credit: U.S. Fish and Wildlife
Service U.S. Fish and Wildlife Service/photo by Photographer Bill Iko

Figure 59: Wyoming Toad in the grass (a prey?). Credit: U.S. Fish and Wildlife
Service U.S. Fish and Wildlife Service/photo by Photographer:Amy Hopperstad

139

% d e f i n e t h e r i g h t hand s i d e f u n c t i o n
f u n c t i o n rhs = pred_prey ( t , z )
global k b m c
rhs =[z ( 1 ) (k+bz ( 2 ) ) ; z ( 2 ) ( mcz ( 1 ) ) ] ;
We will replace the symbolic constants k, m, b and c by numeric ones. We
can choose: k=1; m=1; b=0.01; c=0.01;
We can now plot the solutions
% s e t the i n i t i a l c o n d i t i o n s
z0 = [ 4 0 ; 4 0 ] ;
% evaluate the s o l u t i o n at these points
ts= [ 0 : 0 . 1 : 1 0 ] ;
% s e t the parameters
global k m b c
k=1; m=1; b = 0 . 0 1 ; c = 0 . 0 1 ;
% s o l v e t h e ODE
[ t , z]= ode45 ( @pred_prey , ts , z0 ) ;
% p l o t the s o l u t i o n
plot (t , z (: ,1) )
t i t l e ( ' Changes i n Fox P o p u l a t i o n ' )
xlabel ( ' t ' )
y l a b e l ( ' Foxes ' )
The plot is shown in Figure 60.
Lets see what happens to the rabbits population. All we need to do is use
the following few lines
% p l o t the s o l u t i o n
plot (t , z (: ,2) )
t i t l e ( ' Changes i n Rabbit P o p u l a t i o n ' )
xlabel ( ' t ' )
y l a b e l ( ' Rabbits ' )
The plot is shown in Figure 61.
If we want to plot the behaviour of both populations together on the same
plot, then once again only have to make a minor modification
% p l o t the s o l u t i o n
plot (t , z (: ,1) , t , z (: ,2) )
t i t l e ( ' Rabbits and Foxes o v e r time ' )
xlabel ( ' t ' )

140

Changes in Fox Population


300

250

Foxes

200

150

100

50

5
t

10

Figure 60: Population of foxes x as a function of time t (in months).

Time t = 0 1.5. In this period there arent enough rabbits to support


the fox population, so the foxes decrease. However, since there arent
enough foxes to control the rabbits, the rabbit population increases. At
t 1.5 the number of rabbits has increased to a level where they can
support the foxes.
Time t 1.5 2.5. There are enough rabbits now to support the foxes,
so the foxes go on increasing. Their population is still too low to control
the rabbits, so the rabbits also increase. At t 2.5, the population of
foxes becomes large enough to control the rabbits.
Time t 2.5 4. There are now enough foxes to cause the number of
rabbits to decrease. There are still enough rabbits to support the foxes,
so the foxes go on increasing. At t 4, the rabbit population finally falls
too low to support the foxes anymore.
Time t 4 5.5. The population of foxes is falling, but it is still large
enough to control the rabbits, so the population of rabbits is falling too.
At t 5.5, the population of foxes falls low enough to stop controlling the
rabbits.
Time t 5.5 7.5. The population of foxes continues to fall and the
population of rabbits to rise until they appear to reach the same values
141

Changes in Rabbit Population


300

250

Rabbits

200

150

100

50

5
t

10

Figure 61: Population of rabbits y as a function of time t (in months).

(40 and 40) as we started with. If they reach the same values (at the same
time), then the entire process will repeat cyclically forever.
We can shed some light on this by making a graph of y against x (this is a
parametric graph, where t is the parameter).
% p l o t the s o l u t i o n
plot (z (: ,1) , z (: ,2) )
x l a b e l ( ' Foxes ' )
y l a b e l ( ' Rabbits ' )
This graph, in Figure 63, does indeed go round in a closed loop, verifying
the cyclic nature of the process.
Lets see what happens if we start with different initial conditions.
% evaluate the s o l u t i o n at these points
ts= [ 0 : 0 . 1 : 1 0 ] ;
% s e t the parameters
global k m b c
k=1; m=1; b = 0 . 0 1 ; c = 0 . 0 1 ;
% try d i f f e r e n t i n i t i a l conditions
for i = 1:5
142

Rabbits and Foxes over time


300

250

200

150

100

50

10
t

12

14

16

18

20

Figure 62: Population of rabbits y and foxes x as a function of time t (in


months).

143

300

250

Rabbits

200

150

100

50

50

100

150
Foxes

200

250

300

Figure 63: Population of rabbits y against population of foxes x. This curve


was obtained for x(0) = 40 and y(0) = 40.

144

% s o l v e t h e ODE
[ t , z]= ode45 ( @pred_prey , ts , [ 1 0 i 10 i ] ) ;
% p l o t the s o l u t i o n
plot (z (: ,1) , z (: ,2) )
h o l d on
end
x l a b e l ( ' Foxes ' )
y l a b e l ( ' Rabbits ' )
h o l d off

600

500

Rabbits

400

300

200

100

100

200

300
Foxes

400

500

600

Figure 64: Population of rabbits y against population of foxes x. The curves


were obtained by using five different sets of initial conditions (see text).
As shown in Figure 64 we get five closed curves one inside the other. It
suggests that in the middle, somewhere, there is likely to be a curve which is a
single point. That is, a value of x and y which doesnt change with time t at
all. An equilibrium state.
We can also draw a vector field of this graph.
% s e t the parameters
k=1; m=1; b = 0 . 0 1 ; c = 0 . 0 1 ;
% d e f i n e t h e p o i n t s where t h e g r a d i e n t s h o u l d be calculated
[ x , y ] = meshgrid ( [ 1 0 : 4 0 : 6 0 0 ] , [ 1 0 : 4 0 : 6 0 0 ] ) ;
145

% f i n d t h e s l o p e o f t h e f u n c t i o n a t each p o i n t
dydt = y . ( mcx ) ;
dxdt = x .( k+by ) ;
% p l o t the s o l u t i o n
q u i v e r ( x , y , dxdt . / abs ( dxdt ) , dydt . / abs ( dydt ) , 0 . 2 5 )
a x i s tight
t i t l e ( ' Direction Field ' )
xlabel ( 'x ' )
ylabel ( 'y ' )
By using the hold option we can combine the direction field and contour plot
as shown in Figure 66.
Direction Field
550
500
450
400

350
300
250
200
150
100
50
50

100

150

200

250

300
x

350

400

450

500

550

Figure 65: Vector field for the population of rabbits y against population of
foxes x plotted with dfieldplot.

9.2

Analytic approach

Motivation behind analytical approach


The investigation carried out above was numerically done with a computer,
so there could be problems. In particular, the x y graphs we have seen may
be an artifact of the computational methods, not real. The closed curves could,
for instance, be spirals, in which the successive cycles are so close together that
the difference is not observable on the graph. Furthermore, we used a particular
146

Direction Field
550
500
450
400

Rabbits

350
300
250
200
150
100
50
50

100

150

200

250

300
Foxes

350

400

450

500

550

Figure 66: Vector field for the population of rabbits y against population of
foxes x plotted with DEplot.

147

set of values of the constants. For all we know, if we took different values we
might get a totally different behaviour! An analytic approach. if possible, would
probably work for all possible values of the constants.
Equilibrium points
Let us first ask about equilibrium points. What we are looking for is any
solution of the form x(t)=constant, and y(t)=constant. For such a solution
dy
we must have dx
dt = 0 and dt = 0. Substituting these in the Predator-Prey
equations gives:
x(k + by)

0,

y(m cx)

0.

These equations are not linear, so the usual Gaussian elimination techniques
cannot be used. Usually, non-linear systems cant be solved easily, but these
can be solved.
From the first one, we have either
x=0

or

(k + by) = 0.

First case, x = 0.
Substituting this in the second equation gives y = 0 (since m 6= 0). The
equilibrium point is at
x = 0,
y = 0.
This says that if we start with no foxes and no rabbits, we will go on having no
foxes and no rabbits!
Second case, (k + by) = 0.
Since b 6= 0, we can solve this to get y = k/b. If we substitute this in the
second equation we get
k
(m cx) = 0
b
which gives
m
m cx = 0

x= .
c
So, we have one more equilibrium point:
x=

m
,
c

y=

148

k
.
b

We would expect this to be the point in the middle of the closed curves in
the Figure. If we use the value that we used before (k = 1, m = 1, b = 0.01, c =
0.01), we get x = 100, y = 100, which is right!
Lets try now to solve this system (when x 6= 0 and y 6= 0).
dx
dt
dy
dt

= x(k + by)
= y(m cx).

This gives:
y(m cx)
dy
=
,
dx
x(k + by)
which is separable!
So:

and so:

dy
(m cx)
y
=
dx
x
(k + by)
m cx
k + by
dy =
dx
y
x
Z
Z
k + by
m cx
dy =
dx
y
x
Z
Z
Z
Z
k
m

dy + b dy =
dx c dx
y
x

and
k ln y + by = m ln x cx + A
or
by k ln y + cx m ln x = A.
This equation cannot be solved explicitly for y. Nevertheless we will see that
the curves are closed!
The last equation is of the form H(x, y) = A, where H is the function
H(x, y) = by k ln y + cx m ln x.
When we ask for a solution of H(x, y) = A, we ask for all points (x, y) at
which the height of this graph (surface) is A. We could get this by slicing the
surface with a horizontal plane at height A. We need a contour plot!
% s e t the parameters
k=1; m=1; b = 0 . 0 1 ; c = 0 . 0 1 ;
% d e f i n e t h e g r i d i n t h e xy domain
[ x , y ] = meshgrid ( [ 0 : 2 0 : 4 0 0 ] , [ 0 : 2 0 : 4 0 0 ] ) ;
% f i n d the curves
149

H= byk l o g ( y )+cxm l o g ( x ) ;
% p l o t the contour
contour3 (x , y , H , 30) ;
t i t l e ( ' Contour P l o t ' )
xlabel ( 'x ' )
ylabel ( 'y ' )
z l a b e l ( 'H ' )

Contour Plot

4
4.5
5

5.5
6
6.5
7
7.5
400
300

400
300

200
200

100
y

100
0

Figure 67: Contour plot.


From Figure 67 you can see that this surface has a single minimum value in
the middle surrounded by contour lines that must be closed. These curves are
the solution curves of the predator-prey equations.
Can we use the insights from this special case to come to the same conclusion
no matter what values the constants are? Recall:
H(x, y) = by k ln y + cx m ln x = A.
All that we know about the constants k, m, b, c, A is that they are positive.
So, provided we can show that the graph of H has an absolute minimum, then
the level curves must be closed curves encircling it.
This can easily be done by looking for the critical points of the function

150

H(x, y). Thus


H
m
=c
x
x
k
H
=b
y
y

0,

0.

The partial derivatives are simultaneously equal to zero at


x=

m
,
c

y=

k
.
b

This is the global minimum of the function H(x, y). All contours (the solution curves) will be concentric closed curves encircling this point.
9.2.1

Experimental evidence

Predator-Prey experiments

Figure 68: Photo source: Rudolfos Usenet Animal Pictures Gallery


Canadian lynx, shown in Figure 68 are strictly carnivores. The snowshoe
hare (Lepus americanus) is of particular importance in the diet, and populations
of the two are known to fluctuate in linked cycles with periods of about 9.6 years
and a slight lag between hare and lynx populations.
Figure 69 shows the number of lynx furs returned in to the Hudson Bay
Company from 1820 to 1920. Distinct oscillations are seen with a period of
about nine years. No data were available on the hare population, so we can not
be certain that the oscillations are due to a predator-prey interaction. However,
controlled experiments have been performed in the laboratory with paramecia
(paramecium aurelia) that eat the yeast saccharomyces exiguns. See Figure 70.
Notice how the predator population lags behind the population changes in the
prey.
151

Figure 69: Lynx furs return from the Northern Department of the Hudson Bay
Co. Adapted from DAncona (1954). (http://animaldiversity.ummz.umich.
edu/accounts/lynx/l._canadensis.html)

9.3

Linear systems of n first order differential equations

Linear systems of equations


A linear system of n first order differential equations in n unknown functions
y1 (t), y2 (t), yn (t) has the form:
y10 = a11 y1 + a12 y2 + a13 y3 + + a1n yn
y20 = a21 y1 + a22 y2 + a23 y3 + + a2n yn
y30 = a31 y1 + a32 y2 + a33 y3 + + a3n yn
...........................................
yn0 = an1 y1 + an2 y2 + an3 y2 + + ann yn
A further known function could also be present on the RHS of the above
equations.
Matrix form
The above system can be re-written in matrix form as follows:
0
y
y1
1
a11 a12 a13 a1n
y20
y2

0 a21 a22 a23 a2n

y3
y3

= a31 a12 a33 a1n

..

. . . . . . . . . . . . . . . . . . . . . . . . . ...
.
an1 an2 an3 ann
y0
yn
n

or
y0 = Ay.
Here, we will talk a lot about eigenvalues and eigenvectors, so I will remind
you of what they are.
152

Figure 70: Oscillations in the populations of paramecia and yeast. Adapted from
DAncona (1954). (http://www-chem.st.usm.edu/japgroup/nlcd/intro.
html)

9.3.1

Eigenvalues and eigenvectors

Overview
Let A be a n n matrix and consider the equation:
Ax = x
where is a real or complex scalar to be determined and x is a vector also to
be determined.
Apart from the trivial solution x = 0 valid for every , a value of that
satisfies the above equation and for which x 6= 0 is called an eigenvalue of A
and the vector x corresponding to this eigenvalue is called eigenvector of A. We
can re-write the above equation as:
(A I)x = 0.
These are n linear algebraic equations in the n unknowns x1 , x2 , , xn (the
components of the vector x). And I is the n n unit matrix:

1 0 0 0
0 1 0 0

0 0 1 0 .

................
0 0 0 1

153

In components:
(a11 )x1 + a12 x2 + a13 x2 + + a1n xn = 0
a21 x1 + (a22 )x2 + a23 x2 + + a2n xn = 0
a31 x1 + a32 x2 + (a33 )x2 + + a3n xn = 0
................................................
an1 x1 + an2 x2 + an3 x2 + + (ann )xn = 0

Characteristic equation
For the equations
(A I)x = 0
to have a solution x 6= 0, the determinant of (A I) must be zero. This
determinant is called the characteristic determinant of A.
2 2 matrix example
In the case of a 2 2 matrix this becomes:

a a12
det(A I) = 11
a21
a22
=

(a11 )(a22 ) a12 a21

= 2 (a11 + a22 ) + a11 a22 a12 a21


This is called the characteristic equation of A whose solutions are the eigenvalues 1 and 2 of A.
So, once 1 and 2 are known, put = 1 in (A I)x = 0 which in
components form becomes:
(a11 )x1 + a12 x2
a21 x1 + (a22 )x2

=0
=0

and determine the eigenvector x1 of A corresponding to the eigenvalue 1 .


Then put = 2 and determine the eigenvector x2 of A corresponding to the
eigenvalue 2 .
One last remark: if x is an eigenvector of A, so is kx where k is an arbitrary
constant (k 6= 0).
9.3.2

Application: model of an electrical networks

Circuit model
Example 37 (Electrical network). Find the currents I1 (t) and I2 (t) in the
network shown in Figure 71 assuming that all charges and currents are equal
to zero at t = 0, which is when the switch is closed. Use the following values:
L = 1 henry, R1 = 4 ohms, R2 = 6 ohms C = 0.25 farad and E = 12 volt.

154

Figure 71: Electrical network

Solution
From Kirchhoffs voltage law, the loop on the left yields:
L

dI1
+ R1 (I1 I2 ) = E.
dt

If L = 1 henry, R1 = 4 ohms, R2 = 6 ohms C = 0.25 farad and E = 12 volt,


then:
I10 + 4(I1 I2 ) = 12.
Again from Kirchhoffs voltage law, the loop on the right yields:
Z
1
I2 dt + R2 I2 + R1 (I2 I1 ) = 0.
C
To eliminate the integral, we can differentiate with respect to the time t to
obtain:
I2
+ R2 I20 + R1 (I20 I10 ) = 0.
C
If L = 1 henry, R1 = 4 ohms, R2 = 6 ohms C = 0.25 farad and E = 12 volt,
then:
I2
C
10I20 4I10 + 4I2

(R2 + R1 )I20 R1 I10 +

I20

0.4I10

+ 0.4I2

0.

But since I10 = 4(I1 I2 ) + 12 (see above) then we get:


I20 = 1.6I1 + 1.2I2 + 4.8.

155

So, our system of DEs is:


I10

4I1 + 4I2 + 12,

I20

1.6I1 + 1.2I2 + 4.8.

In matrix form:
J0 = AJ + g
where


J=

I1
I2


,

A=

4.0
1.6

4.0
1.2


,

g=

12.0
4.8


.

This is a non-homogeneous linear system. We can try to solve this as we did


for a single equation.
That is, we first solve the corresponding homogeneous system:
J0 AJ = 0.
Set
J = xet
so that
J0 = xet .
But, from above,
xet = J0 = AJ = Axet .
Therefore:

Ax = x

(A I)x = 0.

To obtain a non-trivial solution (x 6= 0), we must find the eigenvalues of A


and the corresponding eigenvectors.



4 4.0


det(A I) =
1.6
1.2
=

(4 )(1.2 ) + 4 1.6

= 2 + 2.8 + 1.6 = 0
with eigenvalues 1 = 2 and 2 = 0.8.
The corresponding eigenvectors are obtained from
(A I)x = 0.
In components:
(4.0 )x1 + 4.0x2
1.6x1 + (1.2 )x2

= 0,
= 0.

Set = 2:
(4.0 + 2.0)x1 + 4.0x2
1.6x1 + (1.2 + 2.0)x2

= 2.0x1 + 4.0x2 = 0
= 1.6x1 + 3.2x2 = 0

156

with solution x1 = 2, x2 = 1. Thus an eigenvector of A corresponding to the


eigenvalue 1 = 2 is:
 
2
1
x =
.
1
Similarly, an eigenvector corresponding to 2 = 0.8 is (check!):


1
x2 =
.
0.8
Therefore, a general solution to the homogeneous system is:
Jh = c1 x1 e2t + c2 x2 e0.8t .
Now we need a particular solution Jp .
Since g is constant, we can try a constant vector


a1
Jp = a =
a2
which gives J0p = 0. Substitution in
J0 = AJ + g
gives:
0 = Aa + g.
In components:
4.0a1 + 4.0a2 + 12
1.6a1 + 1.2a2 + 4.8
with solution a1 = 3, a2 = 0.
Therefore:


Jp = a =

3
0

=0
=0

and the general solution to the non-homogeneous system is:


J = Jh + Jp = c1 x1 e2t + c2 x2 e0.8t + a.
In components:
I1
I2

= 2c1 e2t + c2 e0.8t + 3,


= c1 e2t + 0.8c2 e0.8t .

The initial conditions are I1 (0) = 0 and I2 (0) = 0, therefore:


0
0

= 2c1 + c2 + 3,
= c1 + 0.8c2 .

with solution c1 = 4, c2 = 5.
157

Therefore the solution is:


= 8e2t + 5e0.8t + 3,
= 4e2t + 4e0.8t .

I1
I2

As you can see in Figures 72 and 73, I1 3 when t and I2 0 when


t (do you know why?).

3
t

Figure 72: The upper curve is I1 and the bottom curve I2

9.4

Conversion of a nth order differential equation to a


system

Higher order differential equations


An nth order differential equation looks like:
y (n) + pn1 (x)y (n1) + pn2 (x)y (n2) + p1 (x)y 0 + p0 (x)y = r(x).
If r(x) 6= 0 the DE is non-homogeneous and if r(x) = 0 is homogeneous.
We can write the DE as:
y (n) = pn1 (x)y (n1) pn2 (x)y (n2) p1 (x)y 0 p0 (x)y + r(x).
We can always reduce the above DE into a system of n first order DEs by
setting:
y1 = y,
y2 = y 0 ,
y3 = y 00 , , yn = y (n1) .
158

1.2

0.8

0.6

0.4

0.2

Figure 73: Trajectory in the I1 I2 plane

So we obtain the first order system:


y10
y20
y30
..
.

=
=
=

y2
y 00 = y3
y (3) = y4
..
.

0
yn1
0
yn

=
=
=

y (n1) = yn
yn
pn1 (x)y (n1) pn2 (x)y (n2) p1 (x)y 0 p0 (x)y
+r(x)
pn1 (x)yn pn2 (x)yn1 p1 (x)y2 p0 (x)y1 + r(x)

That is, y0 = Ay + g, or

0
1
0
y10

0
0
1
0

y2

0
0
0
.. =

..
..
..
.

.
.
.
0

yn1

0
0
0
yn0
p0 (x) p1 (x) p2 (x)

159

0
0
0
..
.

0
0
0
..
.

pn2 (x) pn1 (x)

y1

y2

..
.

yn1

yn

0
0
..
.
0
r(x)

9.4.1

Example: Higher order differential equations

Higher order differential equations example


Example 38 (High order differential equations). Lets express the differential
equation:
d3 y
d2 y
dy
d4 y
6 3 +7 2 +6
8y = 0
4
dt
dt
dt
dt
as a system of first order DEs.
Solution
We set y1 = y and then we have:
y10
y20
y30
y40

= y2 ,
= y3 ,
= y4 ,
= 6y4 7y3 6y2 + 8y1 .

In matrix form:

0
y10
y20 0
0 =
y3 0
8
y40

1
0
0
6

The characteristic equation is:



1
0

0

1
det(A I) =
0
0


8
6 7

0
1
0
7

y1
0
y2
0

1 y3
6
y4

0
= 4 6 3 + 7 2 + 6 8 = 0

1
6

with solutions 1 = 1, 2 = 1, 3 = 2, 4 = 4.
These are the four eigenvalues of A. To find the corresponding eigenvectors,
we must solve (A I)x = 0. In components:
x1

8x1

+x2
x2
6x2

+x3
x3
7x3

The eigenvectors corresponding


4 = 4 are, respectively:

1
1

1
2

1
x1 =
1 , x = 1
1
1

+x4
+(6 )x4

= 0,
= 0,
= 0,
= 0.

to the eigenvalues 1 = 1, 2 = 1, 3 = 2,

1
2

x3 =
4 ,
8

160

1
4

x4 =
16 .
64

The solution is:


t

y = c1 x1 et + c2 x2 e + c3 x3 e2t + c4 x4 e4t .
In components:
y1
y2
y3
y4

9.5

= c1 et + c2 et + c3 e2t + c4 e4t
= c1 et + c2 et + 2c3 e2t + 4c4 e4t
= c1 et + c2 et + 4c3 e2t + 16c4 e4t
= c1 et + c2 et + 8c3 e2t + 64c4 e4t

Homogeneous systems with constant coefficients

Homogeneous systems with constant coefficients


Consider the homogeneous linear system:
y0 = Ay
where A is a constant n n matrix (that is, the matrix elements do not
depend on t). If this matrix has a set of n linearly independent eigenvectors,
then the general solution of the linear system is
y = c1 x1 e1 t + + c2 xn en t .

161

10
10.1

Systems of differential equations: Phase planes


Phase planes

Phase plans
Lets consider now homogeneous systems of two differential equations with
constant coefficients. Thus, if A is a 2 2 matrix, then the system
y0 = Ay
can be written, in components,
y10
y20

= a11 y1 + a12 y2 ,
= a21 y1 + a22 y2 .

To visualise the solution, we can either plot y1 and y2 as functions of the


independent variable t, or we can plot y2 against y1 in the y1 y2 -plane (the phase
plane). A curve in the y1 y2 -plane is called either a trajectory or an orbit or
path. Many trajectories in the phase plane give a phase-portrait of the system
of DEs.
Note that if we write:
dy2
=
dy1

dy2
dt
dy1
dt

a21 y1 + a22 y2
a11 y1 + a12 y2

every point (y1 , y2 ) has a unique tangent except for the point (0, 0) where the
RHS becomes 0/0. Thus the point (0, 0) in the phase plane is a critical point of
the system of DEs.
The characteristic equation of :
y10
y20

= a11 y1 + a12 y2
= a21 y1 + a22 y2

is given by:
2 (a11 + a22 ) + (a11 a22 a12 a21 ) = 0.
The long-term behaviour of the solution (t ) depends on the roots 1
and 2 of the characteristic equation above (positive, negative, complex, etc.).
We will see in the following examples that the nature of the roots will lead to six
types of critical points, called improper nodes, proper nodes, degenerate nodes,
saddle points, centre points and spiral points.
We will also classify the point as being stable or unstable according to the
following definitions.
A point C is a stable critical point if for every disk D of radius  > 0 centred
on the critical point there is a disk D of radius > 0 such that every trajectory
passing through a point in D at a certain t = t1 has all its points in D at
t > t1 (see figure, left panel).
A critical point C is asymptotically stable (or stable and attractive) if every
trajectory approaches the critical point as t (see Figure 74, right panel).
Finally, a critical point C is unstable if it is not stable!
162

Figure 74: Left: C is a stable critical point. Right: C is an asymptotically


stable critical point.

10.1.1

Real and distinct roots of same sign: improper node

Improper node
Consider the system:
y10
y20

1
det(A I) =
3

= y1 2y2 ,
= 3y1 4y2 .


2
= (1 ) (4 ) + 6 = 2 + 3 + 2 = 0.
4

The roots of the characteristic equation are 1 = 1 and 2 = 2, that is,


they are real, distinct and negative.
The eigenvectors are obtained from (A I)x = 0. In components:
(1 )x1
3x1

2x2
(4 )x2

= 0,
= 0.

The eigenvectors corresponding to the eigenvalues 1 = 1 and 2 = 2


are:


 
1
2
, x2 =
.
x1 =
1
3
Thus, the solution is:
y = c1 x1 et + c2 x2 e

2t

In components:
y1 (t)
y2 (t)

= c1 et + 2c2 e2t ,
= c1 et + 3c2 e2t .

Figure 75 shows the phase portrait of some of the trajectories. The straight
lines correspond to the trajectories obtained by setting c1 = 0 and c2 = 0. Note
163

Improper node
10

y2(t)

-5

-10

5
y1(t)

10

-5

-10

Figure 75: asymptotically stable improper node

that the trajectories are moving toward the origin. For this reason the origin is
called an asymptotically stable improper node.
Consider now the system:
y10
y20

det(A I)


7
=
6

= 7y1 2y2 ,
= 6y1 y2 .

2
= (7 ) (1 ) + 12
1

= 2 6 + 5 = 0.
The roots of the characteristic equation are 1 = 1 and 2 = 5, that is, now
they are real, distinct and positive.
The eigenvectors are obtained from (A I)x = 0. In components:
(7 )x1
6x1

2x2
(1 )x2

= 0,
= 0.

The eigenvectors corresponding to the eigenvalues 1 = 1 and 2 = 5 are:


 
 
1
1
1
2
x =
, x =
.
3
1
164

Thus, the solution is:


5t

y = c1 x1 et + c2 x2 e .
In components:
y1 (t) = c1 et + c2 e5t ,
y2 (t) = 3c1 et + c2 e5t .
Figure 76 shows the phase portrait of some of the trajectories. The straight
lines correspond again to the trajectories obtained by setting c1 = 0 and c2 = 0.
Note that the trajectories are now moving away from the origin. For this reason
the origin is called an unstable improper node.

Improper node
10

y2(t)

-10

-5

5
y1(t)

10

-5

-10

Figure 76: Unstable improper node

10.1.2

Real roots of opposite signs: saddle point

Saddle points
Consider the system:
y10
y20

3
det(A I) =
2

= 3y1 2y2 ,
= 2y1 2y2 .


2
= (3 ) (2 ) + 4 = 2 2 = 0.
2
165

The roots of the characteristic equation are 1 = 1 and 2 = 2, that is, they
are real, distinct and of opposite sign.
The eigenvectors are obtained from (A I)x = 0. In components:
(3 )x1
2x1

2x2
(2 )x2

= 0,
= 0.

The eigenvectors corresponding to the eigenvalues 1 = 1 and 2 = 2 are:


 
 
1
2
1
2
x =
, x =
.
2
1
Thus, the solution is:
2t

y = c1 x1 et + c2 x2 e .
In components:
y1 (t) = c1 et + 2c2 e2t ,
y2 (t) = 2c1 et + c2 e2t .
Figure 77 shows the phase portrait of some of the trajectories. The origin
is unstable, since although there are trajectories that pass arbitrarily near it,
these then move away from it. There are only two trajectories that approach the
origin, but these are the only ones. In this case, the origin is called an unstable
saddle point.
10.1.3

Complex roots (i): spiral point

Spiral point
Consider

det(A I)

y10
y20

1
=
2

= y1 + 2y2 ,
= 2y1 y2 .


2
= (1 ) (1 ) + 4
1

= 2 + 2 + 5 = 0.
The roots of the characteristic equation are 1 = 1 + 2i and 2 = 1 2i, that
is, they are complex roots, but not pure imaginary (well see this case later).
The eigenvectors corresponding to the eigenvalues 1 = 1 + 2i and 2 =
1 2i are, respectively:
 


1
1
1
2
x =
, x =
.
i
i
Thus, the solution is:
y = c1 x1 e(1+2i)t + c2 x2 e
166

(12i)t

Saddle point

y2(t)
2

-4

-2

2
y1(t)

-2

-4

Figure 77: Unstable saddle point

In components:
y1 (t) = c1 e(1+2i)t + c2 e(12i)t ,
y2 (t) = ic1 e(1+2i)t ic2 e(12i)t .
As in the case of single DEs, we can write the solution in terms of cos and
sin by using Eulers formula as follows.
y1 (t)

= c1 e(1+2i)t + c2 e(12i)t
= c1 et [cos(2t) + i sin(2t)] + c2 et [cos(2t) i sin(2t)]
= et [cos(2t) (c1 + c2 ) + i sin(2t) (c1 c2 )]
= et [A cos(2t) + B sin(2t)] .

where A = (c1 + c2 ) and B = i(c1 c2 ).


In order to have real values for A and B, one should choose c1 and c2 to be
complex conjugates (i.e. c1 = (A + iB)/2, c2 = (A iB)/2). And:
y2 (t)

= ic1 e(1+2i)t ic2 e(12i)t


= ic1 et [cos(2t) + i sin(2t)] ic2 et [cos(2t) i sin(2t)]
= c1 et [i cos(2t) sin(2t)] + c2 et [i cos(2t) sin(2t)]
= et [cos(2t) (ic1 ic2 ) sin(2t) (c1 + c2 )]
= et [B cos(2t) A sin(2t)] .
167

Figure 78 shows the phase portrait of some of the trajectories. The origin is
a stable spiral point. In general, spiral points are unstable if a11 > 0 and stable
if a11 < 0.

Spiral point
10

y2(t)

-10

-5

5
y1(t)

10

-5

-10

Figure 78: Stable spiral point


To better see the reason why we get trajectories that spiral in or out of the
origin take again the system of DEs:
y10
y20

= y1 + 2y2 ,
= 2y1 y2 .

Multiply the first equation by y1 and the second by y2 then add them up:
y1 y10 = y12 + 2y1 y2
y2 y20 = 2y1 y2 y22
y1 y10 + y2 y20 = (y12 + y22 ).
Lets now use polar coordinates (r, ) and set r2 = (y12 + y22 ). Thus
1 dr2
= y1 y10 + y2 y20
2 d
then:

1 dr2
= r2 .
2 d
168

Separate the variables and integrate:


1 dr 2
d
2 Rr 2 =
R
1
dr 2
=
d
2
2
r
log(r 2 )
= + c
2
log r
+
c

e
=e
r = ce

= ce

which gives the equation of a spiral in polar coordinates once we set c equal to
any real number.
10.1.4

Complex pure imaginary roots (i): Centre point

Centre point
Consider

y10 = 2y1 5y2 ,


y20 = y1 2y2 .


2
5

= 2 + 1 = 0.
det(A I) =
1
2

The roots of the characteristic equation are 1 = i and 2 = i, that is, they
are pure imaginary.
The corresponding eigenvectors are, respectively:




2+i
2i
x1 =
, x2 =
.
1
1
Thus, the solution is:
y = c1 x1 eit + c2 x2 e

it

In components:
y1 (t) = c1 (2 + i)eit + c2 (2 i)eit .
y2 (t) = c1 eit + c2 eit .
We can write again the solution in terms of cos and sin by using Eulers
formula as follows.
y1 (t)

= c1 (2 + i) [cos t + i sin t] + c2 (2 i) [cos


 t i sin t]t 
= (c1 + c2 ) [2 cos t sin t] + 2i(c1 c2 ) sin t + cos
2
= A [2 cos t sin t] + B [2 sin t + cos t]

And:
y2 (t)

= c1 [cos t + i sin t] + c2 [cos t i sin t]


= (c1 + c2 ) cos t + i(c1 c2 ) sin t
= A cos t + B sin t
169

where we have again A = (c1 +c2 ) and B = i(c1 c2 ). If c1 and c2 are complex
conjugates the solutions are real.
Figure 79 shows the phase portrait of some of the trajectories. This shows
that the trajectories are ellipses centred around the origin. As you can see, in
this case, the origin is stable, but not asymptotically stable, since the solutions
never approach zero. Thus, the origin is called a stable centre point (or vortex).

Centre point
10

y2(t)

-10

-5

5
y1(t)

10

-5

-10

Figure 79: Centre point

10.1.5

Equal roots: proper node

Proper node
In case of equal roots, the general solution is of the form (well see this later):

y = c1 xet + c2 xtet + uet .
The trajectories for this case are very different depending on whether the
term tet is present or not. Consider first the simpler case when this term is
not there. Illustrative of this case is the following system:
y10
y20

= y1 ,
= y2 .

Here, we can see immediately that the characteristic equation is:


(1 )2 = 0
170

and that = 1 is a double root.


The solution is
y1 (t)
y2 (t)

= c1 et ,
= c2 et .

Figure 80 shows the phase portrait of some of the trajectories which are
all straight lines of equation y2 = cc12 y1 . Note that the trajectories are moving
toward the origin. The origin is called a stable proper node.

Proper node
10

y2(t)

-10

-5

5
y1(t)

10

-5

-10

Figure 80: Stable proper node

If we now change the system to


y10
y20

= y1 ,
= y2 .

Now the double root is = 1 and the solution is given by:


y1 (t) = c1 et ,
y2 (t) = c2 et .
This gives again trajectories which are straight lines of equation y2 = cc12 y1 ,
although now the trajectories move away from the origin. The origin is called
an unstable proper node (the figure is the same as Figure 80, but with the arrows
pointing outward).

171

10.1.6

Equal roots: degenerate node

Degenerate node
Consider the system:
y10
y20

= 23 y1 + y2 ,
= 41 y1 12 y2 .


3


1
2


det(A I) =
1
1
4
2



3
1
1
=
+
+ + = 2 + 2 + 1.
2
2
4
The characteristic equation has a double root = 1.
The corresponding eigenvector is:
 
2
x=
.
1
Since in this case the general solution is given by (well see why later)

y = c1 xet + c2 xtet + uet .
We must find u. Therefore, we must solve
(A I)u = x
for u. Since = 1, then:
 3
2 + 1
(A + I)u =
41

1
21 + 1



u1
u2


=

In components:
12 u1 + u2
14 u1 + 12 u2

=2
=1

which gives u1 = 2 and u2 = 3, thus



u=

2
3


.

The general solution is given by:



y = c1 xet + c2 xtet + uet .
In components:
y1
y2

= 2c1 et + 2c2 (tet + et ) ,


= c1 et + c2 (tet + 3et ) .
172

2
1


.

Figure 81 shows the phase portrait of some of the trajectories. Note that
the trajectories are all moving toward the origin. The origin is called a stable
degenerate node (although in many books this is also called improper node).
If the eigenvalue had been a positive double root, we would have obtained a
similar phase portrait, but with the trajectories moving away from the centre,
thus giving rise to an unstable degenerate node.

Degenerate node
10

y2(t)

-10

-5

5
y1(t)

10

-5

-10

Figure 81: Stable degenerate node

10.2

Summary of critical points and stability

Summary
Given the homogeneous systems of differential equations with constant coefficients:
y0 = Ay,
If A is a 2 2 matrix, then the system can be written, in components,
y10
y20

= a11 y1 + a12 y2 ,
= a21 y1 + a22 y2 .

The characteristic equation of the matrix A is given by:


2 (a11 + a22 ) + (a11 a22 a12 a21 ) = 0.

173

Table 2: Critical points & stability


Purely imaginary roots
1 = i, 2 = i

Centre
(or vortex)

Stable

Complex roots
1 = + i, 2 = i

Spiral point

Stable if < 0
Unstable if > 0

Unequal real roots of opposite sign


1 2 < 0

Saddle point

Unstable

Unequal real roots of the same sign


1 2 > 0

Improper node

Stable if 1 < 0, 2 < 0


Unstable if 1 > 0, 2 > 0

Equal real roots


1 = 2
tet absent in solution

Proper node

Stable if 1 = 2 < 0
Unstable if 1 = 2 > 0

Equal real roots


1 = 2
tet present in solution

Degenerate node
(or improper)

Stable if 1 = 2 < 0
Unstable if 1 = 2 > 0

We have seen that the roots 1 and 2 of the characteristic equation determine the type of critical point and whether this is stable or not. Thus, we can
summarise our results in Table 2.

10.3

No basis of eigenvectors available

No basis
We have seen that it is possible for a matrix A to have a double eigenvalue
1 = 2 (by the way, this could happen with a matrix of any size). In the
example given above, we determined one solution y(1) = xet by finding the
eigenvector x corresponding to the eigenvalue , then we calculated a second
solution y(2) by taking:
y(2) = xtet + uet .
(u is currently unkown)
We justify now why this works.
Consider the following homogeneous systems of differential equations with
174

constant coefficients:
y0 = Ay.
Thus:

y(2)

= xet + xtet + uet


= Ay(2)
= Axtet + Auet .

Then, since Ax = x:
xet + uet

= Auet .

Now divide by et and get


x + u
(A I)u

= Au
= x.

By solving the above system for u, one can determine the second solution
y(2) .
Now, if A is a n n matrix (n > 3) with a triple eigenvalue, then a second
solution is given by (as before):
y(2) = xtet + uet .
And a third solution can be obtained by taking:
y(3) =

1 2 t
xt e + utet + vet
2

with v satisfying:
(A I)v = u.

175

11
11.1

Nonlinear systems of differential equations


Nonlinear systems

Nonlinear systems
Definition 22 (Autonomous). A differential equation where y is the dependent
variable and t is the independent variable is said to be autonomous if it has the
form:
dy
= some function of y but not of t.
dt
Similarly, an autonomous system of two DEs is of the form:
dy1
dt
dy2
dt

some function of y1 and y2 but not of t,

another function of y1 and y2 but not of t.

In other words,
dy1
dt
dy2
dt

f1 (y1 , y2 ),

f2 (y1 , y2 ).

The vast majority of physical systems are autonomous, since the laws of
physics are time-independent. Nonautonomous systems may arise because of
the introduction of forcing terms (such as the time dependent electromotive
force in electrical circuits).
Autonomous systems give rise to time-independent phase portraits which can
be successfully used to interpret at least qualitatively the behaviour of systems
of DEs. This is particularly important for nonlinear systems, since these are
often impossible to solve analytically.
Many of the stability results that we saw in the previous sections can be
applied to nonlinear systems, provided that these are not strongly nonlinear
(that is, the nonlinear component of the system is small compared to the linear component). In this section well see how to apply qualitative methods to
autonomous nonlinear systems with isolated critical points (a critical point y0
is said to be isolated if there is a neighbourhood of y0 in which y0 is the only
critical point). We will also assume that y0 is always at the origin, since if
y0 = (a, b) we can always apply the translation:
y1 = y1 a,

y2 = y2 b

to move the critical point to the origin.

176

11.2

Linearisation of nonlinear systems

Linearisation
Consider the system of nonlinear DEs:
y10

= f1 (y1 , y2 ),

y20

= f2 (y1 , y2 ).

Let (0, 0) be a critical point of this system and f1 and f2 continuous with
continuous partial derivatives in a neighbourhood of (0, 0).
Then we can expand f1 and f2 about this point and write the system as:
y0 = Ay + h(y1 , y2 ).
In components:
y10
y20

= a11 y1 + a12 y2 + h1 (y1 , y2 ),


= a21 y1 + a22 y2 + h2 (y1 , y2 ).

Where A is a constant (i.e. independent of t) matrix since the system is


autonomous and h1 (y1 , y2 ) and h2 (y1 , y2 ) are higher order terms in y1 and y2 .
It is possible to prove that if det A 6= 0 then the type of point and stability
of (0, 0) are the same as those of the linear system:
y0 = Ay.
We have linearised the system of DEs.
11.2.1

Example

Example solution of nonlinear system


Example 39 (Nonlinear System). Characterise the behaviour of
dy1
dt
dy2
dt

y1 (y2 1)

(3)

4 y12 y22

(4)

near the equilibrium points.


The first step is to solve
0

= y1 (y2 1)

4 y12 y22

to get the following equilibrium points (0, 2) and ( 3, 1). Let us firstly look
at (0, 2).

177

Let x1 = y1 and x2 = y2 2. Then we rewrite (3) and (4) as


dx1
dt
dx2
dt

= x1 (x2 + 1) = x1 x2 + x1
=

4 x21 (x2 + 2) = x21 x22 4x2 .

When x1 0 and x2 0, x1 x2 + x1 x1 and x21 x22 4x2 4x2 . In


matrix form, the linearised system is


1 0
0
x = Ax =
x.
0 4
The eigenvalues of A are 1 and -4, so (0, 2) is an unstable saddle point.
Now consider the equilibrium point (0, 2).
Let x1 = y1 and x2 = y2 + 2. Then we rewrite (3) and (4) as
dx1
dt
dx2
dt

= x1 (x2 3) = x1 x2 3x1
=

4 x21 (x2 2) = x21 x22 + 4x2 .

When x1 0 and x2 0, x1 x2 3x1 3x1 and x21 x22 + 4x2 4x2 . In


matrix form, the linearised system is


3 0
0
x = Ax =
x.
0 4
The eigenvalues of A are -3 and 4,
so (0, 2) is an unstable saddle point.
Look at the equilibrium
point
(
3, 1).

We set x1 = y1 3 and x2 = y2 1. In which case (3) and (4) can be


rewritten as

dx1
= (x1 + 3)x2 = x1 x2 + 3x2
dt

2

dx2
2
= 4 x1 + 3 (x2 + 1) = x21 2 3x1 x22 2x2 .
dt
When x1 0 and x2 0,


0
3
0
x Ax =
x.
2 3 2

The determinant
of (AI) is (+2)+6, so the eigenvalues of A are 1 5i.

Therefore, ( 3, 1) is a stable spiral point.

Look at the equilibrium


point ( 3, 1).

We set x1 = y1 + 3 and x2 = y2 1. In which case (3) and (4) can be


rewritten as

dx1
= (x1 3)x2 = x1 x2 3x2
dt

2

dx2
2
= 4 x1 3 (x2 + 1) = x21 + 2 3x1 x22 2x2 .
dt
178

When x1 0 and x2 0,

3
x.
2

The determinant of (A I) is ( + 2) + 6, so ( 3, 1) is also a stable spiral


point.
The solution of (3) and (4) as obtained by Matlab is given in Figure 82.
The behaviour around the equilibrium points is evident in the plot.


0
x Ax =
2 3
0

5
4
3
2

y2

1
0
1
2
3
4
5
5

0
y1

Figure 82: Solution of the nonlinear system of ODES given in (3) and (4)

11.3
11.3.1

Applications
Application: Macroeconomics Model

A macroeconomics model
Consider the following model for the national income identity
Y (t) = C(t) + I(t) + D(t),
where
I(t) = K 0 (t) is the investment,
Y (t) = b0 + b1 K(t) is the real income (b0 , b1 > 0),
179

C(t) = a1 Y (t) is the real consumption (0 < a1 < 1) and


D(t) = a2 K(t) the depreciation of capital (a2 < 0);
as functions of time t. So, as a function of K the national income identity is
K 0 = b0 (1 a1 ) + [b1 (1 a1 ) a2 ] K.
The above definition talks about the real income and the real consumption.
We take a real variable to be one where the effects of inflation have been taken
into account. A nominal variable, used below, is one where the effects of inflation
have not been taken into account. So, the real variable is the nominal variable
minus inflation.
For example, suppose we buy a 1 year bond that pays 6% at the end of the
year. If we pay $100 at the beginning of the year, we get $106 at the end of the
year. The nominal interest rate is 6%.
Now suppose the inflation rate for that year is 3%. That means that a basket
of goods that would have cost $100 at the beginning of the year will cost $103
at the end of the year. So, after factoring the interest rate into account, the
amount of income we get from the $100 bond is $3. The real interest rate is 3%.
The demand for money
The supply of money is the number of dollars available to be held in wallets
and bank accounts. The demand for money is the amount of money that people
want to hold. For example, the demand for money increases around Christmas
when people require cash to purchase goods.
The number of transactions made in an economy tends to increase as income
rises. Hence, as income rises, the demand for money rises.
The demand for money also depends on the nominal interest rate. When
money is invested it cant be used to purchase goods (trade off between spending
and saving).
Take the real demand for money M (t) as a linear function of income and
nominal interest rate R(t)
M (t) = c1 Y (t) c2 R(t),

0 < c1 , c2 .

Finally, take the percentage growth rate of real demand for money as the
growth rate of nominal money supply minus the inflation rate. We will assume
the real interest rate is the constant b1 , so the inflation rate is R(t) b1 . If the
growth rate of nominal money supply is c0 > 0,
M0
M

= c0 (R(t) b1 )


c1 Y M
= c0
b1
c2


b0 c1
b1 c1
1
=
c0 + b1

K + M.
c2
c2
c2
180

Combining the national income identity and demand for money we get the
following system of differential equations
K0
M0

= b0 (1 a1 ) + [b1 (1 a1 ) a2 ] K,


b1 c1
1
b0 c 1
M
KM + M 2 .
=
c0 + b1
c2
c2
c2

To simplify the notation, rewrite the system as


K0

1 + 2 K,

1 M 2 KM + 3 M 2 ,

where 1 = b0 (1 a1 ), 2 = b1 (1 a1 ) a2 , 1 = c0 + b1
3 = c12 .

(5)
b0 c1
c2 ,

2 =

b1 c1
c2

and

Equilibrium Points
From the first equation, we see that K 0 = 0 when
K=

1
.
2

From the second equation, we get M 0 = 0 when


M = 0, or M =

2 1 + 1 2
3 2

Stability at equilbrium points


2 1 +1 2
1
.
We now consider the equilibrium point K =
2 and M =
3 2
As a specific example let a1 = 4/5, a2 = 1/10, b0 = 20, b1 = 1/5, c0 = 1/10,
c1 = 2/5 and c2 = 3/2. In which case 1 = 4, 2 = 3/50, 1 = 151/30,
2 = 4/75, 3 = 2/3 and the equilbrium points occur at K = 200/3 and
M = 773/60.
Set X = K 200/3 and Y = M 773/60 and substitute into Equation (5)
to get
X0

= 3/50X,

Y0

773/90Y 773/1125X 4/75XY + 2/3Y 2 .

In matrix form, the system that approximates the solution around the equilbrium point is
z 0 = Az,
where
z=

 
X
Y


and A =

3/50
773/1125

181


0
.
773/90

As the system has one positive and one negative eigenvalue, we know the
equilbrium point is a saddle point and is unstable.
We follow a similar procedure to determine the behaviour around the second
1
equilbrium point K =
2 = 200/3 and M = 0.
Set X = K 200/3 and Y = M and substitute into Equation (5) to get
X0

3/50X,

Y0

2319/270Y 4/75XY + 2/3Y 2 .

The linear system that approximates this equation has




3/50
0
A=
.
0
2319/270
As both eigenvalues are negative, this equilbrium point is stable.
As plot of the solution around the first equilibrium point is given in Figure
??
Econometrics Example
14

13.5

13

12.5

12

11.5

11
60

62

64

66

68

70
K

72

74

76

78

80

Figure 83: Solution of the econometrics example around the equilibrium point
K = 200/3 67 and M = 773/60 12.9

11.3.2

Application: undamped pendulum

Undamped pendulum
Consider a pendulum consisting of a bob of mass m attached to a rod of
length L, as shown in Figure 84. If is the angle the pendulum makes with
the vertical and g is the gravitational constant, the differential equation that
governs the motion of the pendulum, if air and rod resistance are neglected, is:
mL00 + mg sin = 0.

182

Figure 84: A pendulum

If we divide by mL we get:
00 + k sin = 0,

k=

g
.
L

This is a nonlinear second order differential equation for which the solution
cannot be given in terms of elementary functions. Consequently, the motion
of the pendulum can be studied only through numerical work and phase plane
analyses.
Nevertheless, when is very small, we can write sin and we get:
00 + k = 0
with solution:

= A cos( kt) + B sin( kt).

However, the above is only an approximate solution and if we want to study


the motion of the pendulum for any displacement from the equilibrium position, then we can proceed as follows.
First transform the second order nonlinear DE 00 + k sin = 0 into a first
order nonlinear system by letting = y1 and 0 = y2 . So we obtain:
y10

= y2 ,

y20

= k sin y1 .

183

Both RHSs are equal to zero when y2 = 0 and k sin y1 = 0. Thus there are
infinitely many critical points at (n, 0), where n = 0, 1, 2, .
Consider first (0, 0) and linearise the system by expanding in Maclaurin
series:
1
sin y1 = y1 y13 + y1 .
6
The linearised system at (0, 0) is:
y10
y20

= y2 ,
= ky1 .

In matrix form:
y0 = Ay =

0
k

1
0


y.

The eigenvalues of A are:




1
= 2 + k = 0.
det(A I) =
k

That is, 1 = i k and 1 = i k. Thus, the point (0, 0) is a centre, which


is always stable. Since the function sin is periodic, our results will also hold for
n = 2, 4, , that is, all these points are also centres.
Consider now the critical point (, 0). We will apply the translation:
y1 = ,

y10 = ( )0 = 0 = y2 ,

1
sin(y1 + ) = sin y1 = y1 + y13 y1 .
6
The linearised system at is:
y10
y20

= y2 ,
= ky1 .

In matrix form:
y0 = Ay =

0
k

1
0


y

with eigenvalues 1 = k and 1 = k.


Thus, the point (, 0) is a saddle point, which is always unstable. Since the
function sin is periodic, this result will also hold for n = 1, 3, , that is, all
these points are also saddle points. See Figure 85.
11.3.3

Application: damped pendulum

Damping
Lets see now what happens if we introduce a damping term which is proportional to the angular velocity 0 :
00 + c0 + k sin = 0.
184

Undamped pendulum Vibrations

y(t) 0

-1

-2

-8

-6

-4

-2

0
x(t)

Figure 85: Phase portrait of a pendulum oscillations with no damping

Here, c is the damping constant (> 0) and k = g/L. Set now = y1 and
0 = y2 as before. So we obtain:
y10

= y2 ,

y20

= k sin y1 cy2 .

Both RHSs are again equal to zero when y2 = 0 and k sin y1 = 0. Thus
there are infinitely many critical points at (n, 0), where n = 0, 1, 2, .
Consider first (0, 0) and linearise by taking sin y1 y1 .
The linearised system at (0, 0) is:
y10
y20

= y2 ,
= ky1 cy2 .

In matrix form:
0

y = Ay =
The eigenvalues of A are:


1
det(A I) =
k c

0
k

1
c


y.



= (c + ) + k = 2 + c + k = 0,

with roots:

c2 4k
c
.
=
2
2
This result is very similar to that for the motion of a mass on a spring! Lets
see all the various possibilities:
185


(1) If c = 0, = i k, which is the result we obtained earlier in the case of
no damping. The critical point (0, 0) is a stable centre point.
(2) If c2 < 4k the roots are complex conjugates and the critical point (0, 0) is
a stable spiral point (the real part is negative, since c > 0). The motion
is underdamped.

(3) If c2 > 4k the roots are distinct, real and negative (since c > c2 4k),
and the critical point (0, 0) is a stable improper node. The motion is
overdamped.
(4) If c2 = 4k the roots are equal and negative and the critical point (0, 0) is
a stable degenerate node. The motion is critically damped.
Since the sin function is periodic, this result will also hold for n = 2, 4, .
Consider now the critical point (, 0). As earlier, we apply again the translation:
y1 = ,
y10 = ( )0 = 0 = y2 ,
1
sin(y1 + ) = sin y1 = y1 + y13 y1 .
6
The linearised system at (, 0) is:
y10
y20

= y2 ,
= ky1 cy2 .

In matrix form:
y0 = Ay =
The eigenvalues of A are:


1
det(A I) =
k c

0
k

1
c


y.



= (c + ) k = 2 + c k = 0

with roots:

c
c2 + 4k
=
.
2
2
Lets see again all the various possibilities:

(1) If c = 0, = k, which is the result we obtained earlier in the case of


no damping. The critical point (, 0) is a saddle point.

(2) If c 6= 0, since c < c2 + 4k we have two real roots of opposite sign. Thus,
the critical point (, 0) is a saddle point.

186

Damped pendulum vibrations


3

y(t) 0

-1

-2

-3
-10

-5

0
x(t)

10

Figure 86: Phase portrait of a pendulum oscillations with damping

We note again that since the sin function is periodic this result will also hold
for n = 1, 3, .
See Figure 86.
In the pendulum application, with and without damping, we have seen that
there are two critical (equilibrium) points. The equilibrium point corresponding
to (0, 0) can be identified with the pendulum position at rest pointing downward, while the equilibrium point corresponding to (0, ) can be identified with
the pendulum position at rest pointing upward. It is therefore quite easy to visualise why we found that the stable critical point was (0, 0) and that any small
perturbation applied to the pendulum away from this point would be damped
out with the pendulum returning to rest as t . Conversely, one can also
as easily imagine that a small perturbation applied to the pendulum away from
(0, ) would cause the pendulum to leave its rest position and converge to (0, 0).

187

12
12.1

Power Series Solutions


Power Series Solutions of ODEs (2nd order)

Introduction
Most non-constant coefficient DEs cannot be solved in closed form in terms
of standard analytical functions. As early as 1676, Newton considered the possibility of representing the solution by infinite series - there are many types of
series (e.g. Fourier series, Power series etc.). We consider power series.
The series method is sometimes useful also to obtain solutions to non-linear
DEs (but it is not always easy to find the coefficients in the power series expansion in this case).
The limit of the sequence
2

a0 + a1 (x x0 ) ,

a0 ,

a0 + a1 (x x0 ) + a2 (x x0 ) ,

is written

an (x x0 )

...

n=0

whenever it exists. This series is called a power series expansion about the point
x0 . Any power series has a radius of convergence such that the series
converges for |x x0 | <
diverges for |x x0 | <
If we set
f (x) =

an (x x0 )

|x x0 | <

n=0

Then, inside the interval of convergence,


convergence is absolute
convergence is uniform
f is continuous
f has derivatives of all order
an =

f (n) (x0 )
n!

Ratio Test: convergent for






n+1
a
an
n+1 (x x0 )


=
lim
< 1 |x xx | < lim
n
n
n an+1

an (x x0 )
(the radius of convergence)

188

Ordinary and Singular Points


We consider homogeneous LDEs, but the method can be generaised to nonhomogeneous LDEs.
P (x)

d2 y
dy
+ Q(x)
+ R(x)y = 0
dx2
dx

We look for power series solutions about some point x0 . The nature of solution
depends on whether x0 is
an ordinary point
a singular point
R(x)
x0 is an ordinary point is the coefficients Q(x)
P (x) and P (x) of the equation in
standard form (i.e. with the coefficient of y equal to unity) are analytic at x0 .
By this we mean that they have a Taylor series expansion which converges in
some interval about x0

Q(x)
2
= a0 + a1 (x x0 ) + a2 (x x0 ) + ...
P (x)
R(x)
2
= b0 + b1 (x x0 ) + b2 (x x0 ) + ...
P (x)
Otherwise, x0 is a singular point.

Airys equation (Diffraction of lig


y 00 xy = 0

Bessels equation of order (e.g.
Three examples from Physics: x2 y 00 + xy 0 + x2 2 y = 0
1 x2 y 00 2xy 0 + ( + 1) y = 0
Legendres equation
These equations cannot be solved analytically in the general case. Note that
the coefficients are polynomials in these cases.
In Airys equation,

R(x)
P (x)

= x so there are no singular points. In Bessels

equation,
Q(x)
1
= ,
P (x)
x

R(x)
2
=1 2
P (x)
x

x = 0 is a singular point because both these functions are certainly not analytic
at x = 0. In Legendres equation,
Q(x)
2x
=
,
P (x)
1 x2

( + 1)
R(x)
=
P (x)
1 x2

x = 1 are singular points, but x = 0 is an ordinary point.


Theorem: At any ordinary point x0 , the LDE has a power series solution
of the form

X
n
y=
an (x x0 ) = a0 y1 (x) + a1 y2 (x)
n=0

189

where y1 (x), y2 (x) are linearly independent power series solutions with a radius
of convergence that is at least equal to the minimum of the radii of convergence
R(x)
of Q(x)
P (x) and P (x) .
Solution about an ordinary point
Look for solution in the form of a power series about x = x0 .
2

y = a0 + a1 (x x0 ) + a2 (x x0 ) + ... =

an (x x0 )

n=0
n1

y 0 = a1 + 2a2 (x x0 ) + ... + nan (x x0 )

+ ... =

nan (x x0 )

n1

n=1

nan (x x0 )

n1

n=0

y 00 = 2a1 + ... + n (n 1) (x x0 )

n2

+ ... =

n2

n (n 1) an (x x0 )

n=2

nan (x x0 )

n1

n=1

Substitute in DE and compare coefficients of like powers.


Some tricks
change the limits of summation for that the same power of (x x0 )
occurs inside the summation sign in each term. This you may write

P
P
n2
m
n (n 1) an (x x0 )
=
(m + 2) (m + 1) am+2 (x x0 )
(setting n = m + 2)
n=2

m=0

(n + 2) (n + 1) an+2 (x x0 )

(re-labelling dummy

n=0

index m)
change the independent variable from x to t where (x x0 ) = t transforms
the point of expansion from x = x0 to t = 0. This makes the algebra easier.
EX: Solve the equation (1 x2 )y 00 6xy 0 4y = 0 near the ordinary point
x = 0. Note: x = 1 are the only singular points in the finite plane).
6x
Q(x)
=
,
P (x)
1 x2
Set y =

an xn , y 0 =

n=0

X
n=0

n(n 1)an xn2

Q(x)
4
=
P (x)
1 x2

nan xn1 , y 00 =

n=0

n(n 1)an xn2

n=0

n(n 1)an xn 6

n=0

X
n=0

190

nan xn 4

X
n=0

an xn = 0

n(n 1)an xn2

n=0

[n(n 1) + 6n + 4] an xn = 0

n=0

n(n 1)an xn2

n=0

(n + 4) (n + 1) an xn = 0

n=0

Trick: n m 2 in last term, and re-label dummy index. Alternatively,


we could also have set n m + 2 in the first term, but this is not as elegant
because we then start a summation with negative n.

n(n 1)an x

n=0

n2

(n + 2) (n 1) an2 xn2 = 0

n=2

The coefficient
of each power must be zero. n = 1, 1 irrelevant. n 2 : an =

n+2
a
a recurrence relation Note that the subscripts in this relation
n2
n
differ by two indices, so we expect two sequences in terms of a0 and a1 .
a2 = 24 a0
a3 = 35 a1
n 2 : an = n+2
n an2
a4 = 64 a2 =

a2k =
=

64
4 2 a0

a5 =

2k+2
2k a2ks

75
5 3 a1

a2k+1 =

2k+2 2k
64
2k 2k2 ... 4 2 a0

= (k + 1) a0
"
y = a0 1 +

#
(k + 1) x

2k

23+3
2k+1 a2k1
2k+3 2k+1
75
2k+1 2k1 ... 5 3 a1
2k+3
3 a1

"
+ a1 x +

k=1

X
2k + 3
k=1

#
x

2k+1

Note 1: There are two arbitrary constants in the solution Note 2: The
nearest singular points are at x = 1. So, from the general theory of LDEs,
convergence is guaranteed at least up to |x| < 1. In fact, convergence occurs
only in this region as can be shown by elementary convergence tests for series.
Airys Equation
Sir George Airy (1801-1892), Astronomer and Mathematician came up with
the following equation in connection with the diffraction of light:
y 00 xy = 0
There is no analytical solution and the equation is solved using power series.
Note that x = 0 is an ordinary point.
The solution is oscillatory for negative x and of exponential nature for positive x.
191

Regular singular points


The nature of the solution about a singular point depends on how bad the
singularity is. The Taylor series used for an ordinary point may not work since
the solution may not be analytic at a singular point. A more general approach
is required.
We consider methods of solving LDEs when the singularity is of a mild nature
- that is we look for solutions about SINGULAR points which are REGULAR.
A singular point x0 is regular if (x x0 ) Q(x)
P (x) and (x x0 )
analytic (i.e. have a convergent Taylor series about x0 ).
That is,
Q(x)
= A0 + A1 (x x0 ) + ...
(x x0 )
P (x)
(x x0 )

2 R(x)
P (x)

are both

R(x)
= B0 + B1 (x x0 ) + ...
P (x)

which means that very close to x0 , the coefficients in the normalised equations
(i.e. DE with y 00 as the leading term) diverge as
Q(x)
A0

+ A1 + ...
P (x)
x x0
B1
B0
R(x)
+

+ ...
2
P (x)
(x x0 )
(x x0 )
One of the goals of this section is to establish the nature of the solutions near
such a singular point. We will see that depending on the equation, we could get
one or two solutions that remain bounded as x x0 or none at all!
When the solutions do diverge, it is possible to establish the nature of the
divergence.
Consider Bessels equation

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

Q(x)
1
= ,
P (x)
x
x=0 is singular.
x

Q(x)
= 1,
P (x)

x2

which is analytic about x=0.


x = 0 is a regular singular point.

192

R(x)
= 2 + x2
P (x)

Example of an irregular singular point


x3 y 00 + 2y = 0
R(x)
2
= 3
P (x)
x
and
lim x2

x0

R(x)
1
= lim
P (x) x0 x

does not exist. x = 0 is an irregular singular point.


Without loss of generality, we can consider equations about x = 0 (we first
shift x0 to the origin by the transformation z = x x0 and then re-label z by
x).
We can re-state the condition for regularity as follows: If x = 0 is a regular
singular point, the the LDE can be cast in the form x2 y 00 + xp(x)y 0 + q(x)y = 0
(book notation!)
where p(x) and q(x) are analytic with Taylor series expansions
p(x) = p0 + p1 x + ...
q(x) = q0 + q1 x + ...
If all the coefficients vanish except for p0 , q0 , the equation becomes
x2 y 00 + xp0 y 0 + q0 y = 0
where p0 and q0 are constants. This is an equation of the Euler type that can
be solved analytically.
12.1.1

Euler type equations

Solutions near a regular singular point for Euler type equations


Euler equations are non-constant coefficient LDEs of the type
L[y] = x2 y 00 + p0 xy 0 + q0 y = 0
where p0 and q0 are constants. x = 0 is clearly a regular singularity.
This equation has analytical solutions which give insight to the behaviour
of solutions near regular singular points in other cases. We look for solutions of
the type
y = Axr
x>0



L[Axr ] = A x2 r (r 1) xr2 + p0 x rxr1 + q0 xr
= Axr [r (r 1) + p0 r + q0 ]

193

L[Axr ] = 0 if r satisfies r (r 1) + p0 r + q0 = 0.
F (r) = r2 + (p0 1) r + q0 = 0 - THE INDICIAL EQUATION.
q
2
Roots of the indicial equation are r1 , r2 = 0.5 (p0 1) (p0 1) 4q0 .
Three cases for roots: real distinct, real equal or complex conjugate pair
Note: for an equation of Euler type
x2 y 00 + p0 xy 0 + q0 y = 0
if y(x) is a solution, so is y(x). For is we change x x in DE, we obtain
(x)

dy(x)
d2 y(x)
+ p0 (x)
+ q0 y(x) = 0
d(x)2
d(x)

d2 y(x)
dy(x)
+ p0 x
+ q0 y(x) = 0
dx2
dx
If y1 = f (x)(x > 0) is a solution, so is y2 = f (x)(x < 0). So all we
need is to solve the DE for x > 0, and the gneral solution (given real values) is
y = f (|x|), (x > 0 and x < 0).
x2

Note: x = 0 may be included a posteriori depending on the nature of r1 and


r2 .
REAL DISTINCT ROOTS (r1 6= r2 )
y = C1 xr1 + C2 xr2 ,
r1

y = C1 |x|

r2

+ C2 |x| ,

x>0
x > 0 or x < 0

Example: x2 y 00 2xy 0 + 2y = 00
Indicial equation: r (r 1) 2r + 2 = 0 (r 1) (r 2) = 0 - both roots
are positive.
2
y = C1 |x| + C2 |x|
Note: Even though x = 0 is a regular singular point, the solution remains finite
at x = 0. In fact, all solutions pass through the original so the initial restriction
x 6= 0 was unnecessary in this case.
Example: 2x2 y 00 + 3xy 0 = 0
2r (r 1) + 3r 1 = 0 2r2 + r 1 = (2r 1) (r + 1) = 0
Now r1 = 21 , r2 = 1 i.e. one root negative. Solution is thus
1

y = C1 |x| 2 +

C2
, x > 0, x < 0
|x|

194

The solution can diverge as x 0 (providing C2 6= 0).


EQUAL ROOTS (r1 = r2 = r) y1 (x) = xr is one solution. A second
independent solution is given by
y2 (x) =

r
r ln x
x =
e
= er ln x ln x = xr ln x
r
r

General solution is:


y = C1 xr + C2 xr ln x,
r

x>0

y = C1 |x| + C2 |x| ln |x|,

x > 0, x < 0

EXAMPLE: x2 y 00 + y/4 = 0 Indicial equation: r (r 1) + 1/4 = 0


2
(r 1/2) = 0
positive root
y = C1 x1/2 + C2 x1/2 ln x,
1/2

y = C1 |x|

1/2

+ C2 |x|

x>0

ln |x|,

x > 0, x < 0

All solutions pass through the origin.


EXAMPLE: x2 y 00 + 5xy 0 + 4y = 0 Indicial equation: r (r 1) + 5r + 4 =
2
0 (r + 2) = 0
negative root
y=
y=

C1
|x|

C2
C1
+ 2 ln x,
2
x
x
+

C2
2

|x|

ln |x|,

x>0
x > 0, x < 0

Now solutions diverge as x = 0 is approached.


COMPLEX CONJUGATE ROOTS (r1 = + i, r2 = i) Solutions are
x+i = e(+i) ln x = e ln x ei ln x = x ei ln x
xi = x ei ln x
The real and imaginary parts of either of these solutions give two independent
real solutions
x cos ( ln x), x sin ( ln x)
with the general solution given by

y = |x| [A cos ( ln |x|) + B sin ( ln |x|)]

Here the solutions are oscillatory, but converge or diverge as x = 0 is approached depending on the constants in the indicial equation (i.e. if is positive
or negative).

195

12.1.2

The Method of Frobenius

Regular Singular Point (General Case): The Method of Frobenius


In the general case x2 y 00 + xp(x)y 0 + q(x)y = 0 where x = 0 is a regular
singular point so that p(x) and q(x) are analytic with Taylor series expansions
p(x) = p0 + p1 x + ...
q(x) = q0 + q1 x + ...
we look for Euler type solutions multiplied by power series.
y=x

an x =

n=0

an xn+r

a0 6= 0

n=0

y =

an (n + r) xn+r1

n=0
00

y =

an (n + r) (n + r 1) xn+r2

n=0

x2 y 00 + xp(x)y 0 + q(x)y = 0
x2

X
an (n + r) xn+r1
an (n + r) (n + r 1) xn+r2 + x (p0 + p1 x + ...)

n=0
n=0
X
an xn+r = 0
+ (q0 + q1 x + ...)

n=0

an (n + r) (n + r 1) xn+r +(p0 + p1 x + ...)

an (n + r) xn+r +(q0 + q1 x + ...)

n=0

n=0

n=0
r

r+1

We now set the coefficients of x , x

, ... equal to zero.

xr : [r (r 1) + p0 r + q0 ] a0 = 0
For arbitrary a0 , the indicial equation is:
F (r) = r (r 1) + p0 r + q0 = 0
This equation will provide two roots and potentially two solutions of the above
type with coefficients a1 , ... of the series chosen so that the coefficients of xr+1
... vanish.
Depending on the roots of the quadratic, the general solution will a combination of one of the following types

|x|

X
n=0

an xn ,

|x| ln |x|

an xn ,

n=0

|x| cos ( ln |x|)

X
n=0

196

a n xn ,

a0 6= 0

an xn+r = 0

It turns out that depending on the nature of the real roots, it will not always
be the case that the remaining coefficients can be set to zero by solving the
recurrence relations consistently (we will illustrate this by example). But there
will always be one solution of this type for the larger of these roots.
Theorem If (> 0) is the minimum of the radii of convergence of the Taylor
series for p(x) and q(x), then the LDE has a solution of one of the above types,
where the power series incorporated in the solutions converge at least for |x| < .
In this course, we focus on on the real root case. The other cases can be
dealt with similarly.
Now it can be shown that in the real root case, there will always be at least
one solution of the type

X
r
y = |x|
an xn
n=0

In fact, suce a solution always exists, where r = r1 , the larger of the two real
roots of the indicial equations (see the following theorem).
THEOREM 5.6.1:
Suppose that the indicial roots r1 and r2 of x2 y 00 + xp(x)y 0 + q(x)y = 0 given
by the solution of F (r) = r(r 1) + p0 r + q0 = 0 are real, and that r1 r2 .
Suppose that is the minimum of the radii of convergence of p(x), q(x).
Then in either < x < 0 or 0 < x < , there is always one series solution
of the standard Frobenius form
"
#

X
r1
n
y1 (x) = |x|
1+
an (r1 )x
n=1

Case 1: If r1 r2 is not zero or a positive integer, then the second independent


solution is
#
"

X
r2
n
an (r2 )x
1+
y2 (x) = |x|
n=1

Case 2: If r1 = r2 , the second solution is


r1

y2 (x) = y1 (x) ln |x| + |x|

bn (r1 )xn

n=1

Case 3: if r1 r2 = N (a positive integer), the second solution is


r2

y2 (x) = y1 (x) ln |x| + |x|

cn (r2 )xn

n=1

The coefficients an , bn , cn , (which may be zero) are to be found by substituting the appropriate form of solution into the DE.
Note: the leasing constants in the series components have been nromalised
to unity when appropriate.
197

13

Special functions

13.1

Bessels Functions

Solutions to Bessels Equation



x2 y 00 + xy 0 + x2 2 y = 0i

(c.f. : x2 y 00 + p(x)xy 0 + q(x)y = 0)


q0 = 2

p0 = 1,

Indicial equation: r (r 1) + r 2 = 0.
We consider solutions for x > 0 (the domain of interest in most physical
problems). There is at least one solution of the form
y=

ak xr+k

k=0

y0 =

ak (r + k) xr+k1

k=0

y 00 =

ak (r + k) (r + k 1) xr+k2

k=0

Substituting these into the DE we get:

ak (r + k) (r + k 1) xr+k +

k=0

ak (r + k) xr+k +

k=0

ak xr+k+2

k=0

2 ak xr+k = 0

k=0

h
i
X
2
ak (r + k) 2 xr+k +
ak2 xr+k = 0

k=0

k=2

The coefficient of x is given by the indicial equation (must always be the case):

a0 r2 2 = 0 r = ,
which gives distinct roots providing that 6= 0. The coefficient of xr+1 is given
by
h
i
2
a1 (r + 1) 2 = 0 a1 = 0
The coefficient of xr+k is given by
h
i
2
ak (r + k) 2 = ak2

k = 2, 3, 4, ...

Hence, with r = , a0 arbitrary, a1 = 0 we get the recurrence relation


ak =

1
ak2
k (k + 2)
198

Thus, one solution is



y1 = a 0 x 1

x2
x4
+
...
2 (2 + 2) 2 (2 + 2) 4 (4 + 2)


x2
x4

= a0 x 1 2
+
...
2 (1 + ) 24 2! (1 + ) (2 + )
#
"

k 2k
X
(1)
x
= a0 x 1 +
22k k! (1 + ) (2 + ) ... (k + )

k=1

If is not an integer (the general case of rooths not difference by an integer), the second root of the indicial equation (r = ) gives a second linearly
independent solution.
This is obtained by replacing by in the above derivation, yielding
#
"

k
X
(1) x2k

= b0 x
1+
22k k! (1 ) (2 ) ... (k )
k=1

The method fails if the second root is r = = p, a negative integer, because


the coefficient of the pth term in the above sum is then indeterminate.
** So the series method gives two linearly independent solutions to Bessels
equation except in the case where is integral, in which case we have only one.
We now define BESSEL FUNCTIONS which are derived from the series
solutions as follows. They are well tabulated functions and are commonly used
in mathematical physics.
13.1.1

Bessel functions of the first kind and Gamma functions

Bessel functions of the first kind of integer order n


Assume = n (a non-negative integer) and set
a0 =

1
2n n!

Noting that n! (1 + n) ... (k + n) = (k + n)! we obtain


"
#

k
X
1 n
(1) x2k
y1 (x) = Jn (x) = n x 1 +
2 n!
22k k! (1 + n) ... (k + n)
k=1
"
#
n
n+2
n+4
(x/2)
(x/2)
(x/2)
=

+
...
n!
1! (1 + n)! 2! (n + 2)!
Jn (x) = (x/2)

X
k=0

(1)
2k
(x/2)
k! (k + n)!

Jn (x) are Bessel functions of the first kind of integral order.


199

Some properties of Bessels functions of the first kind of integer order



x2 y 00 + xy 0 + x2 n2 y = 0
A solution is
Jn (x) = (x/2)

X
k=0

n = 0, 1, 2, ...
k

(1)
2k
(x/2)
k! (k + n)!

x4
x6
x2
+

+ ...
J0 (x) = 1
4
64 2304


x
x2
x4
x6
J1 (x) =
1
+

+ ...
2
8
192 1296


x4
x6
x2 1 x2

+ ...
J2 (x) =
2 2 24 768 46080
Which gives values at x = 0 of J0 (0) = 1, J1 (0) = 0, J2 (0) = 0, and derivatives of J00 (0) = 0, J10 (0) = 21 , J20 (0) = 0.
Jn are all non-singular at the origin.
Graphs of J0 (x), J1 (x), ... represent decaying sinusoids, and we can see this
(very crudely) by comparing


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



2
1 0
y + y + 1 2 y =0
a
a
00

(2)

The characteristic equation of this constant coefficient equation (2) is




2
1
2
r + r+ 1 2 =0
a
a
with roots i. For sufficiently large x (as x a some contant value), solutions of (1) should approach those of (2) and the latter are linear combinations
of ex cos x and ex sin x - exponentially decaying sinusoids with
=

1
2a


1/2
2
1
= 1 2 2
a
4a

* the wave characteristics of Bessel functions seem very much like the shapes
of water waves generated by dropping a pebble into a pond. The equations of
hydrodynamics show that waves having the shapes of Bessel functions do arise.

200

The Gamma Function


The gamma function (z) interpolates the integer factorials. The function
is used to define the factorial of a non-integer.
Z
(z) =
xz1 ex dx
0

which converges for z > 0.


The function is infinitely differentiable
(z + 1) = z(z)
z > 0 because
Z
Z
Z
 z x 
z x
z1 x
+
zx e dx = z
(z+1) =
x e dx = x e
0
0

(1) =

R
0

xz1 ex dx

ex dx = 1

(n + 1) = n! for n=0,1,2, ... because (n + 1) = n(n) = n (n 1) (n


1) = n (n 1) ...1 = n!. Note that 0! = (1) = 1. By analogy, we write
(z + 1) = z!.

Special value: (1/2) =


  Z
1

=
ey y 1/2 dy
2
0
Substituting y = x2 gives

Z
=2
Z

ex dx

 
Z
Z Z
a
2
2
2
1
=4
ex dx
ey dy = 4
e(x +y ) dxdy

2
0
0
0
0
Change to polar coordinates: x = r cos , y = r sin . This gives


(x, y)
drd = rdrd
dxdy =
(r, )
 2
Z /2 Z
Z /2 Z

2
2
1

=4
er rdrd = 2
er d r2 d =
2
0
0
0
0

Hence (1/2) =
The values of (z) are available in tabulated form for 0 < z 1. The
recurrence relation can then be used to evaluate (z) for any other positive z.
Thus:
 
 
 
3
1
1
1
1
!=
=
=

2
2
2
2
2
 
 
 
3
5
3 1
1
3 1
!=
=
=

2
2
2 2
2
2 2
...
 
 
7
7 5 3 1
1
7 5 3 1
!=
=

2
2 2 2 2
2
2 2 2 2

201

GAMMA FUNCTION (extended) for negative z


We use the recurrence relation to define the Gamma function for 1 < z < 0
using the values in 0 < z < 1.
(z) =

(z + 1)
z

1

 

2
1

= 2
=
2
12
and then (z) for 2 < z < 1 using values in 1 < z < 0. This defines (z)
for all z except for negative INTEGRAL values.

Figure 87: Gamma function

xz1 ex dx

(z) =

z>0

(z + 1)
z<0
z
Z x

e
0+ = lim+
dx = +
x1z
z0
0

a
Z a x
Z a
e
1
ex
a
a 1 z
dx >
dx > e
dx = e
x
1z
1z
x1z
z
0 x
0 x
0
(z) =

Z
0

the latter diverges as z 0+


Bessel functions of the first kind of any order
Starting with the general solution
"
#

k
X
(1) x2k

y1 (x) = a0 x 1 +
22k k! (1 + ) ... (k + )
k=1

we now use the Gamma function to extend the definition of Bessel functions to
any order. We do this by setting
a0 =

1
2 ( + 1)
202

Using ( + 1) (1 + ) ... (k + ) = (k + + 1) we obtain


J (x) = (x/2)

X
k=0

(1)
2k
(x/2)
k! (k + + 1)

x>0

In this way, for = n, we recover the expression for Jn (x).


J1/2 (x) and J1/2 (x)
You can use the solution of Bessels equation in the form


x2
x4

y(x) = a0 x 1 2
+
...
2 1! (1 + ) 24 2! (1 + ) (2 + )
to show that
 r

2
x5
2
x3
+
... =
sin x
x
J1/2 (x) =
x
3!
5!
x
r

 r
2
2
x2
x2
J1/2 (x) =
1
+
... =
cos x
x
2!
4!
x
p
(This does not give the factor 2/. It is obtained from the definition of the
constant a0 = 1/ [2 ( + 1)] in the Bessel functions, and by use of the identities
involving the Gamma function).
r
1
1
2
=
1 =
1
1/2
1/2

2 2
2 2 +1
r

1
1
=
=
21/2 21
21/2 12 + 1

Note: J1/2 (x) is bounded, but not J1/2 (x) as x 0.


You can also obtain the above directly from the series solution for general :
J (x) =

 x  X

k=0

 x 2k
(1)
k! (k + + 1) 2

 x 1/2 X

x>0

k
 x 2k
(1)

x>0
2
k! k + 12 + 1 2
k=0
"
#
2
4
 x 1/2
1
(x/2)
(x/2)

+
 ...
=
2
32
1! 25
2! 72
"
#
1/2
2
4
(x/2)
(x/2)
(x/2)
= 1 1  1 3 1 1  + 5 3 1 1  ...
1! 2 2 2
2! 2 2 2 2
2 2

J1/2 (x) =

203

"
#
2
4
 x 1/2
1
(x/2)
(x/2)
= 1 1
1
+
...
2
1! 23
2! 52 23
2 2
"
#
2
4
(x/2)
2  x 1/2
(x/2)
1
=
+
...
2
1! 32
2! 25 32
r


2
x3
x5
=
x
+
...
x
3!
5!

Graphs of Bessel Functions of order 1/2


Graphs of J1/2 and J1/2 are given below. Note behaviour of J1/2 and J1/2
are similar to J0 and Y0 for large x, with a phase shift of /2.

J1/2 (x) =

2
x

1/2


cos x

2
x

1/2
sin x

Figure 88: Gamma functions of order 1/2

Some additional properties


J (x) =

 x  X

k=0

 x 2k
(1)
k! (k + + 1) 2

x>0

Note 1: With the above definition, and our interpretation of the Gamma
function for negative argument, it can be verified that
n

Jn = (1) Jn

n = 0, 1, 2, ...

That is, Jn and Jn are linearly dependent when n is integral.


Note 2: J and J are linearly independent when is non integral (one is
bounded, and the other unbounded as x 0).
204

A Second Linearly Independent Solution


Given one solution, it is always possible to find a second linearly independent
solution by the method of reduction of order. The general solution then takes
for form
Z
dx
y = AJ (x) + BJ (x)
2
x [J (X)]
This solution is particularly useful when is an integer, and the second solution
does not follow straightforwardly by the series method. The integral is however
difficult to evaluate and often only the leading terms follow straightforwardly.
For Bessels equation, the second solution can be obtained as follows, which
also leads us to the definition of Bessel functions of the second kind.
13.1.2

Bessel functions of the 2nd kind

Bessel functions of the second kind of any order


If is not an integer, J (x) is a second linearly independent solution.
However, for non-integral , it is traditional to define Bessels function of
the second kind as the follwoing linear combination of J (x) and J (x).
Y (x) =

cos ()J (x) J (x)


sin ()

Y (x) can then be used instead of J (x) as the second linearly independent
solution. For example,one would not use J1/2 (x), but rather Y1/2 (x).
When is an integer (roots differ by an integer) the method of Frobenius
(cases 2 and 3 discussed in theorem) can be used to derive a second set of
linearly independent solutions. They can also be obtained by the following
limiting process which gives us Bessels functions of the 2nd kind of integral
order, Y0 (x), Y1 (x), ....
For integral , we define Yn (x) as the limit
Yn (x) = lim

cos ()J (x) J (x)


sin ()

using LH
opitals rule.
Unlike the Jn (x) functions, the Yn (x) functions are unboudned as x 0.
The functions Yn (x) are readily available in tabulated form. With this definition, for any , the general solution form any is
y(x) = C1 J (x) + C2 Y (x)

remainder
Notes to be completed
205

14

Numerical solution of ODEs

Motivation
As you already know, an Initial Value Problem consists of :
 0
x
= f (t, x)
,
x(t0 ) = x0
where f is a prescribed function of 2 variables and (t0 , x0 ) is a point through
which the solution should pass.
A solution of this IVP is a function x(t) such that
dx(t)
= f (t, x(t))
dt
for all t in some neighbourhood of t0 and x(t0 ) = x0 .
In this section we will see some methods for calculating numerical solutions
of differential equations. These methods are very useful since most differential
equations cannot be solved analytically, or even if analytic solutions exist these
may be too complicated to be used.
The methods that we are going to see are step-by-step methods. We start
with x(t0 ) = x0 and then we proceed by calculating approximate values of the
solution x(t) at:
t1 = t0 + h,

t2 = t1 + h,

t3 = t2 + h,

t4 = t3 + h

where h has a certain assigned value and is called the stepsize. These approximate values can be obtained with a Taylor series expansion.

14.1

Taylors theorem

Taylors theorem
If the function f (x) has the (n + 1)st derivative f (n+1) (t) exists for all t in an
interval containing c and x, then the Taylor series expansion around the point
c is:
n
X
1 (k)
f (c)(x c)k + En (x)
f (x) =
k!
k=0

where En (x) is called the Lagrange remainder:


En (x) =

1
f (n+1) ()(x c)n+1 .
(n + 1)!

with is some number between c and x.


However, this formula is not very useful as it is, since we want to advance
the solution from x to a neighbouring point x + h. Thus, we need an expression
that gives us the value of the function at x + h in terms of its value at x. To
obtain such an expression, we expand the function around x.

206

This can be accomplished by replacing x with x + h and c with x:


f (x + h) =

n
X
1 (k)
f (x)hk + En (h)
k!

k=0

and:
En (h) =

1
f (n+1) ()hn+1
(n + 1)!

where is in between x and x + h.


14.1.1

Taylors theorem for a function of two variables

Two variable case


For a function of two variables f (x, y), the symbolic expression is:
f (x + h, y + k) =


(i)
n
X
1

h
+k
f (x, y) + En (h, k)
i!
x
y
i=0

where
1
En (h, k) =
(n + 1)!


(n+1)

h
+k
f (a + h, b + k),
x
y

0 1.

Here:

(0)

h
+k
f (x, y) = f (x, y)
x
y
(1)




f
f

(x, y)
+k
f (x, y) = h
+k
h
x
y
x
y

(2)



2f
2f
2f
h
+k
f (x, y) = h2 2 + 2hk
+ k 2 2 (x, y)
x
y
x
xy
y


14.1.2

Example: Taylors series

Example 40 (Taylor series). Find the Taylors series expansion of


f (x, y) = cos(xy).
Solution
The derivatives are:
f
= y sin(xy),
x

f
= x sin(xy),
y

2f
= y 2 cos(xy),
x2
207

2f
= xy cos(xy) sin(xy),
xy
2f
= x2 cos(xy).
y 2
If n = 1, then
cos[(x + h)(y + k)] = cos(xy) hy sin(xy) kx sin(xy) + E1 (h, k).

14.1.3

Example: Initial Value Problem

Example 41 (Initial Value Problem). Solve the following IVP:


 0
x
= f (t, x) = cos t sin x + t2
.
x(1) = 3
Solution
To solve this IVP numerically, we will use the Taylor expansion:
x(t + h) = x(t) + hx0 (t) +

h2 00
h3
h4
x (t) + x000 (t) + xiv (t) +
2!
3!
4!

Obviously, we need to calculate the first few derivatives of x(t). We already


know x0 (t), since this is given by the IVP itself. lets calculate x00 (t), x000 (t) and
xiv (t):
x00

= sin t x0 cos x + 2t

x000

= cos t x00 cos x + (x0 )2 sin x + 2

xiv

sin t x000 cos x + 3x0 x00 sin x + (x0 )3 cos x

If we stop here, the terms not included start with h5 and they form the
so-called truncation error in our procedure.
The algorithm is the following:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% taylor
% Find t h e Taylor e x p a n s i o n o f
% c o s ( t ) s i n ( x ) +t 2 about t h e p o i n t
% ( t , x ) . h i s the step s i z e .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f u n c t i o n y = taylor ( t , x , h )
xp = c o s ( t )s i n ( x )+t 2 ; % f i r s t d e r i v
xpp = s i n ( t )xp c o s ( x ) +2t ; % s e c o n d d e r i v
208

xppp = c o s ( t )xpp c o s ( x )+xp 2+2; % t h i r d d e r i v


xpppp = s i n ( t ) +(xp3xppp ) c o s ( x ) +3xp xpp s i n ( x ) ; % fourth deriv
y = x+h ( xp+h ( xpp+h ( xppp+h xpppp / 4 ) / 3 ) / 2 ) ; % new approx
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% taylor ode
% Use t h e Taylor s e r i e s t o s o l v e t h e ODE
%
x ' = f ( t , x ) = c o s ts i n x+t 2 ; x( 1) = 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% s e t the paramters
m =200; h =0.01 d0 ; t=1.0d0 ; x =3.0 d0 ; k=0;
% p r i n t the intermediate values
[k t x]
% apply t h e a l g o r i t h m
f o r k=1:m
% f i n d t h e Taylor e x p a n s i o n o f f ( t , x )
x = taylor ( t , x , h )
% t a k e a s t e p f o r w a r d i n time
t=t+h ;
% print intermediate r e s u l t s
[k t x]
end
When this algorithm was programmed and run, the solution at t = 1 was
x200 = 6.4220.

14.2

Eulers method

Eulers method
Note that if we use the approximation:
x(t + h) = x(t) + hx0 (t)
then the numerical method is called the Euler method or the Euler-Cauchy
method.
Geometrically, this method approximates the curve f (x, t) with a polygon
whose first straight line segment is tangent to the exact solution curve at t0 . The
good thing about Eulers method is that it doesnt require any differentiation
of f .
The truncation error is proportional to hn , where n is the lowest power of
the terms in the Taylor series that are not included in the calculations. For
example, for the Euler-Cauchy method, the truncation error is proportional to
h2 (since we stop the expansion with the first derivative). For a fixed interval
t = t2 t1 in which we want to solve a given DE, the number of steps is

209

proportional to 1/h. Therefore, the total error is proportional to h2 h1 = h. For


this reason, Eulers method is called a first-order method.
In the example shown above, since the terms that were not included in our
calculations started with h5 , the resulting numerical method was of order 4.
14.2.1

Example: Eulers method

Eulers method: : step-by-step example


Example 42 (Eulers method). Apply Eulers method to the following IVP:
x0 + x = t2

x(0) = 1.

Integrate over the interval [0, 0.4] with steps of stepsize h = 0.05. Solve the
problem analytically and present a table with the numerical and analytical results
and the error.
Solution
Write the problem as:
x0 = f (t, x) = t2 x

x(0) = 1.

The Eulers formula to advance the solution is:


xn+1

= xn + hf (tn , xn )
= xn + 0.05(t2n xn )
=

0.95xn + 0.05t2n .

We start with:
t0 = 0,

x0 = 1

so our first new values are:


t1

t0 + 0.05 = 0.05,

x1

0.95x0 + 0.05t20 = 0.95.

The second values are:


t2

t1 + 0.05 = 0.1,

x2

0.95x1 + 0.05t21 = 0.95(0.95) + 0.05(0.05)2 = 0.902625.

The third values are:


t3

t2 + 0.05 = 0.15,

x3

0.95x2 + 0.05t22 = 0.95(0.902625) + 0.05(0.1)2 = 0.857994.

210

The fourth values are:


t4

= t3 + 0.05 = 0.2,

x4

0.95x3 + 0.05t23 = 0.95(0.857994) + 0.05(0.15)2 = 0.816219.

The fifth values are:


t5

t4 + 0.05 = 0.25,

x5

0.95x4 + 0.05t24 = 0.95(0.816219) + 0.05(0.2)2 = 0.777408.

The sixth values are:


t6

= t5 + 0.05 = 0.3,

x6

0.95x5 + 0.05t25 = 0.95(0.777408) + 0.05(0.25)2 = 0.741663.

The seventh values are:


t7

= t6 + 0.05 = 0.35,

x7

0.95x6 + 0.05t26 = 0.95(0.741663) + 0.05(0.3)2 = 0.709080.

And finally, the eighth values are:


t8

= t7 + 0.05 = 0.4,

x8

0.95x7 + 0.05t27 = 0.95(0.709080) + 0.05(0.35)2 = 0.679751.

Lets now find the analytical solution of:


x0 + x = t2

x(0) = 1.

This is a first order non-homogeneous DE, where p(t) = 1 and r(t) = t2 .


The solution is:
Z

R
R
p(t) dt
p(t) dt
x(t) = e
r(t)e
dt + const
Z

R
R
dt
2
dt
= e
t e
dt + const
Z

t
2 t
= e
t e + const


= et t2 et 2tet + 2et + const
= t2 2t + 2 + const et .
If we set x(0) = 1, then const = 1 and the analytic solution to the IVP is
x(t) = t2 2t + 2 et .
So the numerical solution at t = 0.4 is 0.679751, while the analytical solution
is 0.689680, giving an error of 0.009929.
211

Eulers method - coding example


Example 43 (Eulers method). Apply Eulers method to the following IVP:
x0 = 2x

x(0) = 10.

The following shows some the Matlab to implement the Euler method.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% euler
% Implement t h e E x p l i c i t E u l e r method
%
% Pre C o n d i t i o n :
%
f = f ( t , x ) i s t h e r i g h t hand s i d e
%
h i s the step s i z e
%
m i s t h e number o f s t e p s t o be taken
%
x0 i s t h e i n i t i a l c o n d i t i o n a t time t = 0
%
% Post C o n d i t i o n
%
x i s t h e s o l t u i o n a t t =0, h , 2h e t c .
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f u n c t i o n x = euler ( f , h , m , x0 , t0 )
% r e c o r d t h e s o l u t i o n a t t h e g i v e n time
% ( taking the s t a r t i n g c o n d i t i o n s i n t o account )
y = z e r o s (m , 1) ;
% record the s t a r t i n g c o n d i t i o n s
y ( 1 ) = x0 ;
t = t0 ;
% l o o p through and update t h e s o l u t i o n s based on t h e AdamsB a s h f o r t h
% formula
f o r i = 1 : ( m1)
y ( i+1)= y ( i )+hf ( t , y ( i ) ) ;
t = t+h ;
end
% r e t u r n t h e s o l u t i o n s t a r t i n g from t = t 0
x = y;

212

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main p a r t o f t h e code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% s t a r t i n g time
a = 0;
% end time
b = 10;
% step s i z e
c = 7;
h = ( ba ) /2 c ;
% p o i n t s a t which t h e s o l u t i o n w i l l be e v a l u a t e
t = (a : h : b) ';
m = length (t) ;
% d e f i n e the exact s o l u t i o n
g = inline ( ' 10 exp (2 t ) ' ) ;
% d e f i n e t h e r i g h t hand s i d e
f = inline ( ' 2x ' , ' t ' , ' x ' ) ;
% s o l v e t h e ODE
x = euler ( f , h , m , g ( a ) , a ) ;
% p l o t the r e s u l t
p l o t ( t , g ( t ) , ' g ' , t , x , ' r+ ' )
xlabel ( ' t ' )
ylabel ( 'x ' )
Figure 89 shows the solution when h = 10/25 .
Figure 90 shows (the absolute value of) the difference between the analytical
and numerical solutions.
According to the theory, if we double h the error should be divided by 2.
Figures 91, 92 and 93 shows how the error changes as h is decreased.
Stability
The ODE solvers in Matlab use numerical techniques to find approximate
solutions. In general, you will not need to write your own numerical solvers
like we just did for Eulers method. The ODE solvers available in packages
like Matlab are well written and robust. However, it is still important to
understand how the solvers work and what their limitations are.
Lets make a very minor modification to the previous example. Instead of

213

10
9
8
7

6
5
4
3
2
1
0

5
t

10

Figure 89: Numerical approximation to x0 + x = t2 (red crosses) found using


Eulers method compared to the analytical solution (green line).

214

Error (c = 5)
1.8
1.6
1.4
1.2

1
0.8
0.6
0.4
0.2
0

5
t

10

Figure 90: Difference between the numerical and analytical solutions when h =
10/25 .

215

Error (c = 6)
0.7

0.6

0.5

0.4

0.3

0.2

0.1

5
t

10

Figure 91: Difference between the numerical and analytical solutions when h =
10/26 .

216

Error (c = 7)
0.35

0.3

0.25

0.2

0.15

0.1

0.05

5
t

10

Figure 92: Difference between the numerical and analytical solutions when h =
10/27 .

217

Error (c = 8)
0.16
0.14
0.12

0.1
0.08
0.06
0.04

0.02
0

5
t

10

Figure 93: Difference between the numerical and analytical solutions when h =
10/28 .

218

solving
x0 = 2x

x(0) = 10,

x0 = 20x

x(0) = 10,

we are going to solve

with h = 10/25 .
As shown in Figure 94, the error in the numerical approximation is of order
1023 . This is not an error in the code, it is a consequence of the stability of
Eulers method.
23

12

x 10

10
8

6
4
2
0

2
4

5
t

10

Figure 94: Difference between the numerical and analytical solutions when h =
10/25 if f (x) = 20x.

Stability theory is concerned with the consequences of round off errors and
it states that h must be smaller than a certain value before Eulers method will
work properly, and that value depends on the ODE you are solving. Sometimes
the value of h must be so small that the method is no longer practical. Many
other ODE solvers also have this stability issue, although different solvers place
different conditions on h. That is why Matlab offers you a number of different
types of solvers.

219

14.3
14.3.1

Runge-Kutta methods
Second order Runge-Kutta

Runge-Kutta methods
Consider the following IVP:


x0
= f (t, x)
.
x(t0 ) = x0

The snag with the previous method is that we must calculate all those derivatives (x0 , x00 , x000 , xiv , ), then all these functions need to be programmed.
This can all be avoided by means of clever combinations of values of f (t, x).
Consider again the Taylor expansion:
x(t + h) = x(t) + hx0 (t) +

h3
h4
h2 00
x (t) + x000 (t) + xiv (t) +
2!
3!
4!

Let the partial derivatives be denoted with the subscripts x and t, e.g.
fx , f
t = ft . Thus:
x0

00

ft + fx x0 = ft + fx f

x000

ftt + ftx f + (ft + fx f )fx + f (fxt + fxx f )

f
x

(Note: I have used the chain rule for differentiation). So,


x(t + h)

= x(t) + hf +
= x+

1 2
h (ft + f fx ) + O(h3 )
2!

h
h
f + [f + hft + hf fx ] + O(h3 ).
2
2

Now we can get rid of the partial derivatives with the help of the first few
terms in the Taylor series in two variables. Since
f = x0

x
x
=
t
h

x f h

then
f (t + t, x + x) f (t + h, x + hf )
= f (t, x) + ft t + fx x + O(h2 )
= f + hft + hf fx + O(h2 ).
Now we insert this expansion into the expression for x(t + h):
1
1
x(t + h) = x + hf + hf (t + h, x + hf ) + O(h3 ).
2
2
220

Hence, the formula to advance the solution is:


x(t + h) = x(t) +

h
h
f (t, x) + f (t + h, x + hf ).
2
2

This can be re-written in compact form as follows.


x(t + h) = x(t) +
where

F1
F2

1
(F1 + F2 )
2

= hf (t, x)
= hf (t + h, x + F1 )

This is known as a second order Runge-Kutta method. Also known as Heuns


method.
14.3.2

Fourth order Runge-Kutta

Fourth order method


This formula is very tedious to derive, so I have skipped the proof. The
classical fourth order Runge-Kutta method is given by:
x(t + h) = x(t) +
where

14.3.3

F1

F2
F3

F4

1
(F1 + 2F2 + 2F3 + F4 )
6

= hf (t, x)

= hf t + h2 , x + 12 F1 
.
= hf t + h2 , x + 12 F2
= hf (t + h, x + F3 )

Examples: Runge-Kutta method

Runge-Kutta method: step-by-step example


Example 44 (Runge-Kutta). Apply Runge-Kuttas method to the following
IVP:
x0 + x = t 2
x(0) = 1
Integrate over the interval [0, 0.4] with steps of stepsize h = 0.05. Present a
table with the numerical and analytical results and the error.
Solution
Write the problem as:
x0 = f (t, x) = t2 x,

221

x(0) = 1.

The Runge-Kutta formula to advance the solution is:


x(t + h) = x(t) +
where

F1

F2
F

3
F4

So, the first

F1

F3

F4

1
(F1 + 2F2 + 2F3 + F4 )
6

= hf (t, x)

= hf t + h2 , x + 12 F1 
.
= hf t + h2 , x + 12 F2
= hf (t + h, x + F3 )

values are:
= hf (t, x) = 0.05(0  1) = 0.05
= hf t + h2 , x + 21 F1

1
= 0.05fh 0 + 0.05
2 , 1 + 2 (0.05)i
2
1 21 (0.05) = 0.048719
= 0.05 0.05
2

= hf t + h2 , x + 21 F2

1
= 0.05 h0 + 0.05
2 , 1 + 2 (0.048719) i

2
1 21 (0.048719) = 0.048751
= 0.05 0.05
2
= hf (t + h, x + F3 )
= 0.05fh (0 + 0.05, 1 0.048751)
i
2

= 0.05 (0.05) 1 + 0.048751 = 0.047437

Now calculate the advanced solution:


x(t + h)

= x(t) +

1
(F1 + 2F2 + 2F3 + F4 )
6

1
(0.050000 + 2(0.048719)
6
+2(0.048751) + (0.047437))

1+

0.951271.

Now we use this value x(t + h) = 0.951271 and t + h = 0 + 0.05 to calculate


the new functions F1 , F2 , F3 and F4 . Here we go:

222

F1

F2

F3

h
i
2
= hf (t, x) = 0.05 (0.05) 0.951271 = 0.047439

= hf t + h2 , x + 12 F1

1
= 0.05fh 0.05 + 0.05
2 , 0.951271 + 2 (0.047439)
i
2
1
= 0.05 0.05 + 0.05

0.951271

(0.047439)
2
2
= 0.046096

= hf t + h2 , x + 12 F2

.
1
= 0.05 h0.05 + 0.05
2 , 0.951271 + 2 (0.046096)
i

2
= 0.05 0.05 + 0.05
0.951271 12 (0.046096)
2
= 0.046130
= hf (t + h, x + F3 )
= 0.05fh (0.05 + 0.05, 0.951271 0.046130)
i
2

= 0.05 (0.1) 0.951271 + 0.046130 = 0.044757

Now calculate the advanced solution:


x(t + h)

1
(F1 + 2F2 + 2F3 + F4 )
6
1
0.951271 + (0.047439 + 2(0.046096)
6
+2(0.046130) + (0.044757))

= x(t) +
=
=

0.905163.

Now we use this value x(t+h) = 0.905163 and x+h = 0.05+0.05 to calculate
the new functions F1 , F2 , F3 and F4 . Here we go again:
h
i

F
=
hf
(t,
x)
=
0.05
(0.05)

0.905163
= 0.044758

h
1

F2 = hf t + 2 , x + 2 F1

= 0.05fh 0.1 + 0.05


, 0.905163 + 12 (0.044758)

1
0.05 2

0.905163

(0.047439)
= 0.043358
=
0.05
0.1
+

2
2

h
1
F3 = hf t + 2 , x + 2 F2

.
1
= 0.05 h0.1 + 0.05

2 , 0.905163 + 2 (0.043358)
i


2

= 0.05 0.1 + 0.05


0.905163 12 (0.046096) = 0.043393

F4 = hf (t + h, x + F3 )

= 0.05fh (0.1 + 0.05, 0.905163 0.043393)

= 0.05 (0.1) 0.905163 + 0.043393 = 0.041963

223

Now calculate the advanced solution:


x(t + h)

1
(F1 + 2F2 + 2F3 + F4 )
6
1
0.905163 + (0.044758 + 2(0.043358)
6
+2(0.043393) + (0.041963))

= x(t) +
=
=

0.861792.

Now we use this value x(t + h) = 0.861792 and t + h = 0.1 + 0.05 to calculate
the new functions F1 , F2 , F3 and F4 . This goes on and on until t = 0.4.
We can now compare the numerical solution with the analytical solution:
x(t) = t2 2t + 2 et .
At time t = 0.4, the numerical solution is 0.689680 while the analytical solution
is 0.689680. So both answers agree to 6 decimal places. Recall that the error
for Eulers method was 0.009929.
Runge-Kutta methods - coding example
Lets go back to the example we looked at previously.
Example 45 (Runge-Kutta method). Apply the Runge-Kutta method to the
following IVP:
x0 = 2x
x(0) = 10.
The Runge-Kutta method is a fourth order method, meaning that as h is
halved we would expect the error to be divided by 24 = 16. Figures 95, 96, 97
and 98 shows that is the case.

14.4

System of equations

Runge-Kutta method for systems


Consider the IVP
0
x
= f (t, x, y)

0
y
= g(t, x, y)
.
x(t
)
= x0

y(t0 ) = y0
The formula to advance the solution is:
x(t + h)
y(t + h)

1
(F1 + 2F2 + 2F3 + F4 ) ,
6
1
= y(t) + (G1 + 2G2 + 2G3 + G4 ) .
6
= x(t) +

224

Error (c = 5)

x 10

7
6

5
4
3
2

1
0

5
t

10

Figure 95: Difference between the numerical and analytical solutions when h =
10/25 .

225

Error (c = 6)

x 10

5
t

10

Figure 96: Difference between the numerical and analytical solutions when h =
10/26 .

226

2.5

Error (c = 7)

x 10

1.5

0.5

5
t

10

Figure 97: Difference between the numerical and analytical solutions when h =
10/27 .

227

1.4

Error (c = 8)

x 10

1.2

0.8

0.6

0.4

0.2

5
t

10

Figure 98: Difference between the numerical and analytical solutions when h =
10/28 .

228

where

14.4.1

F1

F2

G2

F3

G3

F4

hf (t, x, y),
G1 = hg(t, x, y)


h
1
1
hf t + , x + F1 , y + G1
2
2
2


h
1
1
hg t + , x + F1 , y + G1
2
2
2


h
1
1
hf t + , x + F2 , y + G2
2
2
2


h
1
1
hg t + , x + F2 , y + G2
2
2
2
hf (t + h, x + F3 , y + G3 )

G4

hg (t + h, x + F3 , y + G3 ) .

Application: galactic dynamics

Galactic dynamics

Figure 99: Cylindrical co-ordinates.


Consider a star that is moving in the potential well created by our Galaxy.
This star will obey Newtons second law, which in cylindrical coordinates is (see
Figure 99):
d2~r
= F~G (R, z)
dt2
where FG is the gravitational force exerted on the star by the Galaxy. Note
that since disk galaxies are axial symmetric, FG is not a function of .
229

The components of the above equation are:


( 2
Lz
d R

=R
2
3 R
dt
2
d z
=
dt2
z
where is the potential of our Galaxy and Lz = R2 d
dt (d/dt is the angular
velocity), is the angular momentum about the zaxis, which is conserved.
The above is a system of two second order differential equations and cannot
be solved analytically. Lets now re-write this system in terms of four first order
differential equations:
0
R
=U

0
Lz

U
=R
3 R
0
z
=W

W 0 =
z
where U and W are the velocities in the R and z direction respectively.
Now we need the initial conditions. These can be obtained experimentally;
the astronomer measures the components of the velocity of a star by observing
it with various techniques. The Doppler shift in spectral lines will give the U
component of velocity while the W and V components are found by measuring
how far a star has moved over a certain period of time with respect to background stars on a photographic or CCD plate. If the stars observed are all in
the solar neighbourhood, then we know where they are in the Galaxy: in the
plane of the Galaxy (z = 0) at R = 8.5 kiloparsecs from its centre, just like the
Sun. So we have a system of four first order differential equations with initial
conditions:

Figure 100: The spiral Galaxy NGC 4414 (Credit: W. Freedman (Carnigie
Obs.) , L. Frattare (STScI) et al., & the Hubble Heritage Team (AURA/ STScI/
NASA) ). Our own Galaxy would look a bit like this if seen nearly face-on.

230


R0

z0
U (8.5, 0)

W (8.5, 0)

V (8.5, 0)

= 8.5 kiloparsecs from centre of Galaxy


= 0 kiloparsecs from plane of Galaxy
= observed value in km/sec
= observed value in km/sec
= observed value in km/sec

(note: 1 kiloparsec = 1, 000 parsecs = 1, 0003.26 light years = 1, 0003.086


1013 km).
Furthermore, we also know the value of the angular momentum Lz , since
Lz = RV and the initial values of R and V will determine its value which will
not change during the calculations.
So, we have now almost everything necessary to start our calculations which
will allow us to find out where the stars that we have diligently observed for
months and months will be in, say, 300 million years (note: it takes the Sun
about 250 million years to rotate once around the Galaxy). All that is still
needed is a simple model for the potential (R, z) of a disk galaxy. In the
simple example presented here, we will use a Galaxy of 1.5 1011 solar masses,
whose potential is:


z2
v0
(R, z) = log R2 + 2
2
q
where q is the axial ratio and v0 is the circular speed. Generally, a disk galaxy
can be built by adding the contribution of the potentials given by the galactic
bulge, the galactic disk and the halo.
Typical outputs are shown in the figures 101 and 102.

Figure 101: Orbit of a star in the R z plane with initial velocities U = 130
km/sec, V = 180 km/sec and W = 95 km/sec.

231

Figure 102: Orbit of a star in the R z plane with initial velocities U = 5


km/sec, V = 400 km/sec and W = 400 km/sec.

Numerical methods to solve differential equations can also be used to study


the dynamics of galaxies. In 1972, Alar and Juri Toomre constructed computer
simulations of galaxy interactions. In Figure 103 there is a simulation of a close
encounter of two galaxies. One is modelled as a single point mass whilst the
other (the large galaxy) is made up by rings of point masses. The point mass
intruder galaxy moves toward the large galaxy in the same direction as that of
the spin of the large galaxy. In the beginning of the simulation, the interaction
causes the formation of a bridge-like structure of stars joining the two galaxies.
At the end of the simulation the large galaxy doesnt look like its original self
anymore!
Toomres simulations were also very successful in the modelling of structures
similar to that observed in the colliding Antennae (NGC 4038/4039) galaxies
(see simulation and picture below). They are nicknamed Antennae because
of their long curvy tails that look like the antennae of an insect. See figures 104
and 105.
All these galaxy interaction problems are quite interesting, particularly since
our own Galaxy will collide with the Andromeda galaxy in a few billion years
(the two galaxies are approaching at a speed of about 300 km/sec). Andromeda
is about twice as massive as the Galaxy and (at the moment!) about 2.6 million
light years away. See Figure 106.

232

Figure 103: Simulation of a low-mass galaxy passing close to a disk galaxy.

Figure 104: Another simulation by A. Toomre, closely resembling the interaction


of the Antennae galaxies shown in the picture below.

233

Figure 105: The interacting Antennae galaxies NGC4038 and NGC4039 (credit:
B. Whitmore (STScI), F. Schweizer (DTM), NASA)

Figure 106: Two Merging Galaxies NGC 4676. These galaxies are located 300
million light-years away in the constellation Coma Berenices. The galaxies have
been given the nickname The Mice because of the two long tails made up of
stars and gas originating from each galaxy (Credit: NASA and the ACS Science
Team).

234

You might also like