Sei sulla pagina 1di 77

AMA126 - 1 -

AMA126 Differential and


difference equations
University of Sheffield, Dept of Applied Mathematics
2007
AMA126 - 2 -
Revision of Integration (Indefinite Integration)
When a function f(x) is known we can differentiate it to obtain its derivative df/dx. The
reverse process is to obtain the function f(x) from knowledge of its derivative. This process
is called integration and it has numerous applications in all areas of sciences.
Suppose we differentiate the function y=x
2
. We obtain
x
dx
dy
2
Integration reverses this process and we say that the integral of 2x is x2. Schematically we
can regard the process of integration in the following way
In reality the situation is a bit more complicated because differentiating any of
5 . 0 , 3 , 7
2 2 2
+ + x x x
yields 2x. In fact, any function of the form x
2
+c, where c is a constant, will be the answer to
our question since when we differentiate the constant term we obtain zero. Consequently,
when we reverse the process of differentiation, we do not know what the original constant
term might have been. So we include in our answer an unknown constant, c say, called the
constant of integration and we state that the integral of 2x is x
2
+c. This constant must
always be included when finding an indefinite integral. The solution containing the
constant c defines a family of curves all being solutions of the integral. If one of these
curves is a solution of the integral, they all are. To select between them we need more
differentiate
integrate
x
2
2x
AMA126 - 3 -
information. This problem defines so called initial conditions, a topic you will meet later
when solving differential equations.
The indefinite integration is represented by the symbol known as an integral sign.
Accompanying the integral sign is always a term of the form dx, which indicates the
independent variable involved in the integration, in this case x. So we write

+ c x dx x
2
2
____________________________________________________
Example
(a) State the derivative of x
3
(b) Hence find the indefinite integral of 3x
2
Solution
(a) From our knowledge of differentiation, the derivative of x
3
is 3x
2
.
(b) Indefinite integration reverses the process of differentiation, and so we write
c x dx x +

