Vous êtes sur la page 1sur 27

UECM1653 Mathematics for Engineering I

UECM1683 Mathematics for Physics I

Jan 2015

Topic 3: Ordinary Differential Equation


3.1 Ordinary differential equations
An ordinary differential equation (ODE) is an equation involving an unknown function, y
with independent variable x say, ands its derivatives.
For example:

y ( x) 2 xy ( x)

-- (1)

And
d2y
dy
-- (2)
2 3 y 4 sin 2 x 7 cos 2 x
2
dx
dx
are ordinary differential equations. The solution of an ODE is a function that satisfies the
equation at every point of its domain. For example, y( x) exp( x 2 ) is a solution of (1), while
y( x) exp( x) cos 2 x is a solution of (2).
Other notations for OED are possible, such as an ODE for x as a function of t:
d 2x
dx
-- (3)
3 2 5 7x 0
dt
dt
dx
d 2x
Often derivatives with respect to t are denoted by dots, eg x
, x 2 , etc , so that (3)
dt
dt
may be also be written as
3x 5x 7 x 0

Hence, the following ODE are equivalent:


4 y 3 y y 0
4

d 2x
dx
3 x 0
2
dt
dt
4x 3x x 0

ODEs arise quite naturally in a wide variety of physical situations, as described below.
Example:
Newtons law of cooling
It states that the rate of decrease of the temperature of a body is proportional to the difference
between the temperature T of the body and the temperature T0 of the surrounding air, i.e.
dT
T T0
dt
Or equivalently,
dT
k (T T0 )
dt
for some constant k.

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Motion of a mass on a spring in a resistive medium

x=0

x = X (t)

Let X(t) denote the displacement of the mass at time t. The resistive force is given by
dX
-- (4)
k1 (speed) k1
dt
and the spring restoring force by
-- (5)
k 2 (extension ) k 2 ( X l )
where k1 and k2 are constants and l is the natural length of the spring. By Newton's Second
Law, the total force F acting on the body must equal the acceleration a of the body times its
mass m, i.e. F = ma. Hence
dX
d2X
-- (6)
k1
k2 ( X l) m 2
dt
dt
d2X
dX
-- (7)
m 2 k1
k 2 X k 2l
dt
dt
Which is an ODE for the displacement X(t)

3.2 Classification of ODEs


ODEs may be separated into different categories, according to their general characteristics.
Independent and dependent variables
In equations (1) and (2) y is called the dependent variable and x is the independent variable.
In equation (3) x is called the dependent variable and t is the independent variable.

Order
The order of an ODE is the highest derivative occurring in the equation.
For example,
d2y
dy
6 10 y 0
2
dx
dx
Is second-order
dy
3 4y3x 0
dx
Is first order

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Degree
The degree of an ODE is the power to which the highest-order derivative is raised, after the
equation has been rationalised to contain only integer powers of derivatives. Hence
2

d4y
dy
4 x y 0
dx
dx
7

Is fourth-order and second degree


7

d 2 y dy 4
y 0
dx 2 dx
Is second order and degree 4, since in order to remove fractional powers, we rearrange as
follows
7

d y
dy 4
y 2
dx
dx
2

d2y
dy
y 2
dx
dx

Hence the highest derivative is raised to the power of 4.

Linearity
An ODE is linear, if
(a)
the y-dependent terms are y itself and derivatives of y and
(b)
these terms do not appear multiplied together. ODEs containing products of y
dependent terms, or functions of y, are said to be nonlinear.
3

d2y
dy
5 4 y e x
2
dx
dx

Is second order and nonlinear, whilst


d2y
dy
10 6 y 0
2
dx
dx
Is second order and linear
dy
dy
y x3 0
ey 0
dx
dx
Are first order and nonlinear, whilst
dy
4x 3 y e 4x
dx

Is first order and linear.


Notice that the coefficients in the ODE might depend upon the independent variable (x in this
case).

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

3.3 Homogeneous and inhomogeneous ODEs


Suppose we are given a linear differential equation. Let us assume that terms containing the
dependent variable are on the left-hand side of the equality sign and terms involving the
independent variable and constants on the right-hand side.
Then homogeneous equations have the right-hand side zero and inhomogeneous equations
have the right-hand side non-zero.
For example,
d2y
dy
x y0
2
dx
dx
Is a homogeneous, linear second order ODE and
d2y
dy
x2
y cos x
2
dx
dx

