Chapter 3. ODE
Chapter 3. ODE
INTRODUCTION
A differential equation (d.e.) is an equation involving an unknown
function and its derivative.
dy
is the derivative of the unknown function.
dx
dy
(a) = 2x2 - 4
dx
dx x+1
(b) =
dt t
y dy dy 3
(c) e + 2( ) = 1
dx dx
d2y 3 dy 6
(d) ( 2 ) + 3( ) + y 2 = 5 x
dx dx
Example 3
Refer to the d.e. in Example 2, find the order and degree of the d.e.
dy
(a) = 2x2 - 4 Order = 1, degree = 1
dx
dx x+1
(b) = Order = 1, degree = 1
dt t
y dy dy 3
(c) e + 2( ) = 1 Order = 1, degree = 3
dx dx
d2y 3 dy 6 Order = 2 , degree = 3
(d) ( 2 ) + 3( ) + y 2 = 5 x
dx dx
Ordinary Differential Equations Page 4
LINEAR DIFFERENTIAL EQUATIONS
Q dQ
VC = , VR = IR & I =
C dt
− 50 sin (2πft ) = 0
Q dQ
Therefore + R
C dt
Ordinary Differential Equations Page 6
Solution of a Differential Equation
A solution of a d.e. which involves the independent variable x and
dependent variable y is the finding of the equation f(x, y) = 0 which
satisfies the d.e.
Example 7
Determine whether the equation
(a) y=2e -x + xe-x and
(b) y=3e -x - 4 xe-x
d2y dy
are solutions of the d.e. 2
+ 2 + y= 0 .
dx dx
y = 2e -x + xe-x
d -x
( )
y' = 2 e + x e + e
dx
d -x
dx
( )
-x d
dx
(x ) = −e-x − xe-x
y" =
d
( ) d -x
− e − x e + e
-x
( )
-x d
(x ) = xe-x
dx dx dx
d2y dy
L.H .S . = 2 + 2 + y
dx dx
( )
= 2e -x + xe -x + 2 − e -x − xe -x + xe -x = 0
= R.H .S .
2
d y dy
∴ y=2e + xe is a solution of 2 + 2 + y
-x -x
dx dx
Ordinary Differential Equations Page 8
(b)
y = 3e -x − 4 xe-x
d -x
( )
d -x
y ' = 3 e − 4 x e + e -x d
( )
(x ) = −7e-x + 4 xe-x
dx dx dx
d -x
( )
d -x
y" = −7 e + 4 x e + e ( )
-x d
(x ) = 11e-x − 4 xe-x
dx dx dx
d2y dy
L.H .S . = 2 + 2 + y
dx dx
( )
= 3e -x − 4 xe -x + 2 − 7e -x + 4 xe -x + 11e -x − 4 xe -x = 0
= R.H .S .
2
d y dy
∴ y=3e − 4 xe is a solution of
-x -x
2
+2 + y
dx dx
Ordinary Differential Equations Page 9
A general solution of a d.e. is a set of all possible solutions of the
d.e.
A particular solution of a d.e. is any one solution of the d.e that
fulfills the specific boundary conditions.
Example 8
dy
Given the d.e. = 10 x
2
dx
y = 5x + C is a general solution while
y = 5x2 + 3 is a particular solution.
Example 9
Determine the values of the constants C1 and C2 in
y = C1sin x + C2cos x
with the following conditions.
(a) The initial conditions y(0) = 1, y’(0) = 2.
(b) The boundary conditions y(0) = 1 and y’(π) = 2.
∫ dy =∫ − sin 2 xdx
y = − ∫ sin 2 xd (2 x )× = −(− cos 2 x )× + c = cos 2 x + c
dx 1 1
d (2 x ) 2 2
y (0 ) = cos 2(0 ) + c = 2 ⇒ c =
1 3
2 2
1 3
∴ Particular sol. of the d .e. = cos 2 x +
2 2
Ordinary Differential Equations Page 13
Direct Integration
As integration is the reverse process of differentiation, a d.e. may
be solved by direct integration.
Example 10
Find the general solution of the d.e.
dy 4x2
∫ ∫ ⇒ = + = +c
2
(a) = 4x dy = 4 xdx y c 2 x
dx 2
d2y
∫ ∫ ∫ dxdx
-2 x -2 x
(b) 2
=e dy = e
dx
e-2 x e -2 x
= ∫ + c1 dx = + c1 x + c2
−2 4
Ordinary Differential Equations Page 14
FIRST ORDER ORDINARY DIFFERENTIAL EQUATION
dy dy f ( x)
= f ( x) g ( y ) or =
dx dx g ( y)
and the general solution is
1
∫ g ( y) dy = ∫ f ( x) dx or ∫ g ( y) dy = ∫ f ( x) dx
Ordinary Differential Equations Page 15
Example 12
dy -5 x
(b) =ye
dx
1
∫ y ∫ dx
-5 x
dy = e
e-5 x
ln y = +c
−5
e- 5 x
+c
y=e −5
(c) dx - e - 5 x dy = 0
dx = e -5 x
dy
∫ = ∫ dx
5x
dy e
e5 x
y= +c
5
(d) x y' = y
dy
x =y
dx
1 1
∫ y dy = ∫ x dx
ln y = ln x + c
ln x + c
y=e
de ln x + c de ln x + c d (ln x + c ) e ln x + c
y' = = × =
dx d (ln x + c ) dx x
e ln (4 )+ c
y ' (4 ) = =1⇒ c = 0 ∴ y = e ln x = x
4
Ordinary Differential Equations Page 21
First Order Linear ODE
Example 15
What are P and Q referred to the standard form?
P(x ) = - 3x 2 , Q(x ) = 5 x
dy
(a) - 3x 2 y - 5 x = 0
dx
2 dx
P (t ) = 3t − 2 , Q (t ) = −
5 2
(b) t + 3t 3 x + 2t = 5 x
dt t t
Ordinary Differential Equations Page 22
Integrating Factor
μ(x) = e ∫ P(x)dx
μ( x) y = ∫ μ( x) Q( x) dx
µ (x ) = e ∫ −5 dx
= e −5 x
e −5 x y = ∫ e −5 x (0 )dx = C
y = Ce 5 x
y (6 ) = (6 ) + C (6 ) = 6
2 −2
P(x ) = , Q(x ) = 2
2
x 3
2 ∴ C = 72
µ (x ) = e ∫
dx
x
= e 2 ln x = x 2 2
y = x + 72 x − 2
x 2 y = ∫ x 2 (2 )dx 3
2 3
x y = x +C
2
3
2
y = x + Cx − 2
3
Ordinary Differential Equations Page 25
Example 16
Find the general solution of the following linear d.e.
dy
(c) + y tan x = sin x
dx
P( x ) = tan x, Q( x ) = sin x
µ (x ) = e ∫ tan xdx
=e
ln sec x
= sec x
(sec x ) y = ∫ sec x sin xdx
(sec x ) y = ∫ tan xdx
(sec x ) y = ln sec x + C
y = cos x(ln sec x + C )
P(x ) = − , Q(x ) = x e
3 3 x y (1) = (1)3 (1)
e + C (1)3
=2
x ∴C = 2 − e
( )
3
∫ − x dx
µ (x ) = e = e −3ln x = x −3 y = e x − e + 2 x3
x −3 y = ∫ x −3 x 3e x dx ( )
x −3 y = e x + C
y = x 3e x + Cx 3
µ (t ) = e ∫ k m dt
= e kt m
e kt m v = ∫ e kt m (0 )dt = C
v = Ce − kt m
Ordinary Differential Equations Page 28
Example 17
v = Ce − kt m = Ce −0.7 t 2.4 = Ce −0.292t
Given the initial condition, v = 30 when t = 0.
v(0 ) = Ce −0.292 (0 ) = 30
C = 30
then
v(t ) = 30e −0.292t
Check:
velocity of a body when t = 0
v (0 ) = 30e −0.292 (0 ) = 30 m s
velocity of a body after 10s
v (10 ) = 30e −0.292 (10 ) = 1.618m / s
∫ ( RC )
−1
µ (t ) = e
dt
= e t RC
e t RC Q = ∫ e t RC (0 )dt = K
Q = Ke −t RC
Ordinary Differential Equations Page 30
Example 18
−t RC
Ke (
− t 20×103 ×0.5×10 −6 )
Vc (t ) =
Ke
= = 2 × 10 6 Ke −100t
C 0.5 × 10 −6
Given the initial condition, Vc = 0 when t = 0.
Vc (0 ) = 2 × 10 6 Ke −100 (0 ) = 70
K = 3.5 × 10 −5
then
Vc (t ) = 2 × 10 6 × 3.5 × 10 −5 e −100t = 70e −100t
Check:
p.d. across the capacitor at t = 0
Vc (0 ) = 70e −100 (0 ) = 70V
p.d. across the capacitor after 10 ms
Vc (0.01) = 70e −100 (0.01) = 25.75V
Terminology
A second order linear d.e. has the general form
d2y dy
b2 ( x) 2 +b1 ( x) +b0 ( x) y = f ( x) .
dx dx
If f ( x) = 0 the d.e. is homogeneous.
If f ( x) ≠ 0 the d.e. is inhomogeneous.
d2y dy
2
+p + qy = 0
dx dx
d2y
2
+ 4 y=0.
dx
y ' = 2 A cos 2 x − 2 B sin 2 x, y" = −4 A sin 2 x − 4 B cos 2 x
( ) ( )
L.H .S . = 16e −4 x + 7 − 4e −4 x + 12 e −4 x = 0 = R.H .S .
∴ e - 4 x is a solution of d.e. y" +7y' +12y = 0
Ordinary Differential Equations Page 38
Example 21
Given the d.e. d2y dy
2
+ 7 + 12 y = 0.
dx dx
L.H .S .
( ) (
= 9C1e −3 x + 16C2 e − 4 x + 7 − 3C1e −3 x − 4C2 e − 4 x + 12 C1e −3 x + C2 e − 4 x )
= 0 = R.H .S .
2 d2 d
D denotes 2 and D denotes .
dx dx
D 2 y + pDy + qy = 0
( D 2 + pD + q) y = 0
Complementary Function
The general solution of the d.e.
d2y dy
2
+p + qy = 0
dx dx
is y = C1φ1(x) + C2φ2(x)
where 1φ (x) = e kx
φ
and 2 (x) =
1
e k x
are solutions of the differential
2
k 2 + pk + q = 0
- an auxiliary equation of the d.e. and is quadratic in k.
d2y dy
(b) 2
+8 + 16 y = 0
dx dx
by comparing the general sol. of d.e. y"+ py '+ q = 0
⇒ p = 8 & q = 16
d2y dy
(c) 2
+2 + 2y = 0
dx dx
by comparing the general sol. of d.e. y"+ py '+ q = 0
⇒ p = 2&q = 2
auxiliary equation of d.e. : k 2 + pk + q = 0
k 2 + 2k + 2 = 0
−2± (2) − 4(1)(2) − 2 ±
2
−4
k= = = −1 ± j
2(1) 2
Ordinary Differential Equations Page 45
Nature of Roots of the Auxiliary Equation
(1) Roots are real and distinct
If the roots of the auxiliary equation are k1 and k 2 , then the general
solution of the d.e. is
y = C1 e k1x + C2 e k2 x
Example 23
d2y dy
Solve the d.e. (a) 2
-2 - 8y = 0
dx dx
k 2 − 2k − 8 = 0
(k + 2)(k − 4) = 0
k = −2 or 4
∴ y = C1 e −2 x + C2 e 4 x
Ordinary Differential Equations Page 46
Nature of Roots of the Auxiliary Equation
(1) Roots are real and distinct
If the roots of the auxiliary equation are k1 and k 2 , then the general
solution of the d.e. is
y = C1 e k1x + C2 e k2 x
Example 23
d2y dy
Solve the d.e. (b) 2 2 + - 6y = 0
dx dx
2k 2 + k − 6 = 0
(2k − 3)(k + 2) = 0
k = −2 or 3 2
∴ y = C1 e −2 x + C2 e3 x 2
Ordinary Differential Equations Page 47
(2) Roots are equal
If the repeated roots of the auxiliary equation are k ,then the
general solution of the d.e. is
y = C1 e kx + C2 xe kx
or y = (C1 + C2 x) e kx
Example 24
d2y dy
Solve the d.e. (a) 2
+8 + 16 y = 0
dx dx
k 2 + 8k + 16 = 0
(k + 4)(k + 4) = 0
k = −4 (repeated)
∴ y = (C1 + C2 x ) e −4 x
Ordinary Differential Equations Page 48
(2) Roots are equal
If the repeated roots of the auxiliary equation are k ,then the
general solution of the d.e. is
y = C1 e kx + C2 xe kx
or y = (C1 + C2 x) e kx
Example 24
d2y dy
Solve the d.e. (b) 2
- 14 + 49 y = 0
dx dx
k 2 − 14k + 49 = 0
(k − 7 )(k − 7 ) = 0
k = 7 (repeated)
∴ y = (C1 + C2 x ) e 7 x
Ordinary Differential Equations Page 49
3. Roots are complex
If the roots of the auxiliary equation are k1 + k 2 j and k1 − k 2 j
The solution is y = A e(k1+k 2 j)x + B e(k1-k2 j)x
However, it is usually written as
y = e k1 x (C1 cos k 2 x + C2 sin k 2 x)
where A, B, C1 and C2 are constants to be determined by
boundary conditions.
Example 25 (a) D 2 y + 2 Dy + 2 y = 0
Solve the d.e. (b) D 2 y + 25 y = 0
(c) D 2 y + 6 Dy +13 y = 0
given when x=0 , y=2 and y' =1.
k 2 + 2k + 2 = 0
−2± (2) − 4(1)(2) − 2 ±
2
−4
k= =
2(1) 2
= −1 ± j ⇒ k1 = −1 & k 2 = 1
∴ y = A e(−1+j ) x + B e (−1− j ) x
k 2 + 25 = 0
k = ± − 25 = ±5 j ⇒ k1 = 0 & k 2 = 5
∴ y = A e(5 j ) x + B e (−5 j ) x
or y = C1 cos 5 x + C2 sin 5 x
d2y dy
2
+p + qy = f(x)
dx dx
dx dx
4C1e 2 x − 2C1e 2 x − 6C1e 2 x = e 2 x
−4C1e 2 x = e 2 x
Hence C1 = − 1
4
1
Therefore y pi = − e 2 x
4
1 2x
The general solution is y = Ae 3x
+ Be −2 x
− e
4
d (⋅)
where D(⋅) =
dt
φ11 (D ) φ12 (D )
φ (D ) = φ11 (D )φ22 (D ) − φ12 (D )φ21 (D ) =
φ21 (D ) φ22 (D )
d (⋅)
Solution:
Using D-operator, D(⋅) =
dt
( D − 3) x -6 y = 0 Eq.(1)
3 x + ( D + 3) y = 0 Eq.( 2)
D −3 −6
φ (D ) = =0
3 D+3
( D − 3)( D + 3) + 18 = 0
D2 + 9 = 0
D = ±3 j
Ordinary Differential Equations Page 58
The complementary solutions of x and y have the same
form and are given by
xcf = A1 cos 3t + B1 sin 3t , ycf = A2 cos 3t + B2 sin 3t
( D − 3) xcf − 6 ycf = 0
[(−3 A1 sin 3t + 3B1 cos 3t ) − (3 A1 cos 3t + 3B1 sin 3t )
− 6( A2 cos 3t + B2 sin 3t )] = 0
dy 2 x2
+y =e
dx
E.g. The differential equation above cannot be solved by
writing the solution as a linear combination of elementary
function.
C y(x + h)
0
A D
y(x0 + h)
y0 y1
x
0 x0 x1= x0 + h
y ' = 2 x + y, y (0) = 1
Solution:
With x0 = 0, y0 = 1 and h = 0.4
y1 = 1.0 + 0.4 * [2(0) + 1.0] = 1.4
−x
Applying the integrating factor e
y = 3e x − 2 x − 2
x = 0.4, y = 1.6755
0 1.0 1.0+0.1*[2(0)+1.0]=1.1
0.1 1.1 1.1+0.1*[2(0.1)+1.1]=1.23
1 1
m3 = f ( xn + h, yn + h ⋅ m2 )
2 2 0 x0 x0 + h
x
x0 + 0.5h
m4 = f ( xn + h, yn + h ⋅ m3 )
Ordinary Differential Equations Page 65
Example 29
Use Runge - Kutta method to estimate y (0.4) if
y = 2 x + y, y (0) = 1
'
Solution:
f ( x, y ) = 2 x + y, x0 = 0, y0 = 1 and h = 0.4
m1 = [2(0) + 1] = 1.0
0.4 0.4
m2 = [2(0 + ) + (1 + ×1.0)] = 1.6
2 2
0.4 0. 4
m3 = [2(0 + ) + (1 + ×1.6)] = 1.72
2 2
m4 = [2(0 + 0.4) + (1 + 0.4 ×1.72] = 2.488
1
y (0.4) = 1 + (0.4)[1.0 + 2(1.6) + 2(1.72) + 2.488] = 1.675
6
Ordinary Differential Equations Page 66