3 2
3
We always include the additional constant of integration when finding indefinite integrals.
Note that our answer can be checked by differentiating x
3
+c to obtain 3x
2
.
More generally, we have the following relationship between derivatives and indefinite
integrals:
In the expression f(x) dx, the function f(x) is referred to as the integrand. When we have
calculated f(x) dx, we say f(x) has been integrated with respect to x to yield F(x)+c.
In what follows we are going to discuss some techniques which can be used to evaluate
many types of integrals.
I. Integration by parts
If f and g are differentiable functions, then by the Product Rule
[ ]
[ ] ) ( ' ) ( ) ( ) ( ) ( ' ) (
) (
) (
) (
) ( ) ( ) (
x f x g x g x f
dx
d
x g x f
ly equivalent or
dx
x df
x g
dx
x dg
x f x g x f
dx
d

+

where the dash means the differentiation of the function with its argument. Integrating both
sides of the previous equation gives us
( ) [ ] ( ) ( ) ( ) c x F dx x f then x f x F
dx
d
if +

AMA126 - 4 -
[ ]

dx x f x g dx x g x f
dx
d
dx x g x f ) ( ' ) ( ) ( ) ( ) ( ' ) (
The simplest is to perform the first integral on the right side and the integral is f(x)g(x)+C
(why???). Since another constant of integration results from the second integral, it is
unnecessary to include C in the formula; that is

dx x f x g x g x f dx x g x f ) ( ' ) ( ) ( ) ( ) ( ' ) (
If we let u=f(x) and v=g(x), so that du=f(x)dx and dv=g(x)dx, then the preceding formula
may be written (integration by part)

vdu uv udv
______________________________________________________
Example: Find

dx xe
x 2
Solution
There are four possible choices for dv, namely dx, xdx, e
2x
dx or xe
2x
dx. If we let dv= e
2x
dx,
then the remaining part of the integrand is u; that is u=x. To find v we integrate dv to obtain
v=e
2x
/2. Note that a constant of integration is not added at this stage of the solution. Since
u=x we see that du=dx. For ease of reference it is convenient to display these expressions
as follows
x
x
e v dx du
dx e dv x u
2
2
2
1


Substituting these expressions in the definition equation, we obtain


,
_

dx e e x dx xe
x x x 2 2 2
2
1
2
1
The integral on the right hand side may be found using the integrals of exponential
functions (see in the table below). This gives us

+
,
_

C e e x dx xe
x x x 2 2 2
4
1
2
1

AMA126 - 5 -
It takes considerable practice to become proficient in making a suitable choice for dv. To
illustrate, if we had chosen dv=xdx, then it would have been necessary to let u=e
2x
, giving
us
2 2
2
2
1
2 x v dx e du
xdx dv e u
x
x


Integrating by parts we obtain

dx e x e x dx xe
x x x 2 2 2 2 2
2
1
Since the exponent associated with x has increased, the integral on the right is more
complicated than the given integral. This indicates an incorrect choice of dv.
______________________________________________________
II. Trigonometric integrals
In many cases evaluating an integral we can meet trigonometric functions. For example,
integrals of the type sin
n
xdx require new method of solving. If n is an odd positive integer,
we begin by writing


xdx x xdx
n n
sin sin sin
1
Since the integer n-1 is even, we may then use the fact that sin
2
x=1-cos
2
x to obtain a form
which is easy to integrate.
______________________________________________________
Example
Evaluate sin
5
xdx.
Solution
As discussed earlier we have


+

xdx x x
xdx x xdx x xdx x xdx
sin ) cos cos 2 1 (
sin ) cos 1 ( sin ) (sin sin sin sin
4 2
2 2 2 2 4 5
We next employ the method of substitution, letting u=cosx and du=-sinxdx. Thus
C x x x C u u u
du u u dx x x x xdx
+ + + +
+ +

5 3 5 3
4 2 4 2 5
cos
5
1
cos
3
2
cos
5
1
3
2
) 2 1 ( ) sin )( cos cos 2 1 ( sin
AMA126 - 6 -
_____________________________________________________
A similar technique can be employed for odd powers of cos x, specifically, we write


xdx x xdx
n n
cos cos cos
1
and use the fact that cos
2
x=1-sin
2
x in order to obtain an integrable form. If the integrand is
sin
n
x or cos
n
x and n is even, then the half-angle formulas
2
2 cos 1
cos
2
2 cos 1
sin
2 2
x
x or
x
x
+

may be used to simplify the integrand.


______________________________________________________
Example
Evaluate sin
4
xdx
Solution

+
,
_


dx x x dx
x
dx x xdx ) 2 cos 2 cos 2 1 (
4
1
2
2 cos 1
) (sin sin
2
2
2 2 4
We apply a half-angle formula again and write
x x x 4 cos
2
1
2
1
) 4 cos 1 (
2
1
2 cos
2
+ +
Substituting in the last integral and simplifying gives us

+ +
,
_

+ C x x x dx x x xdx 4 sin
32
1
2 sin
4
1
8
3
4 cos
2
1
2 cos 2
2
3
4
1
sin
4
_____________________________________________________
Integrals of the form sin
m
xcos
n
xdx where m and n are positive integers may be found by
using variations of the previous techniques. If m and n are both even, then half-angle
formulas should be employed first. In n is odd, we can write


xdx x x xdx x
n m n m
cos cos sin cos sin
1
and express cos
n-1
x in terms of sinx by using the identity cos
2
x=1-sin
2
x. The substitution
u=sinx then leads to an integrand which can be handled easily. A similar technique can be
used if m is odd.
III. Trigonometric substitutions
AMA126 - 7 -
If an integrand contains the expression
2 2
x a
where a>0, then the trigonometric
substitution x=asin leads to
( ) | cos | cos sin 1 sin
2 2 2 2 2 2 2 2 2
a a a a a x a
When making this substitution or the other trigonometric substitutions in the next
examples, we shall assume that is in the range of the corresponding inverse trigonometric
function. Thus, for the sine substitution above /2/2. Consequently cos0 and
cos
2 2
a x a
. Of course, if
2 2
x a
occurs in a denominator we make the further
restriction /2<</2.
______________________________________________________
Example
Evaluate
0 ,
1
2 2 2
>

a dx
x a x
Solution
Let x=asin , where /2<</2. It follows that
( ) cos sin 1 sin
2 2 2 2 2 2 2
a a a a x a
Since x=asin, we have dx=acosd. Substituting in the given integral
C
a
d
a
d a
a a
dx
x a x
+



cot
1
sin
1 1
cos
cos ) sin (
1 1
2 2 2 2 2
2 2 2
It is now necessary to return to the original variable of integration x. A simple method of
doing so is to use a geometrical approach. If 0<</2, then since sin=x/a, we may
interpret as an acute angle of a triangle having opposite side and hypotenuse of lengths x
and a, respectively. The length
2 2
x a
of the adjacent side is calculated by means of
the Pythagorean Theorem.
AMA126 - 8 -

Referring to the triangle we see that
x
x a
2 2
cot


It can be shown that this formula is also valid if /2<<0. Thus the above figure can be
used whether is positive or negative. Substituting the new form of cot in the result
obtained for the integral, we have
C
x a
x a
C
x
x a
a
dx
x a x
+

2
2 2 2 2
2
2 2 2
1 1
______________________________________________________
If an integrand contains
2 2
x a +
, where a>0, then the substitution x=atan will
eliminate the radical sign. When using this substitution it will be assumed that is in the
range of the inverse tangent function; that is /2<</2. After making this substitution
and evaluating the resulting trigonometric integral, it is necessary to return to the original
variable, x. The preceding formulas show that
a
x a
and
a
x
2 2
sec tan
+

For integrands containing
2 2
a x
we substitute x=asec, where is chosen in the range
of the inverse secant function; that is either 0/2 or <3/2. After evaluating the
integral, we have to return to the original variable and we use
a
a x
and
a
x
2 2
tan sec


______________________________________________________
AMA126 - 9 -
Example
Evaluate
dx
x
x

9
2
Solution
Let us substitute as follows
d dx x tan sec 3 , sec 3
Consequently
tan 3 1 sec 3 9 sec 9 9
2 2 2
x
and therefore
( )
( ) C
d d d dx
x
x
+

tan 3
1 sec 3 tan 3 tan sec 3
sec 3
tan 3 9
2 2
2
Since sec=x/3 we may refer to the changing rule into the old variable and we write
C
x
x C
x x
dx
x
x
+
,
_

+
1
1
]
1

,
_

3
sec 3 9
3
sec
3
9
3
9
1 2 1
2 2

_____________________________________________________
III. Partial Fractions
It is easy to verify that
1
1
1
1
1
2
2
+

x x x
The expression on the right side of the equation is called the partial fraction
decomposition of the expression on the left side. This decomposition may be used to find
the indefinite integral of the expression on the left side. We merely integrate each of the
fractions which make up the decomposition independently, obtaining

+
+

+ +
+

C
x
x
C x x dx
x
dx
x
dx
x 1
1
ln | 1 | ln | 1 | ln
1
1
1
1
1
2
2
It is theoretically possible to write any rational expression f(x)/g(x) as a sum of rational
expressions whose denominators involve powers of polynomials of degree not greater than
two. More specifically, if f(x) and g(x) are polynomials and the degree of f(x) is less than
the degree of g(x), then it follows from a theorem in algebra that
AMA126 - 10 -
k
F F F
x g
x f
+ + +
2 1
) (
) (
where each of F
i
has one of the forms
( )
( )
n m
c bx ax
D Cx
or
q px
A
+ +
+
+
2
for some non-negative integers m and n, and when ax
2
+bx+c is irreductible, in the sense
that this quadratic expression has no real roots, that is b
2
-4ac<0.
To find the fraction decomposition of a rational expression f(x)/g(x) it is essential that f(x)
have lower degree than g(x). If this is not the case, then long division should be employed
to arrive at such expression. For example, given
1
3 5 6
2
2 3

+
x
x x x
we obtain, by long division,
1
9 6
6
1
3 5 6
2 2
2 3

+
x
x
x
x
x x x
The partial fraction decomposition is then found for the last term in the right side.
In order to obtain the decomposition of a rational expression of the form f(x)/g(x), we begin
by expressing the denominator g(x) as a product of factors px+q or irreductible quadratic
factors ax
2
+bx+c. Repeated factors are then collected so that g(x) is a product of different
factors of the form (px+q)
m
or (ax
2
+bx+c)
n
, where m and n are non-negative integers and
the quadratic forms are irreductible. We then apply the following rules
Rule 1. For each factor of the form (px+q)
m
where m1, the partial fraction decomposition
contains a sum of m partial fractions of the form
( ) ( )
m
m
q px
A
q px
A
q px
A
+
+ +
+
+
+

2
2 1
where each of A
i
is a real number.
Rule 2. For each of the factor of the form (ax
2
+bx+c)
n
where n1 and b
2
-4ac<0, the partial
fraction decomposition contains n partial fractions of the form
AMA126 - 11 -
( ) ( )
n
n n
c bx ax
B x A
c bx ax
B x A
c bx ax
B x A
+ +
+
+ +
+ +
+
+
+ +
+
2
2
2
2 2
2
1 1

where each of A
i
and B
i
are real numbers.
_____________________________________________________
Example
Evaluate
( ) ( )
dx
x x
x x x

+
+
3
2 3
2 1
4 29 18 3
Solution
By Rule 1, there is a partial fraction of the form A/(x+1) corresponding to the factor x+1 in
the denominator of the integrand. For the factor (x-2)
3
we apply Rule 1 (with m=3),
obtaining a sum of three partial fractions B/(x-2), C/(x-2)
2
, and D/(x-2)
3
. Consequently, the
partial fraction decomposition has the form
( ) ( ) ( ) ( )
3 2 3
2 3
2 2
2 1
2 1
4 29 18 3

+
+

+
+
x
D
x
C
x
B
x
A
x x
x x x
Multiplying both sides by (x+1)(x-2)
3
gives us
( ) ( )( ) ( )( ) ( ) 1 2 1 2 1 2 4 29 18 3
2 3 2 3
+ + + + + + + x D x x C x x B x A x x x
Two of the unknown constants may be determined easily. If we let x=2 then
24-72+58-4=3D, 6=3D, and D=2
Similarly, letting x=-1 we obtain
-3-18-29-4=-27A, -54=-27A, and A=2
The remaining constants may be found by comparing the coefficients. If the right side of
the decomposition is expanded and like powers of x collected, we see that the coefficient of
x
3
is A+B. This must equal the coefficient of x
3
on the left, that is
A+B=3
Since A=2, it follows that B=1. Finally, we compare the constant terms by letting x=0.
This gives us
-4=-8A+4B-2C+D
Substituting the values we have already found for A, B and D leads to
AMA126 - 12 -
-4=-16+4-2C+2
which has the solution C=-3. The partial fraction decomposition is, therefore
( ) ( ) ( ) ( )
3 2 3
2 3
2
2
2
3
2
1
1
2
2 1
4 29 18 3

+
+

+
+
x x x x x x
x x x
To find the given integral we integrate each of the partial fractions on the right side of the
last equation. This gives us
E
x x
x x +

+ + +
2
) 2 (
1
2
3
| 2 | ln | 1 | ln 2
______________________________________________________
Obviously, there are many characteristic types of indefinite integrals with their own rules.
To see them all, please consult any book on calculus.
Differential equations
Definition: A differential equation is an equation which involves derivatives or
differentials. Since the equations we are going to study contain only one variable, these
equations are called ordinary differential equations. The primary objective of this lecture is
to develop techniques for solving certain basic types of ordinary differential equations.
Introduction
An equation of the form
( ) 0 ... , ' ' , ' , ,
) (

n
y y y y x F , 2.1
where F is a function of n+2 variables, y is a function of x, and y
(k)
denotes the k-th
derivative of y with respect to x, is called an ordinary differential equation of order n.
The following are examples of ordinary differential equations of orders 1, 2, 3, and 4,
respectively:
( ) ( )
dx
dy
x
dx
y d
xe xy y x y
y
dx
dy
x
dx
y d
x y
x
3
2
4
4
5 2 4
3
2
2
2
1
4 ' ' ' ' '
0 15
2 '

,
_

+

,
_

AMA126 - 13 -
If, in (2.1), F is a polynomial function, then by definition the degree of the differential
equation is the greatest exponent associated with the highest order derivative y
(n)
. The
degrees of the preceding differential equations are 1, 1, 4, and 2, respectively.
If a function f has the property that when f(x) is substituted for y in a differential equation,
the resulting expression is an identity for all x in some interval, then f(x) (or simply f) is
called a solution of the differential equation. For example, if C is any real number, then a
solution of y=2x is
( ) C x x f +
2
because substitution of f(x) for y leads to the identity 2x=2x. We call x
2
+C the general
solution of y=2x, since every solution has this form.
___________________________________________
Example
If C
1
and C
2
are any real numbers, prove that
( )
x x
e C e C x f
5
2
5
1

+
is a solution of y-25y=0.
Solution
Since
( )
( ) ( ) x f e C e C x f
e C e C x f
x x
x x
25 25 25 ' '
5 5 '
5
2
5
1
5
2
5
1
+

we have f(x)-25f(x)=0. This shows that f(x) is a solution of the equation y-25y=0.
The solution given in the above Example is called the general solution of y-25y=0.
Observe that the differential equation is of the order 2 and the general solution contains two
arbitrary parameters C
1
and C
2
(for connections to integrals, see why these parameters arise
in the recap about integrals).
It can be shown that the general solution of the n-th order differential equation contains n
independent parameters C
1
, C
2
, , C
n
. A particular solution is obtained by assigning
specific values to the parameters.
___________________________________________
Example
Find the particular solution of y=2x which satisfies the condition that y=5 if x=2.
Solution
Let us write the general solution of y=2x in the form y=x
2
+C. If the given condition is to
be satisfied, then necessarily 5=4+C or C=1. Hence the desired particular solution is
y=x
2
+1.
AMA126 - 14 -
___________________________________________
Conditions of the type stated in the previous Example are called boundary conditions for
the differential equation. If the general solution contains one parameter, one boundary
condition is sufficient to find the particular solution. If, as in the first Example, the general
solution contains two parameters, then two boundary conditions are needed for particular
solutions. Similar statements hold if more than two parameters are involved.
The solutions we have considered express y explicitly in terms of x. Solutions of certain
differential equations are stated implicitly. In this case, implicit differentiation is used to
check the solution, as illustrated in the following example
___________________________________________
Example
Show that x
3
+x
2
y-2y
3
=C is an implicit solution of
( ) 0 2 3 ' 6
2 2 2
+ + xy x y y x
Solution
If the first equation is satisfied by y=f(x), then differentiating implicitly,
( ) 0 2 3 ' 6
0 ' 6 ' 2 3
2 2 2
2 2 2
+ +
+ +
xy x y y x
or y y y x xy x
Thus y=f(x) satisfies the differential equation.
___________________________________________
The simplest type of differential equation is one which can be written in the form
( ) ( ) 0 ' + y y N x M 2.2
where M and N are continuous functions. If y=f(x) is a solution of the equation (2.2), then
( ) ( ) ( ) ( ) 0 ' + x f x f N x M
If f(x) is a continuous function, then indefinite integration leads to
( ) ( ) ( ) ( )

+ C dx x f x f N dx x M '
or equivalently,
( ) ( )

+ C dy y N dx x M
The last equation is an (implicit) solution of (2.2). A device which is useful for
remembering this method of solution is to write equation (2.2) as
AMA126 - 15 -
( ) ( ) 0 +
dx
dy
y N x M
and then change to the following differential form
( ) ( ) 0 + dy y N dx x M 2.3
The solution is then found by formally integrating each term. The differential equation
(2.2) is said to be separable, since the variables x and y may be separated as indicated in
(2.3).
___________________________________________
Example
Solve the differential equation
( ) . 0 ' 4 6 2
2
+ + y x x xy
Solution
The given equation may be written as
( ) ( ) . 0 4 3 2
2
+ +
dx
dy
x y x
Assuming that (y+3)(x
2
-4)0, we may divide both sides by this product and express the
equation in the differential form (2.3) as follows
. 0
3
1
4
2
2

+
+

dy
y
dx
x
x
Thus the given differential equation is separable, and integration gives us
( )( )
1
2
1
2
3 4 ln
3 ln 4 ln
C y x
or C y x
+
+ +
This may also be written as
( )( )
2
2
1
3 4 C e y x
C
+ .
It can be shown, furthermore, that the solution is
( )( ) C y x + 3 4
2
for every nonzero C. In explicit form,
AMA126 - 16 -
. 3
4
2

x
C
y
Since it was assumed that (y+3)(x
2
-4)0, the cases x=2 and y= -3 require special
attention. Direct substitution shows that y= -3 is a solution of the given differential
equation; however, y is undefined if x=2. Consequently, the above solution given in
explicit form is the solution if C is any real number.
___________________________________________
Example
Prove that y=e
x
(C
1
cos x+C
2
sin x) is a solution of the differential equation
0 2 ' 2 ' ' + y y y
Example
Solve the differential equation
y yx y x
2 2
'
Sometimes a substitution is necessary to turn an equation into separable variables, e.g. use
the substitution z=2x+y to solve the ordinary differential equation
2 ) 2 tan( + y x
dx
dy
Obviously, first we will need to see how the new variable (and its derivative) will look like.
For this we differentiate the new variable with respect to x
dx
dy
dx
dz
+ 2
AMA126 - 17 -
So the original differential equation is transformed into
z
dx
dz
tan
which now can be solved by variable separation. Integrating we have

dx dz
z
z
or dx
z
dz
sin
cos
tan
and the solution can be found solving the following chain
x Ae y
Ae y x
Ae y x
C x y x
C x z
x
x
x
2 ) ( sin
) ( sin 2
) 2 sin(
]) 2 ln(sin[
) ln(sin
1
1

+
+
+ +
+

A very important case (i.e. with many applications in various fields) is the differential
equation
ky
dt
dy

This equation can be solved by variable separation. Supposing that y0, we have
kt kt C
Ae e y
C kt y
kdt
y
dy

+

+

ln
The above equation is an example of an ordinary differential equation with constant
coefficients. This type of equation will play a very important role in the second chapter of
this course (population dynamics). Let us discuss some of the properties of this differential
equation
1. Set t=0, then y(0)=A, so y(t)=y(0)e
kt
2. If k>0, we have an exponential growth, if k<0 we have an exponential decay
3. Half-life (when k<0)
AMA126 - 18 -
We set e
k
=2
-1/T
, in other words
0
2 ln
2 ln
1
>
k
T or
T
k
then
2
) (
4
) 0 (
2 ) 0 ( ) 2 (
2
) 0 (
2 ) 0 ( ) (
2 ) 0 ( ) (
2
1
T y y
y T y
y
y T y
y t y
T
t

T is called the half-life and it is widely used in sciences and engineering (e.g. radioactive
decay)
The snowfall problem: Before noon snow starts to fall at a steady rate. At noon a snow
plough begins ploughing forward along a straight road of constant width. It shifts a
constant volume of snow per unit time. It clears a two mile stretch by one oclock and a
further one mile by two oclock. At what time did the snow begin to fall?
Solution
Let the snow begin to fall at time T. Then the depth of snow at time t (T) is c(t-T). Let the
snow plough advance from x to x+x in the time interval t to t+t. The volume of snow
removed in this time interval is c(t-T)x, where is the width of the plough.
Thus the rate of snow removal is
dt
dx
T t c
t
x
T t c ) ( ) (


which is a constant. Thus we have (t-T)dx/dt=C, or
) ( T t
T t
k
dt
dx
>

This differential equation can be solved by separating the variables as


A T t k
T t
dt
k x +

) ln(
which can be rewritten as
AMA126 - 19 -
x
k
A
x
k
Ba T t
e e
k
A x
T t
k
A x
T t
+

,
_


,
_

1
exp
) ln(
where B=e
-A/k
and a=e
1/k
. We have three unknown constants (T, B, a) which must be
determined. We have to use the initial conditions, i.e.

'




2 3
1 2
0 0
t at x
t at x
t at x
Using these conditions we have

'

+
+
+
3
2
2
1
0
Ba T
Ba T
B T
From the first equation we have B=-T, which introduced back into the remaining two
equations yields

'



) 1 ( 2
) 1 ( 1
3
2
a T
a T
Calculating the ratio between these two expressions we have
2
5 3
4
5 5 2 1
2
5 1
2
4 1 1
0 1
1 2 2
1
1
1
1
2
2
2
2
2
2
3
+

+ +

+ t


+ + +
+
+ +

a
a
a a
a a a
a
a a
a
a
AMA126 - 20 -
Having this constant, we can determine T as
2
) 1 5 (
4
) 1 5 ( 2
1 5
1 5
1 5
2
5 1
2
) 5 3 ( 2
2
1
1
2

+

+

+

a
T
Calculating this ratio, we obtain T= 0.618 hours=-37.1 min. Accordingly, the snow
started to fall at 11.23 am.
HOMOGENEOUS DIFFERENTIAL EQUATIONS
A function f of two variables is said to be homogeneous of degree n if
( ) ( ) y x f t ty tx f
n
, , 3.1
for every t>0 such that (tx, ty) is in the domain of f. For example, if
( )
3 2 2 4
5 2 , xy y x x y x f +
then f is homogeneous of degree 4, since
( ) ( ) ( ) ( ) ( )( )
( ) ( ) y x f t xy y x x t
ty tx ty tx tx ty tx f
, 5 2
5 2 ,
4 3 2 2 4 4
3 2 2 4
+
+
Similarly, if
( )
y
x
e
y x
y x f
2 2
1
,
+

then f is homogeneous of degree -2, since


( ) ( ) y x f t e
y t x t
ty tx f
ty
tx
,
1
,
2
2 2 2 2

A homogeneous differential equation is an equation which can be written in the form


( ) ( ) 0 , , + dy y x Q dx y x P 3.2
where P and Q are homogeneous functions of the same degree. Equations of this type can
be transformed into separable equations by means of substitutions
AMA126 - 21 -
( ) x v v where xv y , 3.3
and
xdv vdx dy +
Thus, substitution of xv for y in (3.2) yields
( ) ( ) ( ) 0 , , + + xdv vdx xv x Q dx xv x P
If P and Q are homogeneous functions of degree n, then
( ) ( ) ( ) ( ) v Q x xv x Q and v P x dx xv x P
n n
, 1 , , 1 ,
Substituting in the preceding differential equation and dividing both sides by x
n
we obtain
( ) ( ) ( ) 0 , 1 , 1 + + dv x dx v v Q dx v P
This equation can be written in the separable form
( )
( ) ( )
0
, 1 , 1
, 1 1

+
+ dv
v vQ v P
v Q
dx
x
3.4
provided non-zero denominators occur. We have proved that if y=xv is a solution of (3.2),
then v is a solution of (3.4). Conversely, if v is a solution of (3.4), then reversing our
argument shows that y=vx is a solution of (3.2). It is not advisable to memorize the final
form of (3.4). Instead, remember the substitution y=xv which is used to simplify the
homogeneous equation.
___________________________________________
Example
Solve the differential equation
( ) . 0
2 2
+ dy x dx xy y
Solution
If P(x,y)=y
2
-xy and Q(x,y)=x
2
, then the functions P and Q are both homogeneous of degree
2. Hence the differential equation is homogeneous and we substitute
. , xdv vdx dy xv y +
This leads to the following chain of equations
AMA126 - 22 -
( ) ( )
( ) ( )
( )
0
1 1
0
0
0
0
2
2
2
2 2 2
2 2 2 2
+
+
+ +
+ +
+ +
dv
v
dx
x
xdv dx v
xdv vdx dx v v
xdv vdx x dx v v x
xdv vdx x dx v x v x
Integrating each term gives us
1
1 1
| | ln
| | ln
1
ln
C x
x
y C
y
x
x C
v
x


Example
Solve the differential equation
( ) 0 2
2 2
+ dy x y xydx
LINEAR DIFFERENTIAL EQUATIONS OF THE FIRST ORDER
A first-order linear differential equation is an equation of the form
) ( ) ( ' x Q y x P y + 3.5
where P and Q are continuous functions. If Q(x)=0 for all x, then equation (3.5) is
separable and we may write
) (
'
x P
y
y

provided y0. Integrating, we obtain

+ . ln ) ( ln C dx x P y
We have expressed the constant of integration as ln|C| in order to change the form of the
last equation as follows:
AMA126 - 23 -
C ye
e
C
y
dx x P
C
y
dx x P C y
dx x P
dx x P

) (
) (
) ( ln
) ( ln ln
We next observe that
[ ]. ) ( '
) ( '
) (
) ( ) ( ) (
x yP y e
ye x P e y ye
dx
d
dx x P
dx x P dx x P dx x P
+

1
]
1


Consequently, if we multiply both sides of (3.5) by e
P(x)dx
, then the resulting equation may
be written as
. ) (
) ( ) (

1
]
1