is an inhomogeneous, linear, second-order ODE.

3.4 Solving ODEs


The general solution of an ODE is the most general function y that satisfies the equation; it
will contain constants of integration that may be determined by the application of suitable
initial or boundary conditions. The general solution of an nth-order ODE will contain n
arbitrary constants of integration and we therefore need n initial conditions in order to
determine these constants. When the initial conditions have been applied and the constants
determined then we are left with a particular solution to the ODE which obeys the given
initial conditions. When a possible solution to the ODE has been found it is always possible
to check its validity by substituting it into the original ODE and checking that it satisfies the
initial conditions.

The ODE may possess an analytical solution where the dependent variable can be expressed
as a function of the independent variable. For example,
dy
4 x
dx
has an analytical solution
y( x) 2 x 2 c
where c is a constant of integration. Here the dependent variable y has been expressed as a
function of the independent variable x.

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Alternatively, it might be possible to use graphical methods. For example, suppose we


consider
dy
1
x
dx
2

dy
at any point in the xy plane, as follows. Suppose we consider a grid of
dx
dy
points in the xy plane. At each point, draw a short line segment with gradient
. This is the
dx
direction field which consists of line-segments that are tangent to the solution curves. Thus
the solution curves may be inferred
We can compute

Direction fields of the ODEs y x / 2 with solution curve

3.5 First order ODEs


These are usually written in the form
dy
f ( x, y )
dx

Where f is a given function. Sometimes they are written in the equivalent form
y ( x) f ( x, y)

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Separable first order ODEs


In this case, the function f separates into the product of a function of x and a function of y.
Then we can write
f ( x, y) g ( x)h( y)
So that the equation becomes

dy
f ( x, y) g ( x)h( y)
dx
We can then rearrange this into the form
1 dy
g ( x)
h( y ) dx
Integrating with respect to x we get
1
h( y) dy g ( x) dx + c
remember to include the arbitrary constant of integration c
Example:
Solve the equation
dy
ky
dx

We have
1 dy
k
y dx
1
y dy k dx c
ln | y | kx c
| y | e kx c e c e kx

Hence,
y e c e kx Ae kx

Where A e c is an arbitrary constant.

Example:
Solve the differential equation
dy
x

dx
y

Solution:

ydy xdx C
y2
x2

C
2
2
y2 x2 A
6

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Solve the differential equation
dy
y1/ 2 x
dx

Solution:
1

1/ 2

dy xdx C

y 2 dy

x2
C
2

1
2

y
x2

C
1/ 2 2
x2
2 y
C
2

Example:
Solve the differential equation

(1 x 2 )

dy
2 xe y
dx

Solution:
2x
dx C
(1 x 2 )
2x
y
e dy (1 x 2 ) dx C
1

dy

e y ln | 1 x 2 | C

Example:
Solve the differential equation
dy
2x y

e
dx 1 y

Solution:
dy
2x y

e
dx 1 y
1 y
e y dy 2 xdx C

(1 y)e

dy x 2 C

e y (1 y ) e y x 2 C

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Linear first order ODEs


Recalling our definition of a linear differential equation, we see that for
dy
f ( x, y )
dx
To be linear we must have
f ( x, y) p( x) y q( x)
for given functions p and q. Then the equation becomes
dy
p ( x) y q ( x)
dx

-- (8)