dx x P dx x P
e x Q ye
dx
d
This gives us the following (implicit) solution of (3.5)

+

. ) (
) ( ) (
D e x Q ye
dx x P dx x P
3.6
Solving this equation for y leads to an explicit solution. The expression e
P(x)dx
is called an
integrating factor of (3.5). We have shown that multiplications of both sides if (3.5) by this
expression leads to an equation which has the solution (3.6).
___________________________________________
Example
Solve the differential equation
0 3 5 '
5 2
+ + x xy y x
where x0.
Solution
In order to find the integrating factor we begin by expressing the given differential equation
in the standardized form (3.5), where the coefficient of y is 1. Thus, dividing both sides
by x
2
we obtain
AMA126 - 24 -
3
3
5
' x y
x
y +
which has the form (3.5) with P(x)=5/x and Q(x)=- 3x
3
. From the preceding discussion, the
required integrating factor is
.
5
ln ln 5
) (
5
x e e e
x x
dx x P

If x>0 then |x|


5
=x
5
, whereas if x<0 then |x|
5
=-x
5
. In either case, multiplying both sides of
the standardized form by |x|
5
gives us
. 3 ) ( 3 5 '
8 5 8 4 5
x y x
dx
d
or x y x y x +
Thus a solution is
5
4 9
5
3 3 x
C x
y or C
x
y x + + .
___________________________________________
A generalization of the (3.5) is the Bernoulli equation
, ) ( ) ( '
n
y x Q y x P y +
3.7
where n0. Evidently y=0 is a solution. If y0 we may divide both sides by y
n
, obtaining
). ( ) ( '
1
x Q y x P y y
n n
+

3.8
If we let w=y
1-n
, then
' ) 1 ( ' y y n
dx
dw
w
n

and hence
'.
1
1
' w
n
y y
n

Replacing y
-n
y in (3.8) by the last expression gives us
AMA126 - 25 -
). ( ) ( '
1
1
x Q w x P w
n
+

This first-order linear diff. eq. may be solved for w using the integrating factor technique.
After w was found, the solution (3.7) is given by y
1-n
=w (and y=0).
__________________________________________
Example
Solve the differential equation
.
2
'
3 6
y x
x
y
y +
Solution
The equation has the Bernoulli form (3.6) with n=3. If, as in the previous discussion, we
multiply both sides by y
-3
and substitute w=y
1-n
=y
-2
we obtain
6
6
6
2
3
2
4
'
2
'
2
1
2
'
x
x
w
w
x
x
w
w
x
xy
y y

+
+

Since the integrating factor for the last equation is


4
4
ln ln 4
) / 4 (
4

x x e e e
x x
dx x
supposing that x>0 (in fact it can be shown that considering x<0, eventually we would
obtain the same result). Now we can write
. 2 4 '
2 5 4
x w x w x

Consequently
.
3
2
3
2
4
7 3
4
Cx
x
w or C
x
w x + +

Finally, since w=y


-2
, the solution of the given equation is
AMA126 - 26 -
1
3
2
3
2
2 4
7
4
7
2

,
_

+ +

y Cx
x
or Cx
x
y
___________________________________________
Differential equations are indispensable in sciences (mathematics, physics, chemistry,
engineering, biology, etc). The application of the theory of differential equations for
physical problems will be solved in other modules and later in this module for population
dynamics.
Example
Solve the differential equations
x
x
e y y y
e y x y x
2
+
+ +
Linear differential equations of the second order
If f
1
, f
2
, , f
n
and k are functions of one variable which have the same domain, then an
equation of the form
( )
( )
( )
( ) ( ) ( ) x k y x f y x f y x f y
n n
n n
+ + + +

'
1
1
1
4.1
is called a linear differential equation of order n. If k(x)=0 for all x, the equation is said
to be homogeneous. Notice that this meaning of the word homogeneous is different from
that we met earlier. If k(x)0 for some x, then the equation (4.1) is said to be non-
homogeneous. We shall restrict our work to second-order equations in which f
1
and f
2
are
constant functions. First we are going to discuss the homogeneous case.
The general second-order homogeneous differential equation with constant coefficients has
the form
0 ' ' ' + + cy by ay 4.2
where a, b and c are constants. Before attempting to find particular solutions let us
establish the following result.
Theorem: (the superposition principle) If y=f(x) and y=g(x) are solutions of the differential
equation ay+by+cy=0, then
) ( ) (
2 1
x g C x f C y + 4.3
AMA126 - 27 -
is a solution for all real numbers C
1
and C
2
.
Proof: By hypothesis

'

+ +
+ +
0 ) ( ) ( ' ) ( ' '
0 ) ( ) ( ' ) ( ' '
x cg x bg x ag
x cf x bf x af
If we multiply the first of these equations by C
1
, the second by C
2
, and add, the result is
[ ] [ ] [ ] 0 ) ( ) ( ) ( ' ) ( ' ) ( ' ' ) ( ' '
2 1 2 1 2 1
+ + + + + x g C x f C c x g C x f C b x g C x f C a
Thus C
1
f(x)+C
2
g(x) is a solution.
It can be shown that if the solutions f and g in above Theorem have the property that
f(x)Cg(x) for all real numbers C, and if g(x) is not identically 0, then y=C
1
f(x)+C
2
g(x) is a
general solution of ay+by+cy=0. Thus, to determine the general solution it is sufficient to
find two such functions f and g and employ Eq. (4.3).
In our search for solution of (4.2) we shall use y=Ae
mx
as a trial solution, where A is an
arbitrary constant and we need to find m.
Then
mx mx
e Am
dx
y d
Ame
dx
dy
2
2
2
;
Substituting in Eq. (4.2) gives
( ) 0
2
+ +
mx
Ae c bm am
or, since e
mx
0 and we are interested in non-trivial solutions (A0)
0
2
+ + c bm am
4.4
The equation (4.4) is called the auxiliary equation of eq. (4.2). It can be obtained from this
differential equation by replacing y by m
2
, y by m and y by 1. In simple cases, the roots of
the auxiliary equation can be found by factoring. If the factorisation is not obvious, then
applying the quadratic formula, we see that the roots of the auxiliary equation are given by
a
ac b b
m
2
4
2
t

4.5
According to the sign of b
2
-4ac in eq. (4.5), we could have three different cases
AMA126 - 28 -
(i) Eq. (4.4) has distinct real roots (b
2
-4ac>0)
(ii) Eq. (4.4) has distinct complex roots (b
2
-4ac<0) (see later for this case)
(iii) Eq. (4.4) has repeated real roots (b
2
-4ac=0)
Theorem 1: If the roots m
1
and m
2
of the auxiliary equation are real and unequal, then the
general solution of ay+by+cy=0 is
x m x m
e C e C y
2 1
2 1
+ 4.6
___________________________________________
Example
Solve the differential equation
y+10y+16y=0
Solution
The auxiliary equation is
0 ) 2 )( 8 ( 0 16 10
2
+ + + + m m or m m
which means that m
1
=-8 and m
2
=-2. Since the roots of the auxiliary equations are real and
unequal, it follows from Theorem 1 that the general solution is
x x
e C e C y
2
2
8
1

+
with C
1
and C
2
two arbitrary constants. To find the two constants we need two boundary
(or initial) conditions. For example, we may give two points the solution passes through or
one point and the gradient for some value of x, or two gradients. In this case, if y=0 and
dy/dx=1 when x=0, using the general solution given above we have

'


+
1 2 8
0
2 1
2 1
C C
C C
which eventually will lead to C
1
=-1/6 and C
2
=1/6. So, the final form of the solution is
( )
x x
e e y
2 8
6
1

+
________________________________________________
Theorem 2: If the auxiliary equation has a double root m, then the solution of the equation
ay+by+cy=0 is
( ) x C C e xe C e C y
mx mx mx
2 1 2 1
+ + 4.7
AMA126 - 29 -
Proof: Using (4.5) with b
2
-4ac=0, we obtain m=-b/2a or 2am+b=0. Since m satisfies the
auxiliary equation, y=e
mx
is a solution of the differential equation. According to the remark
following the proof of Theorem (4.3), it is sufficient to show that y=xe
mx
is also a solution.
Substitution of xe
mx
for y in ay+by+cy=0 gives us
( ) ( )
( ) ( )
0 0 0
2
2
2
2
+
+ + + +
+ + + +
mx mx
mx mx
mx mx mx mx mx
e xe
e b am xe c bm am
cxe e mxe b xe m me a
which is what we wished to show.
________________________________________________
Example
Solve the differential equation
y-6y+9y=0
Solution
The auxiliary equation is m
2
-6m+9=0, or equivalently (m-3)
2
=0, has a double root 3.
Hence by Theorem (4.7), the general solution is
( ) x C C e xe C e C y
x x x
2 1
3 3
2
3
1
+ +
Example:
Solve the differential equation:
0 6 5 + y y y
Solution
The final case to consider is that in which the roots of the auxiliary equation are complex
numbers. For many of you the notion of complex numbers might sound a bit strange but it
is included in one of the module (SOM104) which runs parallel with this lecture.
The second case when deciding the nature of solution for a second order homogeneous
differential equation corresponds to the case when b
2
-4ac<0. In this case the auxiliary
equation is said to have complex roots.
AMA126 - 30 -
Complex numbers may be represented by expressions of the form a+ib, where a and b are
real numbers, and i is a symbol which may be manipulated in the same manner as a real
number, but has the additional property that i
2
=-1.
Two complex numbers a+ib and c+id are said to be equal, and we write a+ib=c+id, if and
only if a=c and b=d. Operations of addition, subtraction, multiplication and division are
defined just as in the case of real numbers; in the case of complex numbers all letters
denote real numbers, with the additional stipulation that whenever i
2
occurs, it may be
replaced by 1. For example, the formulas for addition and multiplication of two complex
numbers a+ib and c+id are
( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) bc ad i bd ac id c ib a
d b i c a id c ib a
+ + + +
+ + + + + +
We may regard the real numbers as a subset of the complex numbers by identifying the real
number a with the complex number a+i0. A complex number of the form 0+ib is called an
imaginary number.
Complex numbers are often required for solving equations of the form f(x)=0, where f(x) is
a polynomial. For example, if only real numbers are allowed, then the equation x
2
=-4 has
no solutions. However, if complex numbers are allowed, then the equation has a solution
2i, since
( ) ( ) 4 1 4 2 2
2 2 2
i i
Similarly, -2i is a solution of the equation x
2
=-4.
Since i
2
=-1, we sometimes use the symbol (-1) in place of i and write
i i i 5 2 25 2 25 2 , 13 13 + + +
and so on.
A quadratic equation ax
2
+bx+c=0, where a, b and c are real numbers and a0, has roots
given by the quadratic formula
.
2
4
2
a
ac b b
x
t

If b
2
-4ac<0, then the roots are complex numbers. To illustrate, if we apply the quadratic
formula to the equation x
2
-4x+13=0 we obtain
AMA126 - 31 -
i
i
x 3 2
2
6 4
2
36 4
2
52 16 4
t
t

Thus the equation has two complex roots 2+3i and 2-3i.
The complex number a-bi is called the conjugate of the complex number a+bi. We see
from the quadratic formula that if a quadratic equation with real coefficients has complex
roots, then they must be conjugate complex numbers.
It follows from the previous discussion that if the auxiliary equation am
2
+bm+c=0 has
complex roots, then they are of the form
it s z and it s z +
2 1
where s and t are real numbers. We may anticipate, from Theorem (4.6), that the general
solution of the differential equation ay+by+cy=0 is
( ) ( ) x it s x it s x z x z
e C e C e C e C y
+
+ +
2 1 2 1
2 1
4.8
In order to handle such complex exponents it is necessary to extend some of the concepts
of calculus to include functions whose domain includes complex numbers. Since a
complete development is beyond the scope of our work, we shall merely outline the main
ideas.
The Eulers Theorem
For every complex number
z i z e
iz
sin cos +
It can be shown that the Laws of Exponents are true for complex numbers. In addition,
formulas for derivatives developed earlier can be extended to functions of a complex
variable z. One such formula is

de
kz
/dz=ke
kz
, where k is a complex number.
Reminder: Laws of exponents
( )
m
m
m
n m
n
m
m m m mn
n
m n m n m
b
a
b
a
a
a
a
b a ab a a a a a

,
_

+
) (
AMA126 - 32 -
It can be proved that the general solution of ay+by+c=0, where the roots of the auxiliary
equation are complex numbers sti, is given by Eq. (4.8). The form of this solution may be
changed as follows:
( ) ( )
( )
itx itx sx
txi sx txi sx
txi sx txi sx
x it s x it s x z x z
e C e C e
e e C e e C
e C e C
e C e C e C e C y

+
+
+
+
+
+ +
2 1
2 1
2 1
2 1 2 1
2 1
4.9
This can be further simplified by using Eulers Formula. Specifically, we see from (4.8)
that
tx i tx e
tx i tx e
itx
itx
sin cos
sin cos

+

from which it follows that


i
e e
tx
e e
tx
itx itx itx itx
2
sin ;
2
cos

+
4.10
If we let C
1
=C
2
=1/2 in (4.9) and use (4.10) we obtain the particular solution y=e
sx
costx of
ay+by+cy=0. Letting C
1
= - i/2 and C
2
=i/2 gives us the particular solution y=e
sx
sintx.
This is a particular proof of the next theorem.
________________________________________________
Example: Evaluate
1 +
i
e
________________________________________________
Theorem
If the auxiliary equation am
2
+bm+c=0 has distinct complex roots sti, then the general
solution of ay+by+cy=0 is
) sin cos (
2 1
tx C tx C e y
sx
+ 4.11
________________________________________________
Example
Solve the differential equation
0 41 ' 10 ' ' + y y y
Solution
AMA126 - 33 -
The roots of the auxiliary equation m
2
-10m+41=0 are
i
i
m 4 5
2
8 10
2
64 10
2
164 100 10
t
t

Hence by Theorem (4.11), the general solution of the differential equation is


( ) x C x C e y
x
4 sin 4 cos
2 1
5
+
________________________________________________
Example
Find the particular solution of the differential equation 2y-3y+2y=0 which satisfies the
boundary condition y=0 and y=2 when x=0.
Solution
The roots of the auxiliary equation 2m
2
-3m+2=0 are
4
7 3
4
7 3
4
16 9 3 i
m
t

According to (4.11), the solution of the given differential equation can be written as

,
_

+ x C x C e y
x
4
7
sin
4
7
cos
2 1
4
3
This solution contains two constants which can be determined using the boundary
conditions. It is obvious that y(0)=C
1
=0. In order to use the second boundary condition we
have differentiate the solution y(x) with respect to x

,
_

+ +

,
_

+ x C x C e x C x C e y
x x
4
7
cos
4
7
4
7
sin
4
7
4
7
sin
4
7
cos
4
3
'
2 1
4
3
2 1
4
3
Taking into account that C
1
=0, we obtain that
2
4
7
) 0 ( '
2
C y
Solving this equation for C
2
, we obtain that
7
7 8
7
8
2
C
The final form of the solution will be
AMA126 - 34 -
x e y
x
4
7
sin
7
7 8
4
3

Example: Solve the differential equation:


3 ) 0 ( , 2 ) 0 ( ; 0 13 6 + y y y y y
________________________________________________
A special second order homogeneous differential is the Euler-Cauchy differential equation:
0
2
+ + cy y bx y x
where a and b are constants. Although this equation does not seem to be an equation with
constant coefficients, it can be reduced to that form using a new variable
| | ln x t or e x
t

Since we changed the variable, we have to change y and y, as well. To do so, we use the
chain rule :
2
2
2 2
2 2
2
2
2
2
2
2
2
2
2
1 1
1
dt
y d
e
dt
dy
e
x dt
y d
x dt
dy
dx
dt
dt
y d
dx
t d
dt
dy
dx
y d
e
dt
dy
x dt
dy
dx
dt
dt
dy
dx
dy
t t
t

+ +

,
_

,
_

+


Introducing all derivatives back into the original equation, we have
0 ) 1 (
0
2
2
2 2 2
2
2
2
+ +
+ +

cy
dt
dy
b
dt
y d
cy
dt
dy
e be e
dt
dy
e e
dt
y d
e
t t t t t t
AMA126 - 35 -
which now is a second order homogeneous differential equation with constant coefficients.
Therefore, we use the previous results to solve this equation.
The auxiliary equation is
0 ) 1 (
2
+ + c m b m
and the solution of the Euler-Cauchy differential equation can be found according to the
nature of the roots of the auxiliary equation.
a. Real and distinct roots (m
1
and m
2
)
2 1 2 1 2 1
| | | |
| | ln | | ln m m x m x m t m t m
x B x A Be Ae Be e A y + + +
b. Real but equal roots
m x m mt
x x B A e x B A e Bt A y | | |) | ln ( |) | ln ( ) (
| | ln
+ + +
c. Complex roots (m
12
=i)
|) | ln sin | | ln cos ( | |
|) | ln sin | | ln cos ( ) sin cos (
2 1
2 1
| | ln
2 1
x C x C x
x C x C e t C t C e y
x t


+
+ +
Example
Solve the differential equation
0 ) ( , 1 ) 1 ( 0
2
+ e y y with y y x y x
Solution
AMA126 - 36 -
Non-homogeneous linear differential equations
In this section we shall consider second-order non-homogeneous linear differential
equations with constant coefficients, that is, equations of the form
) ( ' ' ' x k cy by ay + + 5.1
where a, b and c are constants and the function k(x) is continuous. The function k(x) is
often called the forcing term or the source term. It is convenient to use the differential
operator symbol D and D
2
where if y=f(x), then
) ( ' ' ' ' ), ( ' '
2
x f y y D x f y Dy
We shall also employ the linear differential operator
c bD aD L + +
2
where by definition
( ) . ' ' ' ) (
2 2
cy by ay cy bDy y aD y c bD aD y L + + + + + +
Using this notation, equation (5.1) can be written in the compact form L(y)=k(x). It is easy
to verify that for every real number C,
) ( ) ( y CL Cy L
5.2
Also, if y
1
=f
1
(x) and y
2
=f
2
(x), then it can be shown that
) ( ) ( ) (
2 1 2 1
y L y L y y L + + 5.3
Given the differential equation (5.1), that is, L(y)=k(x), the corresponding homogeneous
equation L(y)=0 is called the complementary equation. Suppose that y
p
is a particular
solution of L(y)=k(x) and y
c
is any solution of the complementary equation. Since
L(y
p
)=k(x) and L(y
c
)=0
) ( 0 ) ( ) ( ) ( ) ( x k x k y L y L y y L
c p c p
+ + +
which means that y
p
+y
c
is a solution of (5.1).
Theorem If y
p
is a particular solution of the differential equation L(y)=k(x) and if y
c
is a
general solution of the complementary equation L(y)=0, then the general solution of
L(y)=k(x) is y=y
c
+y
p
. (5.4)
AMA126 - 37 -
If we use the results of the previous section to find the solution y
c
of L(y)=0, then according
to the above theorem all that is needed to determine the general solution of L(y)=k(x) is
one particular solution y
p
.
Example
Solve the differential equation
y-4y=6x-4x
3
.
Solution
We see by inspection that y
p
=x
3
is a particular solution of the given equation. The
complementary equation y-4y=0 which by (4.6), has solution
x x
e C e C y
2
2
2
1

+
Applying the theorem, the general solution of the given non-homogeneous differential
equation is
.
3 2
2
2
1
x e C e C y
x x
+ +

In most cases a particular solution of (5.1) cannot be found by inspection as it was done in
the previous Example.
Given the differential equation
nx
e cy by ay y L + + ' ' ' ) (
where e
nx
is not a solution of L(y)=0, it is reasonable to expect that there is a particular
solution of the form y
p
=Ae
nx
, since e
nx
is the result of finding ay+by+cy=0. This suggests
that we use Ae
nx
as a trial solution in the given equation and attempt to find the value of the
coefficient A. This technique is called the method of undetermined coefficients, and is
illustrated in the next example
Example
Solve the differential equation
y+2y-8y=e
3x
.
Solution
Since the auxiliary equation m
2
+2m-8=0 of y+2y-8y=0 has roots 2 and -4 it follows that
the general solution of the complementary equation is
.
4
2
2
1
x x
c
e C e C y

+
From the preceding remarks we seek a particular solution of the form y
p
=Ae
3x
. Since y
p
=3Ae
3x
and y
p
=9Ae
3x
, substitution in the given equation leads to
AMA126 - 38 -
. 8 6 9
3 3 3 3 x x x x
e Ae Ae Ae +
Dividing both sides by e
3x
we obtain
.
7
1
1 8 6 9 + A or A A A
Thus y
p
=(1/7)e
3x
and by Theorem (5.4), the general solution is
.
7
1
3 4
2
2
1
x x x
e e C e C y + +

After all, the method of undetermined coefficients is based on guessing the right form for
y
p
. The guess is based on experience and comes down to a few rules:
1. If k(x) is a polynomial of degree q, try
0 1
1
1
a x a x a x a y
q
q
q
q p
+ + + +


i.e. a polynomial of the same degree.
2. If k(x)=acosmx+bsinmx (including the cases when a=0 or b=0), try
mx B mx A y
p
sin cos +
4. If k(x)=ae
px
and p is not a root of the auxiliary equation, try
px
p
Ae y
5. If k(x)=ae
px
and p is a root of the auxiliary equation, try
px
p
Axe y
6. If k(x)=xe
px
and p is not a solution of the auxiliary equation
then try a particular solution of the form
px
p
e Bx A y ) ( +
7. If k(x)=e
sx
sintx or k(x)=e
sx
costx and s+ti is not a solution of
the auxiliary equation, then try a particular solution of the form
. sin cos tx Be tx Ae y
sx sx
p
+

8. If k(x) is a sum of simpler functions in the list above, find
AMA126 - 39 -
the particular integral for each of these simpler functions
and add them together.
Example
Find the general solution of the equation
1 2 12 13
2
2
+ t y
dt
dy
dt
y d
Solution
The characteristic equation is
( ) ( ) 12 , 1 0 1 12
0 12 13
2 1
2

+
m m or m m
m m
which means that the complementary solution is
t t
c
Be Ae y
12
+
For the particular solution, try y
p
=at+b. Accordingly, y
p
=a, y
p
=0. We substitute back into
the equation
( )
( )
72
7
6
1
1 2 13 12 12
1 2 12 13 0

+
+ +
b a
t a b at
t b at a
This means that general solution
72
7
6
12
+ + +
t
Be Ae y
t t

Example: Solve the non-homogeneous differential equation
0
2
, 0 ) 0 ( ; 1
2
2

,
_

+

y y y
dx
y d
Solution:
y=1-sinx-cosx
AMA126 - 40 -
Example
Solve the differential equation
t
e y
dt
dy
dt
y d
4
2
2
2 3 +
Solution
The characteristic equation is
( ) ( ) 2 , 1 0 1 2
0 2 3
2 1
2

+
m m or m m
m m
The complementary solution is
t t
c
Be Ae y +
2
Since m4, we try a particular solution of the form y
p
=ae
4t
, i.e. y
p
=4ae
4t
, y
p
=16ae
4t
.
Introducing these expressions back into the original equation we have
( )
6
1
, 1 6 . . , 2 12 16
4 4
+ a a e i e e a a a
t t
Finally, the general solution is
6
4
2
t
t t
e
Be Ae y + +
Example
Solve the differential equation
t
e y
dt
dy
dt
y d
2
2
2
2 3

+ +
given that y=0 and dy/dt=0 when t=0.
Solution
The characteristic equation is
AMA126 - 41 -
( )( )
t t
c
Be Ae y
so m m or m m
m m

+
+ +
+ +
2
2 1
2
2 , 1 0 1 2
0 2 3
Here e
-2t
is part of the complementary solution so we must try a particular solution of the
form y
p
=ate
-2t
. Accordingly
( ) ( )
( ) [ ] ( )
t t t t
p
t t t
p
te e a e t e a y
e t a te e a y
2 2 2 2 ' '
2 2 2 '
4 4 2 1 2 2
2 1 2


+

Introducing back into the original equation, the left hand side will look like
( )
t t t t t t
ae te te e te e a LHS
2 2 2 2 2 2
2 6 3 4 4

+ + +
Note that the terms in te
-2t
cancel out, this will always happen. Comparing the two sides of
the equation we obtain that a=-1. So, the general solution of the equation is
t t t
te Be Ae y
2 2
+
Now we have to find the two constants, A and B, using the initial conditions given. When
t=0, y=0, i.e. 0=A+B. To use the other condition we calculate
t t t t
te e Be Ae y
2 2 2
2 2

+ .
When t=0, we have 0=-2A-B-1. Combining the two relations obtained for the two
constants we obtain A=-1 and B=1. So, the final solution is
t t t
te e e y
2 2
+
.
Example
Solve the differential equation
t y
dt
dy
dt
y d
2 sin 2 3
2
2
+ + and describe the behaviour of the solution as t.
Solution
AMA126 - 42 -
Population dynamics
Population dynamics is concerned with numbers in populations and factors which cause
them to change. In addition to natural curiosity, population dynamics is useful in studying
problems involving economic and social situations, e.g. farming, fishing, spread of
epidemics, conservation (killing of whales, Amazon rain forests, etc. ).
In studying population dynamics we shall be concerned with either one species (e.g.
humans) or two interacting/competing species (rabbits and foxes).
Population dynamics tries to answer questions like:
What will be the population of a certain country in 10 years?
How are we protecting the resources from extinction?
To try to answer to these types of questions we construct simple mathematical models of
real life situation then use models to predict future changes.
Models simplify the real situation and aim to isolate the main factors and study their effect
on the main population. These models may be crude but they can give surprisingly accurate
predictions.
In order to be able to model these situations we have to make some assumptions:
1. the number of individuals in a given area can be represented by a single variable, x,
measured in terms of some chosen unit of population, so x is the population density.
By treating the population as a whole, we ignore age and sex differences.
2. x is a continuous and differential function of t, taken as a continuous variable. This
may seen a surprising assumption since we might expect to take x as an integer, the
population of any species changing by integer amounts. However if a given
population is very large and it is increased by a few in short time intervals, those
changes are very small compared to the total population and a graph of x with
respect to t looks like a continuous function and indeed a differentiable function
and as we assume that it is.
We have in mind populations such as the human population which has no fixed breeding
season. Some species such as sheep have a single breeding season and for these it may be
more sensible to measure x at discrete time intervals, the ends of the breeding seasons, for
example. This leads to difference equation models which will be studied later.
AMA126 - 43 -
One species models
(e.g. number of people in the world, number of bacteria in an experiment, number of trees
in the forest, etc.)
Let x(t) the number of members of a population. Large population if increase/decrease not
too drastically than it is reasonable to approximate the function x(t) by a continuous and
differentiable function of t.
Let the number, x(t), of members of a population at time t be large enough for x(t) to be
continuous. If x(t
0
) is known, can the number be predicted at subsequent times?
In general the time scale depends on the population type: for humans in years, for bacteria
in hours or days.
To model the growth we consider the rate at which the population changes. The
instantaneous growth rate at time t is dx/dt. The instantaneous relative growth (or rate of
change per individual) is
dt
dx
x
t r
1
) (
The population dynamics operate with a few models which are surprisingly accurate.
In order to model the problem, we are going to use two types of first order differential
equations already presented previously. In what follows we are revising the methods of
solving these types of equations
1. Separation of variables: if the differential equation can be written as

> dt t f
x g
dx
x g t f
dt
dx
) (
) (
) ( ) (
2. The integrating factor: if the differential equation can be written as
) ( ) ( t Q x t P
dt
dx
+
then the equation is solved by using the integrating factor
[ ]

dt t P ) ( exp
Example1
1. Solve the differential equation x(t)=ax, where a is a constant for x0 such that
(i) x=x
0
when t=0
(ii) x=x
0
when t=t
0
AMA126 - 44 -
Solution
This equation can be solved by variable separation

dt a
x
dx
Integrating both parts we have
at A at
Ce x or e x or A at x +
+
ln
which is the general solution, A is an arbitrary constant. Now we are going to use the initial
conditions
(i) of x=x
0
when t=0, then we have
at
e x x e i C Ce x
0
0
0
. .
which is a particular solution
(ii) if x=x
0
when t=t
0
, then
( )
0 0 0
0 0 0
. .
t t a at at
e x x so e x C e i Ce x


Example2
Find the solution of the differential equation x(t)=ax(b-x), where a and b (b>0) are
constants for 0xb which satisfies x(0)=x
0
.
Solution
This equation can be solved again using variable separation. Accordingly we write
( )

dt a
x b x
dx
Now, the integrand of left-hand side can be decomposed as
( )
( ) Bx x b A or
x b
B
x
A
x b x
+

1
1
This equation must be valid for all values of x. Putting first x=0 we have 1=Ab, so A=1/b.
Then we put x=b and we obtain 1=Bb, so B=1/b. Using these values, the integrand can be
decomposed as
( )

,
_

+
x b x b x b x
1 1 1 1
which means that the integral is
AMA126 - 45 -

,
_


x b
x
b
x b
b
x
b x b
dx
b x
dx
b x b x
dx
ln
1
) ln(
1
ln
1 1 1
) (
since 0xb. Returning to the differential equation obtained after separating the variables
we have
ct abt
Ce Ce
x b
x
A abt
x b
x
or A at
x b
x
b

,
_

,
_

ln ' ln
1
where A=Ab, A and c=ab are constants. If x=x
0
when t=0
( ) ( )
( )
( )
ct
ct ct
ct
ct
e x b x
bx
x
e bx e x x b x
e x b x x b x
e
x b
x
x b
x
C
x b
x

+

+

0 0
0
0 0 0
0 0
0
0
0
0

Example
Find the general solution of the differential equation
bt
Ae ax
dt
dx
+
where a, b and A are constants.
Solution
This is a linear differential equation with P(t)=a and Q(t)=Ae
bt
. Therefore the integrating
factor is
at
adt
e e

Multiplying the original differential equation by the integrating factor gives


AMA126 - 46 -
t b a at bt at at
Ae e Ae x ae
dt
dx
e
) ( +
+
Since we have multiplied the differential equation by the integrating factor, the left-hand
side of the above relation can be written as
( ) x e
dt
d
at
since
( ) ( ) x ae
dt
dx
e e
dt
d
x
dt
dx
e x e
dt
d
at at at at at
+ +
and so
( )
t b a at
Ae xe
dt
d
) ( +

Integrating both sides with respect to t gives


B e
b a
A
xe
t b a at
+
+

+ ) (
where B is an arbitrary constant. From above relation, x can be expressed as
at bt
Be e
b a
A
x

+
+

Exponential model (The Malthusian model)


Is the simplest model when we suppose that the instantaneous relative growth, r(t), is
constant (a)
ax
dt
dx
or a
dt
dx
x

1
This model says that the rate of change of the population is proportional to the existing
population. If x=x
0
when t=t
0
, we obtained
( )
0
0
t t a
e x x

AMA126 - 47 -
If a>0 then this result gives an exponential growth
a<0 then this result gives an exponential decay and a is called
growth (decay) rate
here x(t)=P(t) and x
0
=2 and a=0.2
A useful measure of the growth of a population is
the doubling time. If t
1
-t
0
= time required for
population to double, then at t=t
1
, x=2x
0
and so
( )
( )
2 ln
1
2 ln 2
0 1
0 1 0 0
0 1
a
t t
t t a e x x
t t a



Example: (Application to world human population)
In 1961 the world population was 3.06x10
9
. Over the next 10 years it increased at relative
growth rate of 2% per year. Calculate the doubling time.
Solution
Applying the formula, with t
0
=1961, a=0.02, x
0
=3.06x10
9
, we have
( ) 1961 02 . 0 9
10 06 . 3


t
e x
and the doubling time is ln2/0.02=34.7 years. Estimates from 1700 to 1961 suggest that the
doubling time was 35 years, which means that this model gives good agreement with
reality.
What about future predictions: In 1991 a population of 5,575 million, in 2389 a population
of 15,969,164 million (the surface area of the Earth is approximately 16,700,500 million
m2)
That means that the exponential model gives unreasonable predictions for the future. For
positive growth rate, when time tends to infinity, the population number tends to infinity
which is in contradiction with the available resources or environment limitations. Therefore
it is obvious that a new model has to be used which can give reasonable results for large
times.
The logistic model (Verhulst-Pearl model)
AMA126 - 48 -
The exponential model (besides that it gives too large predictions for large times) does not
reflect the competition between individuals, the limits of the resources and food supply.
For many species with a finite food supply the population tends to an upper limit which
depends on the environment conditions. The idea behind the logistic model says that while
the population will continue to grow as time goes on, the rate at which it does this growing
gets smaller.
Let us denote by c the reproductive parameter, x(t) the population density and k the
carrying capacity of the environment (or a limiting size of population). Then the proposed
logistic equation (Verhulst 1844) is

,
_


k
x
cx
dt
dx
1
In general, k is large. For small values of x, cx
2
/k is negligible compared to cx and initially
the population grows exponentially. When x is large, the cx
2
/k term is no longer small and
slows down the rate of increase of x.
The logistic equation can be interpreted if we expand out the logistic equation
2
x
k
c
cx
dt
dx

which suggests a situation when the birth rate is still constant cx, but in which there is a
mortality term, cx
2
/k, that dominates when the population is high.
If x>k, then dx/dt<0 and the population decreases, when x=k then the population growth is
a constant.
Now
( ) ( ) x b ax x k x
k
c
dt
dx

putting a=c/k, b=k ab=c, using Example2
( )
ct
e x k x
kx
x

+

0 0
0
Since
0 0 >

c for t as e
ct
it follows from the above form of the
solution that xk as t for any x
0
.
AMA126 - 49 -
(here cr)
Let us take the logistic equation

,
_


k
x
cx
dt
dx
1
This equation has two population levels x=0 and x=k for which dx/dt=0. These are called
equilibrium levels. Suppose that the population is closed to one of these levels at some time
and we want to see whether it will remain close to that level for all t?
If it does, we say that the population is locally stable, if it does not remain close then it is
unstable. From the graph, the point x=k is locally stable but x=0 is unstable. We can gain
this information without sketching the graph as follows:
For x=k write x=k+X(t), where X(t) is a small quantity; then dx/dt=dX/dt, since
k=constant, and from the logistic equation
( ) ( )
k
cX
cX
k
X
X k c
k
X k
X k c
dt
dX
2
1
,
_

+
,
_

+
+
Since X(t) is a small quantity we can neglect the term containing the X
2
term, so
ct
Ae X cX
dt
dX


Since c>0, X 0 as t, i.e. x remains close to x=k and so is locally stable.
Harvesting
AMA126 - 50 -
The population of fish in the North Sea can be described by the logistic equation
2
1 sx cx
k
x
cx
dt
dx

,
_


putting s=c/k a positive number.
Suppose that the fish are caught (harvested) at a constant rate h, i.e. in the absence of all
other factors
h
dt
dx

To account for harvesting the logistic equation must be modified to
h sx cx
dt
dx

2
Let us first discuss the equilibrium levels of this model. The equilibrium levels are at x=x
e
,
such that dx
e
/dt=0, i.e.
0 0
2 2
+ +
s
h
kx x or h cx sx
e e e e
(*)
Solving this second order equation we obtain
s
h k k
s
h
k k
x
e
t
t

4 2 2
4
2
2
Case (a) If the determinant is positive, i.e. k
2
/4-h/s>0, then
4
2
sk
h <
(moderate fishing).
In this case, there are two positive real roots (i.e. two equilibrium levels) x
1
and x
2
where
k x x
s
h k k
x
k
s
h k k
x
< <

< +
1 2
2
2
2
1
4 2
4 2
and
AMA126 - 51 -
( )( ).
2 1
2
x x x x s
s
h
kx x s
dt
dx

,
_

+
Case (b) If the determinant is negative i.e. k
2
/4-h/s<0, then
4
2
sk
h >
(over intensive
fishing).
In this case there are no real roots, i.e. there are no equilibrium levels. Completing the
squares, dx/dt can be written as
0
4 2
0
2
2
2
<
1
1
1
]
1

,
_

,
_

+
>

s
h k k
x s
s
h
kx x s
dt
dx
(**)
dx/dt< 0 for all values of x, i.e. since dx/dt never reaches 0, we have no
equilibrium levels.
Case (c) If the determinant is zero, i.e. . k
2
/4-h/s=0. Equation (*) has a repeated root
2
k
x
e

From equation (**)
0
2
2
<

,
_


k
x s
dt
dx
for all values of x except x=x
e
.
(ii) Local stability. First we consider case (a) where we have two equilibrium levels. Let
x=x
e
+X(t), where x
e
=x
1
or x
2
. Then
[ ][ ]
2 1
x X x x X x s
dt
dX
dt
dx
e e
+ +
When x
e
=x
1
( ) [ ] ( )
2
2 1 2 1
) ( X O X x x s X x x sX
dt
dX
+ +
Neglecting terms proportional to X
2
, we arrive at a simple first order differential equation
which can be solved by separating the variables
AMA126 - 52 -
( ) t x x s
Ae X
2 1

where A is a constant. Since x


1
>x
2
, X0 as t and so x
1
is locally stable.
When x
e
=x
2
( )
( )



t as
Be X X x x s
dt
dX
t x x s
1 2
1 2
and so x
2
is unstable.
(iii) Graph of x(t)
First of all we note that
( ) ( ) ( ) 0
2 1
> s x x x x s
dt
dx
For
x>x
1
dx/dt<0 => x decreasing
x
2
<x<x
1
dx/dt>0 => x increasing
0<x<x
2
dx/dt<0 => x decreasing
Here x
0
=x(0). If x
0
<x
2
, the graph intersects x=0 at a finite time T. From
AMA126 - 53 -
( ) ( )
( ) ( )
( ) ( )







0
0
0 2 1
0
0 2 1
2 1
1
x
x
T
x x x x
dx
s
T
sT dt s
x x x x
dx
x x x x s
dt
dx
Case (b)
4 4
2 2
sk
h or
s
h k
> <
In this case we have no equilibrium levels, i.e. dx/dt <0 for all values of x.
In either case x becomes zero in a finite time.
Case (c) h=sk
2
/4. The graph can be obtained easily from case (a) when the two roots are
identical, i.e. x
1
=x
2
.
Conclusions: Although limited, this modelling of harvesting indicates that there is a
maximum harvesting rate
AMA126 - 54 -
ck k
k
c sk
h
4
1
4
1
4
2
2

at which the population can sustain itself in equilibrium. Any greater rate leads to a
depletion of stock eventually to zero. At h=ck/4 the equilibrium level is k/2 (not the
equilibrium level k of the logistic model). Any harvesting of depleted species will result in
extinction.
Two species model. Predator-prey
Suppose an island supports a crop of foliage and populations of foxes and rabbits. The
foxes eat the rabbits. The rabbits eat the foliage (i.e. limited supply). What happens with
the populations???
Assuming no other interference with the system, we might expect the two populations to
oscillate.
Let x(t) be the population of rabbits at time t. With no foxes around, we assume that x(t)
obeys the logistic equation
0 , 0 ,
2
> > b a bx ax
dt
dx
a/b being the carrying capacity or saturation level.
Let y(t) be the population of foxes at time t. Assuming that the number of encounters per
unit time between foxes and rabbits is proportional to x and y and that a certain proportion
of these results in rabbit being eaten, i.e. the rate of decrease in the rabbit population is
proportional to xy. In this case the differential equation becomes
0 , , ,
2
> c b a cxy bx ax
dt
dx
(1)
If no rabbits are present, we assume foxes die out exponentially, i.e.
0 , > p py
dt
dy
With rabbits present, the rate of increase of foxes is proportional to the number of
successful encounters with rabbits and so the differential equation becomes
0 , , > + q p qxy py
dt
dy
(2)
AMA126 - 55 -
The two populations are therefore determined by the coupled pair of nonlinear ordinary
differential equations (1) and (2). Putting b=0 (=> an abundance of foliage) gives the
Lotka-Volterra (LV) equations
cxy ax
dt
dx
(3)
qxy py
dt
dy
+ (4)
Equilibrium populations. Let x=x
e
and y=y
e
the equilibrium populations and they are
given by the usual conditions dx
e
/dt=0, dy
e
/dt=0, i.e.
( ) 0
e e
cy a x (5)
( ) 0 +
e e
qx p y
(6)
Equation (5) is satisfied by x
e
=0 or y
e
=a/c.
If x
e
=0, then from Eq. (6) we obtain that y
e
=0.
If y
e
=a/c, then from Eq. (6) we obtain that -p+qx
e
=0 => x
e
=p/q.
The equilibrium populations are therefore
c
a
y
q
p
x and y x
e e e e
, 0 , 0
Are these equilibrium populations stable?
Let us take the Lotka-Volterra equations (Eqs. (3) and (4)) and we consider
Y
c
a
y X
q
p
x + + ,
where the quantities X and Y are small increments. These expressions are introduced back
into the Lotka-Volterra equations and we obtain
X
c
qa
X
q
p
q p Y
c
a
dt
dY
dt
dy
Y
q
pc
Y
c
a
c a X
q
p
dt
dX
dt
dx

1
]
1

,
_

+ +

,
_

+

1
]
1

,
_

+
,
_

+

=>
AMA126 - 56 -
Y
q
pc
dt
dX

(7)
X
c
qa
dt
dY
(8)
This is a system of two coupled first order ordinary differential equations. In order to solve
this system, we use the usual procedure, i.e. first we differentiate Eq. (7) with respect to t
and we use the derivative of Y with respect to t from Eq. (8)
0 ,
2
2
>
,
_

ap apX X
c
qa
q
pc
dt
dY
q
pc
dt
X d
(9)
To find the governing equation for Y, we follow the same way, i.e. we differentiate Eq. (8)
with respect to t and use Eq. (7)
apY Y
q
pc
c
qa
dt
dX
c
qa
dt
Y d

,
_


2
2
(10)
The general solution of (10) is
t B t A Y sin cos + (11)
putting
2
=ap.
To find the solution for X, we use Eq. (8) which gives
[ ] t B t A
aq
c
X
t B t A
dt
dY
X
c
qa


cos sin
cos sin
+
+
(12)
[Using Eq. (9) to find X introduces extra constants which are connected to A and B via Eq.
(8)]
Suppose that at t=0, X=X
0
and Y=Y
0
. Then A=Y
0
and B=X
0
aq/c, so that
t X
c
aq
t Y Y
t Y
aq
c
t X X