No `y'-terms are multiplied together and there are no functions of y. If a linear first-order
equation is written as in (8) it is said to be in standard form. Notice that if q(x) = 0 the
equation is also separable. For then
dy
dy
p( x) y 0

p ( x) y
dx
dx
Hence,
1

y dy p( x) dx c
Where c is a constant of integration, so that
ln | y | p( x) dx c
Taking exponentials,
y Ae p ( x ) dx

Where A e c is an arbitrary constant.


Integrating factors
p ( x ) dx dy
p ( x ) dx d
d p ( x ) dx p ( x ) dx dy
d p ( x ) dx

y e
e
ye
p( x)dx
ye
e
dx
dx
dx
dx

dx

And also

p ( x ) dx

dy
p ( x) y )
dx

p ( x ) dx
d
( ye
)
dx

and integrating the RHS then just gives ye

p ( x ) dx

-- (9)

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Theory
Hence, to solve the linear ODE in standard form
dy
p ( x) y q ( x)
dx
p ( x ) dx
We multiply by the integrating factors e
e

p ( x ) dx

p ( x ) dx
dy

q(x)
p ( x) y e
dx

From (9), we then have


d p ( x ) dx
p ( x ) dx
ye
q ( x )e
dx

Now integrate both sides with respect to x:

ye

p ( x ) dx

q( x)e

p ( x ) dx

Final result:
p ( x ) dx
p ( x ) dx dx ce p ( x ) dx
ye
q( x)e

If, q(x) = 0, then we get the same result as before.

Example:
dy
Solve x 2 y 3x 3
dx

Solution:
dy
p ( x) y q ( x)
dx

dy 2
y 3x 2
dx x
2

Integrating factor

x dx

e 2 ln x x 2

d
yx 2 3 x 2 x 2 3 x 4
dx
d
2
4
dx yx 3x dx
3
yx 2 x 5 C
5

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example: (Bernoulli differential equation)


dx
Solve t 2 x t 3
x 4 cos(t )
dt
Solution:
dx 1
x 4 cos(t )
x
dt t
t3

dy
P( x) y Q( x) y a
dt

Let y(t ) x(t )1a x(t ) 3

dx
x 4 dy
dy
4 dx
and
3x

dt
dt
dt
3 dt
4
x dy 1
cos t
dy 3 3 3 cos t

x 3 x4
x 3
3 dt t
dt t
t
t
dy 3
3 cos t
y 3
dt t
t

Therefore,
Then

The integrating factor

t dt

e 3 ln t t 3

d
3 cos t
yt 3 t 3 3 3 cos t
dt
t
d
3
dt yt 3 cos tdt C
yt 3 3 sin t C

But y(t ) x(t )1a x(t ) 3 or y

1
x3

yt 3 3 sin t C

So

1 3
t 3 sin t C
x3

t3

x
3 sin t C

1/ 3

10

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Solve y

2
y x2 y 2 .
x

Solution:
2 1
y x2
x
1
Let w
y
y
w 2
y
2
w w x 2
x
solve this differential equation by First order linear equation
yy 2

Integrating factor is e

x dx

e 2ln x x 2

x 2 w w x 2 x 2
x

d 2
4
dx x w dx x dx C
x5
2
x w C
5
2
5
x
x
C
y
5

5x2
x5 A

11

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Solve y

4
y x3 y 2 .
x

Solution:
4
y y 2 y 1 x 3
x
1
Let w
y
y
w 2
y
4
w w x 3
x
solve this differential equation by First order linear equation

Integrating factor is e

x dx

1
4 1
w w 4 x 3
4
x x
x
d 1

dx x

e 4 ln x

1
x4

w dx dx C
x

1
w C ln | x |
x4
1
x 4 C ln | x |
y
1
y 4
x C ln | x |

12

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
dy 1
Solve y e x y 4 .
dx 3
Solution:
1 dy 1 3
y ex
4
y dx 3
1
Let w 3
y
3
w 4 y
y
1
1
w w e x
3
3
w w 3e x

solve this differential equation by First order linear equation


1dx
Integrating factor is e e x
e x w w e x 3e x

d x
e w 3
dx
d x
dx e w dx 3dx C
e x w 3x C

ex

1
3 x C
y3

1
e x (C 3 x)
3
y

13

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Solve x

dy
y xy 3 .
dx

Solution:
dy y
y3
dx x
1 dy 1 1

1
y 3 dx y 2 x
1
Let w 2
y
2
w 3 y
y
1
1
w w 1
2
x
2
w w 2
x

solve this differential equation by First order linear equation

Integrating factor is e

x dx

1
x2

1
2 1
w w 2 2
2
x x
x
d 1 2
w
dx x 2 x 2
1
2
w 2 dx C
2
x
x
1
2
w C
x
x2
w 2 x Cx 2
1
2 x Cx 2
2
y
1
y2
2 x Cx 2

14

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
dy
Solve
Ay By 2 , where A and B is constant.
dx

Solution:
y Ay By 2
a = 2, therefore let u y1a y12
1
y
y2

y 2u y

and

then

y Ay By 2

so u B Au

1
y

y 2u Ay By 2

u Au B

so the general solution is u Ce At

B
A
y

1
Ce At

Exercise:
dy
Solve
2y ex
dx
Solution:
dy
2y ex
dx
Integrating factor

u B Ay 1

dy
p ( x) y q ( x)
dx

e
e 2 x
d
ye 2 x e x e 2 x e x
dx
d
2 x
x
dx ye e dx
ye 2 x e x C
2 dx

y e x Ce 2 x

15

B
A

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Euler homogeneous equation


Some functions have the property that, for any
f (x, y) n f ( x, y)

Such functions are called homogeneous of degree n. For example,


i.
ii.

f (x, y) y x ( y x) f ( x, y)

f ( x, y) y x

g ( x, y) y x
2

g ( x, y) 2 y 2 2 x 2 2 ( y 2 x 2 ) 2 g ( x, y)

In the above, f is homogeneous of degree one, g is homogeneous of degree two.

A homogeneous differential equation is one that may be written in the form


dy A( x, y )

dx B( x, y )
Where A(x,y) and B(x,y) are homogeneous functions of the same degree. The RHS of a
homogeneous ODE can be written as a function of y/x, because
dy A( x, y) A(1, y / x)

F ( y / x)
dx B( x, y) B(1, y / x)

The homogeneous equation, rewritten in the form


dy
y
F
dx
x
May then be solved by making the substitution y = v x so that,
dy
dv
dv
or
vx
F v
x
F v v
dx
dx
dx
This equation is now separable and can be solved as follows
dv
dx
F (v ) v x

-- (11)

Hence, the solution method is first to check whether the equation is homogeneous. If so,
make the substitution y = vx, then separate variables as in (11) and solve directly. Finally
replace v by y/x to obtain the solution.

16

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Solve

dy y x

dx y x

Homogeneous equation with degree one,


f ( x, y) y x f (x, y) f ( x, y)
g ( x, y) y x g (x, y) g ( x, y)
Since f and g is homogeneous degree one, so substitute y = vx

Let

dy
dv
vx
dx
dx
Then we have

dy y x

dx y x

dv v 1
1 v2

v
dx v 1
v 1

This equation is separable and we get


v 1
1
1 v 2 dv x dx
1
ln | 1 v 2 | tan 1 (v) ln | x | C
2
1
y
ln | x 2 y 2 | tan 1 ( ) C
2
x

Example:
Solve
dy y
y
tan
dx x
x

This equation is homogeneous of degree zero, let y = vx to get


vx

dv
v tan v
dx

Hence,
1

cot v dv x dx C
ln | sin v | ln | x | C
y x sin 1 Ax

17

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

3.6 Initial conditions


We have seen that the general solution of a first-order ODE involves one unknown constant.
Generally, the number of unknown constants in the general solution equals the order of the
ODE. To determine a particular solution, we must find these constants. We therefore need as
many conditions on the solution as there are unknown constants. These conditions usually
involve the value of the unknown function and/or some of its derivatives at certain points. For
a first-order equation we only need one such condition, called initial condition. The
terminology stems from the fact that one may think of the independent variable in the ODE as
representing time t. Specifying the value of the solution at a given time, for example at t = 0,
then amounts to fixing the initial value of the dependent variable.

Example:
Solve
dy
x

yx
dx 1 x 2

With initial condition y (1) = 0


Solution:

p ( x ) dx
Integrating factor e
1 x2

1/ 2

d
y 1 x2 x 1 x2
dx
d
2
2
dx y 1 x x 1 x dx
3/ 2
1
y 1 x2 1 x2
C
3
1
C
y 1 x2
3
1 x2

Given y = 0 when x = 1

y(1) 0

1
C
1 12
0

3
1 12
C

2 2
3

1
2 2
1
1 x2
3
3 1 x2

18

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Suppose that a variable current I(t), where t is time in seconds, flows through a coil with
inductance L and a resistor of resistance R with an applied voltage V , where we assume that
L, R and V are constants. Suppose also that the current is zero at time t = 0. Then the current
satisfies the ODE
dI
L RI V
dt
Subject to the initial condition
I(0) = 0

Solution:
R

The general solution is I (t )

t
V
ce L
R

and given I(0) = 0, so we get C =

V
R

Therefore the particular solution is


t
V
I (t ) 1 e L
R

Exercise:
The rate of increase of the concentration of a chemical is proportional to the concentration at
that time. Experiment shows that the concentration doubles in four hours. If the initial
concentration is c0, what is the concentration after six hours?

19

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

3.7 Second order ODEs


Homogeneous
We start by considering second-order ODEs of the general form
d2y
dy
a 2 b cy 0
dx
dx
where a, b and c are given constants.
These are called constant coefficient, homogeneous, linear second-order ODEs. Recall that
homogeneous here refers to the right-hand side being zero; we will also consider the case
when there is a non-zero function there, i.e. inhomogeneous equations. Other notation is
possible; for example, the ODE might be in terms of x(t) and its derivatives with respect to t.
Suppose we start by considering the case where a = 0: Then
dy
b cy 0
dx
and we know how to solve this (by separating the variables). The solution is

y Ae

c
x
b

Alternatively, if we try y = Aemx as a solution

dy
cy 0
dx

bmAemx cAemx 0

Aemx (bm c) 0

Hence,
m

c
b

And we have got the same answer as before.


Suppose we adopt the same approach for the second-order equation:
d2y
dy
If y = Aemx then
mAe mx and
m 2 Ae mx
dx
dx 2
Substituting into the ODEs, we get
am 2 Ae mx bmAe mx cAe mx 0

Ae mx (am 2 bm c) 0
Ae mx 0

am 2 bm c 0

-- (12)

So m satisfies a quadratic equation called the auxiliary equation.


It turns out that if the auxiliary equation has two distinct roots, say m1 and m2, then the
general solution is

y Ae m1x Be m2 x
Where A and B are arbitrary constants.

20

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
We start with an example. Suppose we wish to solve
d2y
2 y
2
dx
We first check that y sin x is a solution:
y cos x ,

y 2 sin x 2 y

Next, we check that y cos x is a solution:


y sin x ,

y 2 cos x 2 y

We can show that y 2 cos x is a solution:


y 2 sin x ,

y 2 2 cos x 2 y

More generally, it is possible to show that the general solution is


y( x) Asin x B cos x

Where A and B are constants.

Example:
Solve

d 2 y dy

2y 0
dx 2 dx
Solution:
Try

y Ae mx then we have Ae mx (m 2 m 2) 0

Solve the equation

m = 2 , m = -1

The general solution for y is then

y Ae x Be 2 x

21

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example
Solve
d2y
dy
4 3y 0
2
dx
dx

Solution:
Try

y Ae mx then we have Ae mx (m 2 4m 3) 0

Solve the equation

m=3 ,m=1

The general solution for y is then

y Ae x Be 3 x
Since as we've seen in (12) m1 and m2 are the roots of a quadratic equation with real
coefficients, three different cases are possible:
- m1 and m2 are real and distinct (as in the previous two examples)
- m1 and m2 are real and repeated (i.e. m1 = m2)
- m1 and m2 are complex conjugates
We now consider the second and third cases, the first having already been dealt with.
Real and repeated roots
If m1 = m2, the general solution appears to be
y Ae m1x Be m1x e m1x ( A B) Ce m1x
The solution now only contains one constant of integration, but we know that it should
contain two. In this case, the solution is
y ( A Bx )em1 x
Where A and B are arbitrary.

Example:
Solve

Try

y 6 y 9 y 0

y Ae mx then we have Ae mx (m 2 6m 9) 0

Solve the equation

The general solution for y is then

m = 3 , m = 3 (repeat)

y A Bx e 3 x

22

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Complex conjugate roots


Suppose the roots are

Jan 2015

m2 i

m1 i

The general solution for y is now


y Ae ( i ) x Be ( i ) x
Aex eix Bex eix

ex Ae ix Be ix

ex C cos x D sin x
Where C and D are arbitrary constants (they are, in fact, combinations of A and B)
This is the general solution in this case.

Example:
Solve

y 4 y 0

Solution:
Try

y Ae mx then we have Ae mx (m 2 4) 0

Solve the equation

m = 2i , m = -2i (repeat)

0 and
The general solution for y is then

y C cos 2 x D sin 2 x

3.8 Inhomogeneous second order ODEs


Here we consider second-order ODEs of the general form
d2y
dy
a 2 b cy f ( x)
dx
dx
The general solution consists of the complementary function + the particular integral.
The complementary function is the solution of the homogeneous equation
a

d2y
dy
b cy 0
2
dx
dx

23

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

And can be found using the methods of previous section. Here we will discuss how to find
the particular integral. There is no general rule for finding the particular integral. In certain
cases it is possible to find a particular integral by first guessing the general form of the
particular integral in terms of a function containing a number of as yet undetermined
constants, and then adjusting the constants so as to turn the function into a solution. This
technique is known as the method of trial functions and we will illustrate it by a number of
examples.

Example:
Find the general solution of
d 2 y dy
2y x
dx 2 dx

Solution:
The complementary function is the solution of
d 2 y dy
2y 0
dx 2 dx

Which we know from above is

y Ae x Be 2 x
To find the particular solution, we consider the trial function
y Cx D

Then direct substitute into the differential equation and get


C 2(Cx D) x

Equating the coefficients of the various power of x on the left and right sides give
C 2D 0

2C 1

Which we have

1
2

and

1
4

So that the particular integral is


1
1
y ( x) x
2
4

Thus, the general solution is


y ( x) y c y p

y(x) Ae x Be 2 x

24

1
1
x
2
4

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Find the general solution of
d2y
dy
5 9 y 44 x
2
dx
dx

Solution:
The complementary function is the solution of
d2y
dy
5 9 y 44 x
2
dx
dx

Which we know from above is


yc Ae

12 5 61 x

Be

12 5 61 x

To find the particular solution, we consider the trial function


y Ce 4 x

Then direct substitute into the differential equation and get


16Ce 4 x 20Ce 4 x 9Ce 4 x e 4 x

Equating the coefficients of the various power of x on the left and right sides give
C

1
27

So that the particular integral is


1 4x
e
27

y p ( x)

Thus, the general solution is


y ( x) y c y p
y(x) Ae

12 5 61 x

25

Be

12 5 61 x

1 4x
e
27

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

Example:
Find the general solution of
d2y
dy
5 9 y cos 2 x
2
dx
dx

Solution:
The complementary function is the solution of
d2y
dy
5 9 y cos 2 x
2
dx
dx

Which we know from above is


yc Ae

12 5 61 x

Be

12 5 61 x

To find the particular solution, we consider the trial function


y C cos 2 x D sin 2 x

Then direct substitute into the differential equation and get


4C cos 2 x 4D sin 2 x 5(2C sin 2 x 2D cos 2 x) 9(C cos 2 x D sin 2 x) cos 2 x

Equating the coefficients of the various power of x on the left and right sides give
C

13
269

and D

10
269

So that the particular integral is

1
10 sin 2 x 13 cos 2 x
269

y p ( x)
Thus, the general solution is

y ( x) y c y p

y(x) Ae

12 5 61 x

Be

12 5 61 x

1
10 sin 2 x 13 cos 2 x
269

In summary, trial function for particular integrals of equations of the form


d2y
dy
a 2 b cy f ( x)
dx
dx
Are as follows
If f (x) is a polynomial in x of degree p, the trial function should be a polynomial in x of
degree p.
e.g. if f (x) = 6x2 + 4x + 3 try
Cx2 + Dx + E.

26

UECM1653 Mathematics for Engineering I


UECM1683 Mathematics for Physics I

Jan 2015

If f (x) is an exponential function of x, the trial function should be an exponential function of


x.
e.g. if f (x) = 6e5x
try
Ce5x

If f (x) consists of the sine or cosine of a multiple of x, the trial function should be a linear
combination of sine and cosine of the same multiple of x.
e.g. if f (x) = cos 5x try
Csin 5x + Dcos 5x.
(In all the above, C, D an E are arbitrary constants)

3.9 Initial conditions second order ODEs


We have seen that the general solution for a second-order ODE contains two unknown
constants. To determine these constants we need two initial conditions. Note the initial
conditions must only be applied once the general solution (complementary function plus
particular integral) has been determined.
Example:
Solve
d 2 y dy
2y x
dx 2 dx

Subject to the initial condition y(0) = 0 and y(0) 0


Solution:
The general solution is
1
1
y Ae x Be 2 x x
2
4

To determine A and B, we now apply the initial conditions

1
0
4
1
y (0) A 2 B 0
2
1
A
3
1
B
12
y (0) A B

Therefore we get

1
1
1
1
y ex e2 x x
3
12
2
4

27