sin cos
sin cos
0 0
0 0
+

The above equations show that X and Y are bounded and so stay close to x=p/q, y=a/c for
all t, so this point is locally stable.
Also
AMA126 - 57 -
( ) + + t R t R t R Y sin sin cos cos sin (13)
putting
( )
( )
,
_

+ +

+

2
cos cos
cos cos sin sin
cos , sin
0 0


t R Y t R
aq
c
X
t t R
aq
c
X
and X
c
aq
R Y R
where we have used the trigonometrical identity
( )

sin
2
sin sin
2
cos cos
2
cos +
For the other equilibrium level (0,0), we put
x=0+X=X, y=0+Y=Y
then from Eqs. (3) and (4) we have
. , qXY pY
dt
dY
cXY aX
dt
dX
+
Having in mind that X and Y are small quantities, we can neglect the 2
nd
order terms XY
at
Ae X aX
dt
dX

X grows exponentially in time since a>0, i.e. X as t
AMA126 - 58 -
the point (0,0) is unstable
N.B. Only need either X or Y to grow exponentially for an unstable point.
Summary
I. One species
I.a Exponential model:
at
Ae x ax
dt
dx
(comparison with data
I.b Logistic model: limited resources, saturation level k

,
_


k
x
cx
dt
dx
1
-solution
-graph
I.c Harvesting: constant rate h, the rate proportional to x and the
differential equation of the form similar to the logistic model
Equilibrium levels (x=x
e
): dx
e
/dt=0
Local stability (instability): take x=x
e
+X(t) and
neglect second order terms in X
II. Two species
II.a Predator-prey (notes)
II.b Competing species (example sheet 9, 11)
Equilibrium levels and stability
Discrete Mathematics and Difference Equations
Discrete mathematics is the branch of mathematics dealing with objects that can assume
only distinct, separated values. The term "discrete mathematics" is therefore used in
contrast with "continuous mathematics," which is the branch of mathematics dealing with
objects that can vary smoothly (and which includes, for example, calculus). Whereas
discrete objects can often be characterized by integers, continuous objects require real
numbers.
The study of topics in discrete mathematics usually includes the study of algorithms, their
implementations, and efficiencies. Discrete mathematics is the mathematical language of
computer science, and as such, its importance has increased dramatically in recent decades.
Mathematical computations frequently are based on equations that allow us to compute the
value of a function recursively from a given set of values. Such an equation is called a
difference equation or recurrence equation. These equations occur in numerous
settings and forms, both in mathematics itself and in its applications to statistics,
computing, electrical circuit analysis, dynamical systems, economics, biology, etc.
Example
AMA126 - 59 -
In 1626, Peter Minuit purchased Manhattan Island for goods worth $24. If the $24 could
have been invested at an annual interest rate of 7% compounded quarterly, what would it
have been worth in 2004?
Solution
Let y(t) be the value of the investment after t quarters of a year. Then y(0)=24. Since the
interest rate is 1.75% per quarter, y(t) satisfies the difference equation
, 2 , 1 , 0 ) ( 0175 . 1 ) ( 0175 . 0 ) ( ) 1 ( + + t t y t y t y t y

Computing y recursively, we have
t
t y
y
y
) 0175 . 1 ( 24 ) (
) 0175 . 1 ( 24 ) 2 (
) 0175 . 1 ( 24 ) 1 (
2

In 378 years, or 1512 quarters, the value of the investment is


y(1512)=24(1.0175)
1512
5.9x10
12
(about 5.9 trillion dollars!)
Example
It is observed that the decrease in the mass of a radioactive substance over a fixed time
period is proportional to the mass that was present at the beginning of the time period. If
the half life of radium is 1600 years, find a formula for its mass as a function of time.
Solution
Let m(t) represent the mass of the radium after t years. Then
m(t+1)-m(t)=-km(t)
where k is a positive constant. Then
m(t+1)=(1-k)m(t), t=0,1,2
Using iteration as in the previous example, we find
t
k m t m ) 1 )( 0 ( ) (
Since the half life is 1600 years
AMA126 - 60 -
1600
1600
1
1600
2
1
) 0 ( ) (
2
1
1 ) 0 (
2
1
) 1 )( 0 ( ) 1600 (
t
m t m
so
k m k m m

,
_

,
_


(In physics, this problem is usually solved using an integral of a differential equation. The
solution presented here is somewhat shorter and employs only elementary algebra)
The starting equations in the above examples were all difference equations. By definition,
an equation which expresses the value a
n
of a sequence {a
n
} as a function of the term a
n-1
is
called first-order difference equation. If we can find a function f such that a
n
=f(n), n=1, 2,
3, then we will have solved the difference equation.
Both examples had a general difference equation of the form
, 2 , 1 , 0 ,
1

+
n Ax x
n n
From the above examples, it is obvious that if x
0
is the initial value, then
0
x A x
n
n

Given the constants A and B, a difference equation of the form
, 2 , 1 , 0 ,
1
+
+
n B Ax x
n n
is called a first-order linear difference equation. Note that the linear difference equation
reduces to the difference equation if B=0. In order to solve this type of equation, we write
). 1 (
) 1 ( ) 1 ( ) (
) 1 ( ) (
2 2 1
0
2
3
3
3
2
2
2
2 1
+ + + + +
+ + + + + +
+ + + + +



A A A A B x A
A A B x A A B B Ax A
A B x A B B Ax A B Ax x
n n n
n n
n n n n

Note that if A=1, this gives us


, 2 , 1 , 0 ,
0
+ n nB x x
n
as the solution of the difference equation x
n+1
=x
n
+B. If A1, we know that
AMA126 - 61 -
A
A
A A A A
n
n n

+ + + + +

1
1
1
2 2 1

Hence

,
_

+
A
A
B x A x
n
n
n
1
1
0
is the solution of the first-order linear difference equation x
n+1
=Ax
n
+B, when A1.
____________________________________________________
Example (Newtons law of cooling)
If T
0
represents the initial temperature of the object, S the constant temperature of the
surrounding environment and T
n
the temperature of the object after n units of time, then the
change in the temperature over one unit of time is given by
( ) S T k T T
n n n

+1
where k is a constant which depends upon the object. This difference equation is known as
Newtons law of cooling. Suppose a cup of tea, initially at a temperature of 82 C, is placed
in a room which is held at a constant temperature of 26 C. Moreover, suppose that after one
minute the tea has cooled to 80 C. What will the temperature be after 20 minutes?
Solution
If we let T
n
be the temperature of the tea after n minutes and we let S be the temperature of
the room, then we have T
0
=82, T
1
=80, and S=26. Newtons law of cooling states that
( ) , 2 , 1 , 0 , 26
1

+
n T k T T
n n n
where k is the constant which we have to determine. To do so, we make use of the
information given about the change in the temperature of the tea during the first minute.
When n=0, we have
( ) 035 . 0 ) 26 82 ( 82 80 26
0 0 1
k so k or T k T T
Thus, the original equation reduces to
91 . 0 965 . 0 91 . 0 035 . 0
91 . 0 035 . 0 ) 26 ( 035 . 0
1
1
+ +
+
+
+
n n n n
n n n n
T T T T
so
T T T T
Now the last equation is in the standard form of a first-order linear difference equation, so
from the solution (according to the method of solving presented earlier)
AMA126 - 62 -
n
n n
n
n
n
T
) 965 . 0 ( 56 26
) ) 965 . 0 ( 1 ( 26 ) 82 ( 965 . 0
965 . 0 1
965 . 0 1
91 . 0 ) 82 ( 965 . 0
+
+

,
_

+
In particular,
5 . 53 ) 965 . 0 ( 56 26
20
20
+ T
So after 20 minutes the tea has cooled to just below 54 C.
____________________________________________________
An equation of the type
) (
1 2
n f cu bu au
n n n
+ +
+ +
where a, b and c are constants and f(n) a given function is called a second order constant
coefficient difference equation. The equation is said to be homogeneous if f(n)=0 and
inhomogeneous if f(n)0.
a. Homogeneous second order difference equations
We can have an idea on how these equations can be solved by looking first at first-order
equation with constant coefficient
0
1

+ n n
cu u
which has the solution
n
n
Ac u
where A is any constant. With this in view, we attempt to find solutions of
0
1 2
+ +
+ + n n n
cu bu au
in the form
n
n
p u
where p is a constant. Thus
0 ) (
2 1 2
1 2
+ + + + + +
+ +
+ +
n n n n
n n n
p c bp ap cp bp ap cu bu au
AMA126 - 63 -
for all n. The solution p=0 leads to the trivial solution u
n
=0. We are interested in the roots
of the equation in the brackets which is called the characteristic equation.
According to the nature of the roots of the characteristic equation, we can have different
solutions.
Case 1: Distinct roots
The general solution of the second-order difference equation for distinct roots p
1
and p
2
of
ap
2
+bp+c=0 is
n n
n
Bp Ap u
2 1
+
for any constant A and B.
Example
Find the general solution of
0 6
1 2

+ + n n n
u u u
Solution
The characteristic equation is p
2
-p-6=0 or (p-3)(p+2)=0. This means that the roots are
p
1
=3 and p
2
=-2. Hence the general solution is
( )
n n
n
B A u 2 3 +
Example
Find the solution of
0 3 2
1 2
+
+ + n n n
u u u
that satisfies u
0
=1, u
1
=2.
Solution
The characteristic equation is
0 ) 1 )( 3 ( 0 3 2
2
+ + p p or p p
The roots are p
1
=-3 and p
2
=1. Hence the general solution is
( ) ( ) B A B A u
n n n
n
+ + 3 1 3
Using the initial conditions
B A u B A u + + 3 2 , 1
1 0
AMA126 - 64 -
Hence A=-1/4 and B=5/4. The required solution is
( )
4
5
3
4
1
+
n
n
u
Case 2: Equal roots(p
1
=p
2
=p)
The general solution of
0
1 2
+ +
+ + n n n
cu bu au
is
n
n
p Bn A u ) ( +
(please note the difference in the form of the second-order difference equation)
Case 3: Complex roots
The general complex solution of
0
1 2
+ +
+ + n n n
cu bu au
, where b
2
<4ac, is
( ) ( )
n n
n
i B i A u + +
This solution can be written in other form by writing the complex numbers in polar
coordinates (r,). The connection between the two forms of writing a complex number is

+ tan , sin , cos ,


2 2
r r
r
So the general solution of a second-order homogeneous difference equation with complex
roots can be also written as
( ) n D n C r u
n
n
sin cos +
Example
Obtain the general solution of
0
2
+
+ n n
u u
Solution
The characteristic equation is p
2
+1=0, giving roots p
1
=i and p
2
=-i. Therefore
( )
n n
n
i B Ai u +
In polar form, r=1 and
2
1 sin

k
where k is an integer number. So, the solution is
AMA126 - 65 -
2
sin
2
cos

n D n C u
n
+
b. Inhomogeneous second-order difference equations
The general inhomogeneous equation is
) (
1 2
n f cu bu au
n n n
+ +
+ +
We write u
n
=v
n
+q
n
, where v
n
is the general solution of the corresponding homogeneous
equation. Substitute this form of u
n
into the general equation
( ) ( ) ( ) ) (
1 1 2 2
n f q v c q v b q v a
n n n n n n
+ + + + +
+ + + +
or
( ) ( ) ) (
1 2 1 2
n f cq bq aq cv bv av
n n n n n n
+ + + + +
+ + + +
Since v
n
satisfies the homogeneous equation, it follows that
), (
1 2
n f cq bq aq
n n n
+ +
+ +
which means that q
n
must be a particular solution of the inhomogeneous equation. As in the
theory of differential equations, v
n
is known as the complementary function.
We construct particular solutions by appropriate choices of functions usually containing
adjustable parameters which are suggested by the form of the function f(n). In the
following table you will find the suggested forms of particular solutions
kn C kn C kn or kn
n C n C C eger p n
n C C n
etc fails Ck if Cnk or Ck k
etc fail Cn and C if Cn fails C if Cn or C const a k
p
p
p
n n n n
sin cos cos sin
) int (
; , ;
; , ; , ; ) (
2 1
1 0
1 0
2
+
+ +
+

Example
Obtain the general solution of
4 6
1 2

+ + n n n
u u u
Solution
From the example solved earlier, the complementary solution is
AMA126 - 66 -
B A v
n n
n
) 2 ( 3 +
For the particular solution, we try q
n
=C (see the table above). Then
3
2
0 4 6 4 6 4 6
1 2

+ +
C C C C C q q q
n n n

Hence q
n
=-2/3, and the general solution is
3
2
) 2 ( 3 + B A u
n n
n
Example
Obtain the general solution of
4 3 2
1 2
+
+ + n n n
u u u
Solution
From a previous example, we know that the complementary solution is
B A v
n
n
+ ) 3 (
In this case we expect a particular solution of the form q
n
=C. However, if we introduce this
form into the general solution, we would obtain that the left-hand side of the equation is
identical zero. That means that this choice of the particular solution fails, so we are
choosing q
n
=Cn. Then
1 0 4 4 4 3 ) 1 ( 2 ) 2 ( 4 3 2
1 2
+ + + +
+ +
C C C n C n C q q q
n n n
Hence the general solution is
n B A u
n
n
+ + ) 3 (
Numerical methods for solving ordinary differential equations.
Most ordinary differential equations arising in real-world applications cannot be solved
exactly. These equations can be analyzed qualitatively. However, qualitative analysis
cannot give accurate answers. A numerical method can be used to get an accurate
approximate solution to a differential equation.
1. Eulers method
AMA126 - 67 -
We will focus on this method as the simplest numerical method used for solving ordinary
differential equations. In order to emphasize the importance of numerical methods, let us
take first an example: solve the equation y=2x with y(0)=0.
It is obvious that this simple equation has as solution y=x
2
, i.e. a formulaic solution. On the
other hand, say we were to use a numerical technique. The resulting numerical solution
would be a table of values. To have a better idea of these two solutions, let us compare
them side by side, along with the graphs
Notice that the graph derived from the formulaic solution is smoothly continuous,
consisting of infinite number of points on the interval shown. On the other hand, the graph
based on the numerical solution consists of just a few points as the numerical method
apparently only found the value of the solution for x-increments of size 0.2.
The first question you could ask is then what good is the numerical solution if it leaves
out so much of the real answer?. Well, we can answer to this question in several ways:
1. The numerical solution still looks like it is capturing the general trend of the real
solution => if we are looking for a qualitative view of the solution, we can still get it from
the numerical solution.
2. The numerical solution can be even improved by playing join-the-dots with the set of
points it produces.
3. Using a numerical approach, we can find the value of the solution at a specific point.
4. If a formulaic expression for solution is not possible, here the numerical solutions are the
only possibility to find solutions (errors)
In what follows we will concentrate mainly on first order equations only. In order to
develop a technique for solving first order differential equations when the initial values are
given (or initial value problems). We assume that the studied equation has the form y
=f(x,y) with y(x
0
)=y
0
. Our goal is to find a numerical solution, i.e. we must find a set of
points which lie along the initial value problems solution. This means that we actually
know one point of the solution, i.e. (x
0
,y
0
)-initial value.
AMA126 - 68 -
Now, remember we do not know the true solution of the problem, but let us act as if we do
know this elusive solution for a moment. Let us pretend that its ghostly graph could be
superimposed onto our previous picture to get this
Since we are after a set of points which lie along the true solutions, we must now derive a
method of generating more solutions in addition to the initial condition. Let use the other
part of the problem, namely the form of the differential equation itself.
Remember that one interpretation of the quantity y appearing in this expression is as the
slope of the tangent line to the function y. But the function y is exactly what we are looking
for as solution of the problem, i.e.
slope of the function=f(x,y)
Now we have to think how can we use this slope to find subsequent points on the graph.
Actually, we can obtain the slope by substituting values for x and y into the function f.
These values, of course, must be the coordinates of a point lying on the solutions graph
they cannot just be the coordinates of any point anywhere in the plane. Therefore we use
the initial value as starting point, i.e. we can find the slope of the graph at the initial value
slope of the solution at (x
0
,y
0
)=f(x
0
,y
0
)
Remembering that this gives us the slope of the functions tangent line at the initial point
we could put this together with the initial point itself to build the tangent line at the initial
point
AMA126 - 69 -
Looking at the two graphs, we can observe that close to the initial value the two curves are
every close to each other. Let us say we move a short distance away, to a new x-coordinate
of x
1
. Then we could locate the corresponding point lying on our tangent line. It might look
like this
Notice that our new point, called (x
1
,y
1
), is not too far away from the true value of the
solution at this x-coordinate, up on the curve. So we now have two points as part of our
numerical solution
a. (x
0
,y
0
): an exact value, known to lie on the solution curve
b. (x
1
,y
1
): an approximate value, known to lie on the solution curves tangent line through
(x
0
,y
0
).
We must now attempt to continue our quest for points on the solution curve. Next we will
repeat our last step, constructing a tangent line at our new point
There is a problem here: since our new point did not actually lie on the true solution, we
cannot actually produce a tangent line to the solution at this point. But we can still
substitute our new point (x
1
,y
1
), into the formula
AMA126 - 70 -
slope of the function=f(x,y)
to get the slope of a pseudo-tangent line to the curve at (x
1
,y
1
). We hope that our
approximate point, is close enough to the real solution that the pseudo-tangent line is pretty
close to the unknown real tangent line. We now attempt to use this new pseudo-tangent line
to get another point in the approximate solution. As before, we move a short distance away
from our last point, to a new x-coordinate of x
2
. Then we locate the corresponding point
lying on our pseudo-tangent line. The result might look something like this
We now have three points in our approximate solution:
a. (x
0
,y
0
): an exact value, known to lie on the solution curve
b. (x
1
,y
1
): an approximate value, known to lie on the solution curves tangent line through
(x
0
,y
0
)
c. (x
2
,y
2
): an approximate value, known to lie on the solution curves pseudo-tangent line
through (x
1
,y
1
).
This method can be repeated making new points for as long as we like.
Now let us see what the theoretical background of the Eulers method is. We are solving
the initial value problem
0 0
) ( ), , ( y x y y x f y
As said before, the basic idea is to use a known point as a starter, and then use the tangent
line through this known point to jump to a new point. Let us use the names
(x
n
,y
n
) for the known point
(x
n+1
,y
n+1
) for the new point
Our picture, based on the previous experience, should look like something like this
AMA126 - 71 -
Our task is to find formulas for the coordinates of the new point, x
n+1
. Clearly, it lies on the
tangent line, and this tangent line has a known slope, namely f(x
n
,y
n
). Let us mark the sizes
of the jumps in the x and y direction as we move from the known point to the new point.
From the formula relating x
n
and x
n+1
is obvious that h x x
n n
+
+1
Also we know from basic algebra that slope=rise/run, so applying this idea to the triangle
in our picture, the formula becomes
( )
h
y
y x f
n n

,
which can be rearranged to solve for y giving
( )
n n
y x hf y ,
But, we are really after a formula for y
n+1
. Looking at the picture, it is obvious that
y
n+1
=y
n
+y. Replacing y by our new formula, this becomes
( )
n n n n
y x hf y y ,
1
+
+
.
Example
Solve the initial value problem
0 ) 0 ( 2 + y y x y

numerically, finding a value for the solution at x=1, and using steps of size h=0.25.
Solution
We apply the theoretical formulas found before. The interval we want to find intermediate
points is [0,1]. In our case f(x,y)=x+2y and the starting point is x
0
=0, y
0
=0. We generate
values for x
1
, y
1
.
The x-iteration formula, with n=0 gives
25 . 0 25 . 0 0
0 1
+ + h x x
The y-iteration formula, with n=0 gives
AMA126 - 72 -
( ) 0 ) 0 * 2 0 ( 25 . 0 0 ) 2 ( ,
0 0 0 0 0 0 1
+ + + + + y x h y y x hf y y
So the second point in our numerical solution is x
1
=0.25, y
1
=0.
We move on to get the next point in the solution, (x
2
,y
2
), n=1.
5 . 0 25 . 0 25 . 0
1 2
+ + h x x
( ) 0625 . 0 ) 0 * 2 25 . 0 ( 25 . 0 0 ) 2 ( ,
1 1 1 1 1 1 2
+ + + + + y x h y y x hf y y
So the third point is x
2
=0.5, y
2
=0.0625.
The x-iteration and y-iteration, with n=2 gives
75 . 0 25 . 0 5 . 0
2 3
+ + h x x
( )
21875 . 0 ) 0625 . 0 * 2 5 . 0 ( 25 . 0 0625 . 0
) 2 ( ,
2 2 2 2 2 2 3
+ +
+ + + y x h y y x hf y y
So the fourth point is x
3
=0.75, y
3
=0.21875
Carrying on with the same method we obtain that the fifth point is x
4
=1, y
4
=0.515625.
We could summarise the results of all our calculations in a tabular form, as follows
515625 . 0 00 . 1 4
218750 . 0 75 . 0 3
062500 . 0 50 . 0 2
000000 . 0 25 . 0 1
000000 . 0 00 . 0 0
n n
y x n
A question you should always ask yourself at this point using a numerical method to solve
a problem is How accurate is my solution? Sadly, the answer is Not very!. The true
solution of the given initial value problem turns out to be
25 . 0 5 . 0 25 . 0
2
x e y
x
If we use this formula to generate a table similar to the one above, we can see just how
poorly our numerical solution did
AMA126 - 73 -
097264 . 1 00 . 1
495422 . 0 75 . 0
179570 . 0 50 . 0
037180 . 0 25 . 0
000000 . 0 00 . 0
y x
We can get an even better feel for the inaccuracy we have incurred if we compare the
graphs of the numerical and true solutions, as shown here
The numerical solution gets worse and worse as we move further to the right. We might
even be prompted to ask the question What good is a solution that is bad? The answer is
Very little good at all!. So should we quit using this method? No! The reason our
numerical solution is so inaccurate is because our step-size is so large. To improve the
solution, we have to shrink the step-size. For h=0.02 we would get a much better
agreement (see the graph).
As you can see, the accuracy of this numerical solution is much higher than before, but so
is the amount of work needed.
DIFFERENTIAL EQUATIONS AND MAPLE
Maples diversity makes it particularly well suited to performing many calculations
encountered when solving many ordinary and partial differential equations. In many cases,
Maples built-in functions can immediately solve a differential equation by providing an
explicit, implicit, or numerical solution. The advantages of using Maple in the study of
differential equations are numerous, but perhaps the most useful is that of being able to
produce the graphics associated with solutions of differential equations.
In what follows you will see how we can solve various types of differential equations using
Maple. By now you already have a vast knowledge of Maple (SOM104), so we can start
directly with applications without introducing basic concepts about Maple.
Generally, the command
dsolve -Solves ordinary differential equations (ODEs)
AMA126 - 74 -
Calling sequences:
dsolve(ODE, y(x), extra_args)
dsolve({ODE, ICs}, y(x), extra_args)
dsolve({sysODE,ICs},{funcs}. extra_args)
Parameters
ODE -an ordinary differential equation
y(x) - any indeterminate function of one variable
ICs - initial conditions
{sysODE} - a set with a system of ODEs
{funcs} - a set with indeterminate functions

attempts to solve the given differential equation for the specified function of one variable.
Example
Verify that the differential equation y=-ycosx has infinitely many solutions
Solution
We use dsolve to solve the first-order linear equation and name the result sol. We interpret
the result to mean that if C is any number, a solution to the equation is y=Ce
-sinx
. Thus, the
equation has infinitely many solutions
>sol:=dsolve(diff(y(x),x)=-y(x)*cos(x),y(x));
sol:=y(x)=_C1e
(-sin(x))
We can plot several solutions using the plot command
>pict:={seq(subs(_C1=I,rhs(sol)), i=-5..5)}:
plot(pict,x=0..4*Pi);
AMA126 - 75 -
In many applications we are given not only the differential equation to solve but also one or
more conditions that must be satisfied by the solution(s) as well. In the calling sequence of
dsolve, ICs means initial conditions.
The following commands illustrate how to plot some members of the family of solutions by
substituting various values of C into the general solution. We also plot the solution to the
problem

'


4 ) 1 (
4 3
2
y
x x
dx
dy
First we use seq to generate a table of functions x
3
-2x
2
+C for C=-10, -8,,8, 10, naming
the resulting set of function toplot. The set of functions toplot is not displayed (for length
reasons) because a colon (:) is included at the of the command
> cvals:=seq(2*I,i=-5..5):
toplot:={seq(x^3-2*x^2+c,c=cvals)}:
plot(toplot,x=-2..3,view=[-2..3,-15..15])
AMA126 - 76 -
Example (The Logistic Equation) The logistic equation is
), ( )) ( ( ) ( t y t ay r t y
where r and a are constants, subject to the condition y(0)=y
0
. This equation can be also
written as y=ry-ay
2
, where the term y
2
represents an inhibitive factor. Under the
AMA126 - 77 -
assumptions made, the population is allowed neither to grow out of control not to grow or
decay constantly. The logistic equation is separable and, thus, can be solved by separation
of variables:
1
1
ln ln ln
1
1
) (

,
_

+ +

,
_

,
_

a e
K
r y Ke e
ay r
y
c rt
ay r
y
c rt y ay r
rdt dy
y ay r
a
dt dy
y
r
ay r
r
a
dt
y ay r
dy
rt rt c rt

Applying the initial condition y(0)=y0 and solving for K, we find
K
ay r
y

0
0
After substituting this value into the general solution and simplifying, the solution can be
written as
rt
e ay r ay
ry
y

+

) (
0 0
0
We are also able to use dsolve to solve this initial-value problem. First, we use dsolve to
solve the initial-value problem, naming the resulting output Sol.
> y:=y:
Sol:=dsolve({diff(y(t),t)=(r-a*y(t))*y(t), y(0)=y0},y(t));
0
) 0 (
) ( :
) (
y
a y r e
a
r
t y Sol
rt
+

Then we use assign to name y(t) the result obtained in Sol and simplify to simplify y(t)
> assign(Sol): simplify(y(t));
a y e r e r y
r y
rt rt
0 0
0
) ( ) (
+

Potrebbero piacerti anche