ORDINARY DIFFERENTIAL EQUATIONS AND
COMPUTATIONAL APPLICATION
R. RAJASREE
Basic Concepts and Importance of Differential Equations:
Differential Equations: Equations involving dependent variables and their
derivatives (ordinary or partial)
Expression of mathematical laws often appears as differential equations
Ordinary Differential Equation (or ODE): Differential equations that involve only
one independent variable
Example 1. Newton’s second law of motion:
F= ma where
F: force; m: mass of object; a: acceleration a is given bya dv or
dt 2
dv d x2 a dt dt ( , )
2 ( , , ) 2
mdv F t v dt
d x dv
m F t v
dt dt
Example 2. Chemical Reaction Engineering
Consider a perfectly mixed batch reactor in which reaction A B takes place
= the rate of formation of species A per unit volume = the rate of a disappearance of species A per unit volume
= the rate of formation of species B per unit volume
General Mole Balance on System Volume V
For well mixed condition
No inflow or outflow
Then the rate of change of species A is given by the following ODE rB
rA
rA
Basic Terminology
Order: Order of a differential equation is the highest derivative that apperars in the differential equation.
Degree: The degree of a differential equation is the power of the highest derivative term.
Linear: A differential equation is called linear if there are no multiplications among dependent variables and their derivatives.
Non-linear: Differential equations that do not satisfy the definition of linear are non -linear.
Quasi-linear: A non-linear differential in which there are no multiplications among d ependent variables and their derivatives in the highest derivative term.
' 2sin First order, First degree '' 3 ' 2 0 Second order, First degree
2 2
cos2 Second order, First degree 2
2 2
1 3( 1) 3 0 Second order, Second 2
y y x
y y y
d x ex dx x t dt dt
d x dx
x x y
dt dt
degree
Homogeneous: A differential equation is homogeneous if every single term contains the dependent variables or their derivatives.
Non-homogeneous: Differential equations which do not satisfy the definition of homogeneous
1 2 2
' 2sin linear ode '' 3 ' 2 0 linear ode
2 2 2 cos2 quasi-linear ode 2
' = + 2 2 non-linear ode ' non-linear ode
y y x
y y y
d x x dx x t
dt dt
y x y y b y b y
'' 2 ' 3 0 homogeneous ode y '' 0 homogenous ode
2 2 2 sin non-homogegeneous ode 2
4 3 2
1 non-homogegeneous ode
4 3 2
y y y
y
d y dy
t t y t
dt dt
d y d y d y dy y dt dt dt dt
Class Exercise 1
For each of the following differential equations state the order, degree, whether the equation is linear or non-linear and homogeneous or non- homogeneous
1. cos , where R, c, are constants
0 0
2. 2 cos 0 3. '' sin
' 2
4. '' 7 11 0
'' 2
5. 9 2
R dq q dt c e t e
d dr r
y x y
y y y
y y e x
Answers to Class Exercise 1.
1. First order, First degree, linear, non-homogeneous 2. First order, First degree, non-linear, homogeneous 3. Second order, First degree, linear, non-homogeneous 4. Second order, First degree, non-linear, homogeneous 5. Second order, First degree, linear, non-homogenous
Solving Ordinary Differential Equations
Find an expression for the dependent variable in terms of the independent variables which satisfies the original
equation
Solution: We’ll need the first and second derivative to do this
Plug these as well as the function into the differential equation
Thus
Many possible solutions are possible and some of the other possible solutions are:
. Show that 2 , where and
1 2 1 2
'' ' are constants is a solutio
Examp
n to 2
l
3 e1
0
x x
y c e c e c c
y y y
2 2
'( ) 2 ; ''( ) 4
1 x 2 x 1 x 2 x
y x c e c e y x c e c e
2 2 2
( 1 4 2 ) 3( 1 2 2 ) 2( 1 2 ) 0
(1 3 2) 1 (4 6 2) 2 2 0
x x x x x x
c e c e c e c e c e c e
x x
c e c e
0=0
2 , where and are conatants is a solution to '' 3 ' 2 0
1 x 2 x 1 2
y c e c e c c y y y
1. - 2. -2
y e x y e x
CheckEach equation has infinitely many solutions
Which is the solution we want?
Does it matter which solution we use?
Initial Conditions: Set of conditions that are specified at the initial point, generally time point, will allow us to determine the solution.
Initial conditions are of the form
The number of initial conditions depends up on the order of the ODE
Initial value Problem (IVP):
Problems with specified initial conditions are called initial value problems (IVP).
Example 1:
Example 2:
Boundary Conditions: Set of conditions that are specified at the boundary points, generally space points, will allow us to determine the solution. Problems with specified boundary conditions are called boundary value problems (BVP).
'' 3 ' 2 0; y(0)=0; y (0)=1 ' y y y
' x cos ; y( )=0 y y e x
( )0 0 and/or y(k)( )0
y t y t y
k
General Solution: Most general form that the solution can take and doesn’t take any initial conditions into account.
Actual Solution or Particular Solution: Specific solution that satisfies both differential equation and initial conditions.
Example 2. What is the actual solution to the following IVP?
Example 1
( )
2 , where and are conatants is a general solution to
1 2 1 2
'' '
3 2 0
x x
y c e c e c c
y y y
'' 3 ' 2 0; y(0)=0; y (0) 1 ' Genaral solution is given by
- -2
( ) 1 2
Differentiating the above equation and applying initial condi
1
tions 1 2 0
2 1
1 , 2 1
1 2
y y y
x x
y x c e c e
c c
c c
c c
Actual solution: y e x e 2 x
First Order Differential Equations
The general first order equation can be written as
There is no general formula for solution of (1)
Separable equations
Exact equations
Integrating factors
First order linear equations
Types of Solutions:
Explicit Solution: Solution that is given in the form
Implicit Solution: Any solution that is not explicit
( , ) (1) dy f y t
dt
2 3 xy2 y2
x y
c
( )
y y t
Separable Differential Equations
A separable differential equation is any differential equation that can be
written in the form
Solving involves two steps
1. Rearrange the differential Equations as follows
2. Integrate both sides
Actual or Particular solution through the initial point is:
( ) ( ) dy f x dx g y
( ) ( )
g y dy f x dx
( ) ( ) +c General solution g y dy f x dx
( ) ( )
0 0
y x
g y dy f x dx
y x
1: Re (1)
2:
' ( 1), 0 0
( 1) (1)
1
0 1 0
ln( 1 2
: ln( ) 2 )
1 0 2 0
2 y
Step arranging eq
Step Integratin
x y y for x d
Soluti y x y dx
dy xdx y
dy x
y xdx
y
y x x y
on
Answ r y x
g
e
Example 1
Example 2: ,where , , tan ,
0 0.
(1) -
,
1. Rearrange the terms
2.
0 0
1 :
( )
mdv mg kv k m g are positive cons ts where v v for t tdt
mdv dt mg kv
put u mg kv u mg Integratin
Soluti
g eq kv
m on
dv
0
0 0
0
, /
0 - 0
(1)
0 0
ln ; ln ( )
0 0
ln ( )
( )exp[
0
0 (
v t
dt du kdv dv du k mg kv
v t
Equation then becomes
u t
mk u duu t dt
mk uuu t t uu mk t t
resubstituting u in terms of v mg kv k t t
mg mg k
v v t
mg m
k v k t
k
m
)]
Exact Equations
A first order differential equation can be written as
Then the equation is the same as
Solutions are given in the implicit form by Examples
' ( ) y f x
( , ) ( , ) 0 (1)
(1)
( , ):
( , ) ( , ) ( , )
P x y dx Q x y dy
The differential equation is exact if the left side
of the equation is the differential of some function F x y
F F
dF x y dx dy P x y dx Q x y dy
x y
( , ) 0 dF x y
( , ) F x y c
1. 0, ( ) 0,
2 2 2 2
2. (2 1) 0, ( ) 0,
ydx xdy d xy xy c
y y y y
e dx xye dy d xe y xe y c
Test for exactness
( , ) ( , ) 0 ( , ) , ( , )
2 , 2
2 2
If the equation P x y dx Q x y dy is exact then F P x y F Q x y
x y
and hence
F P F Q
y x y x y x
under continuity assumption
F F
y x x y so that
P Q
y Test for exactnes
x s
(1) Equation (2
1.
' 2 2
) can also be writt ' 2 2 (1)
( 2 2 ) 0 (2)
3 2
( 2 ) 0 3
as (
en
Example Solve the following Differential Equation x
Solution
Equation can be w dy x
y y
y dx x y
x y dx xdy x xy dx x dy
ritt n as x
e
)
3 2 4 2
( ) ( ) 0
(4
Answ )
4 2 e
4 4 r
4 ( ) Integrating e
x dx d x y d x x y quation
x x y c
(1)
2 2
2 9 (2 1) 0 (1)
2 2
(2 9 ) (2 1) 0 (2)
( , ) (2 9 ) 2 2.
2 2
2 9 (2 1)
(
0
3 d Solution
Equation can be w
Example Solve the following Differ
xy x y x dxy
xy x dx y x
ential Equation dy
dy P
x
x
r y
itten as
y xy x
x y x dx
) ( , ) (2 2 1) (4)
2 , 2
2 2
2 9 (5) 2 1 (6) (2 9 )2
2 3
3 ( ) (7)
E (5)
Integrating equation
Q x y y x
Q Q
Py x y x Py y
Fx P xy x Fy Q y x
F Pdx xy x dx
x y x g y
Exact Equation
( ):
2 '( ) (8)
(8) (6)
'( ) 2 1, ( ) 2
2 3 2 2 2 3
( , ) 3 ( 1) 3
(7)
: ( 2
g y arbitrary function of y F x g yy
Comparing Equation with Equation
g y y g y y y
F x
Differentiating e
y x y x y y y x
So
y x lut on d
q
i y
2 2 3
2
( 1) 3
( 1) 3 ) 03
y x y x c An
x
sw r y
e x
Class Exercise 2
1. 0 , , , tan
0 0 0 0
0
2. ( 0 ), 1 1 , tan
dp g p where g p are positive cons ts and p p for Find the particular soluti
p y y dy
d k for t t where k is a positiv
on satisfying the given initial conditio
e cons t
n
d
, 0 1
tan
3. 2 , , , tan , 0 0 0
1. 0
2 2 2
( )
2. (5 2 ) (7 2 )
Verify that the Equation is exact and find the general solut
ts and are cons ts
m dv av bv where m a b are positive cons ts v v for t dt
xdx ydy
x y
x y dx
ion
y x d
2 2
3. 0
0
1. ( 1) ( 3) 0 (0) 2/3
2. (2 ) ( 2 ) 0 1 1
3. 0 0
2 2
ydx xdy x y f
Verify that the Equation is exact and find the partcular solution requested if i y
y dx x dy y
x y dx x y dy y for x yd
t
x xdy y
exists
x y for
x 0
Integrating Factors
Solving for non-exact equations
Integrating factor is a function such that after multiplication by the Equation becomes exact.
( , )x y
( , )x y
2
(3 2 ) 0
(3 2 ) 0 (1)
( , ) 3 2 ( , ) 2 1
' '.
(1) (3
1:
Solve x y dx xdyx y dx xdy
P x y x y Q x y x
P Q
y x
P Q
non exact
y x
Consider a function x After multiplication with x equation becomes
x
Solution
Example
2
2 2
2 3 2
2 '
2 ) 0 (2)
( , ) 3 2 (3); ( , ) (4) 2 2
3 2 ; ( )
( ) (5) (
xy dx x dy
P x y x xy Q x y x
P Q
x x
y x
P Q
exact equation
y x
F P x xy F x x y g y
x
F x g y
y
Comparing
x is the Integrating Factor
' 3 2
3 2
4) (5) ( ) 0; ( ) 0;
and
g y g y F x x y
x x y c Answer
How to find the Integrating Factor for equation of the form
P x y dx Q x y dy ( , ) ( , ) 0
1:
2: . ( . . )
3:
4:
5: ,
6
Step Assume an Integrating factor of x y m n with m and n to be found
Step Multiply the equation with I F ie x y m n Step Find P
y Step Find Q
x
P Q Step For an exact equation
y x
Step
: Solve step for m and n 5
2: .
2 2
of (3 2 ) ( 2 ) 0
:
2 2
(3 2 ) ( 2 ) 0 (1)
1:
2: (1)
Example Find an I F and hence obtain the general solution xy y dx x xy dy Solution
xy y dx x xy dy non exact
Step Assume an Integrating Factor x ym n Step Multiply eq by
. ( . . )
1 1 2 2 1 1
(3 2 ) ( 2 ) 0 (2)
1 1
3: 3( 1) 2( 2)
1 1
4: ( 2) 2( 1)
5:
1 1
3( 1) 2( 2)
I F i e x ym n
m n m n m n m n
x y x y dx x y x y dy
P m n m n
Step y n x y n x y
Q m n m n
Step x m x y m x y
P Q Step y x
m n m n
n x y n x y
1 1
= ( 2) 2( 1)
(6):
1 1
3( 1) 2 (3) 2( 2) 2( 1) (4) (3) (4) 0, 1
(2) (3
m n m n
m x y m x y
Step Solve for m and n
m n m n
Equating the coefficients for x y and x y
n m
n m
From eq and eq
n m
Equation becomes x
2y2xy dx2) (x32x y dy2 ) 0 (5)
2: ...
(2)
2 2 3 2
(3 2 ) ( 2 ) 0 (5)
2 2
3 4 ; 3 4
2 2 3 2
3 2 (6) ( 2 ) (7)
3 2 2 ( ) (8) 3 2 2 '
Example Continued Equation becomes
x y xy dx x x y dy
P x xy Q x xy Exact equation
y x
F P x y xy F Q x x y
x y
F x y x y g y F x x y g
y
( ) (9)
(7) (9) '( ) 0
3 2 2
3 2 2=c Answer y
Comparing equation and g y
Thus
F x y x y x y x y
First Order Linear Equations
A special case of first order differential equations
Actually can derive a formula for the general solution
In order to solve a linear first order equation, it has to be of the form
( ) ( ) (1) ( ) '( ) (2)
( ) (1)
' '( ) ( ) (3) ( )
, ( )
' ' ( ) ( ) ( ) ' ( ) ( ) ( ) ( ) ( )
cdy p x y q x dx Assume p x v x
v x Equation becomes
y v x y q x v x
or after multiplying by v x
vy v y v x q x or vy v x q x Hence
v x y v x q x dx o
1
( ) ( )
( ) ( ) c
r y v x q x dx General solution
v x v x
First Order Linear Equations (Continued….)
(2)
( ) 1 (4) ( )
var
1 ( ) (5) ( )
(5)
ln ( ) ( ) ( ) ( )
(3) ( 1
( )
Equation becomes p x dv
v x dx
Separate the iables and solve dv p x dx
v x
Integrating equation v x p x dx
p x dx v x e
From equation y v x
Finding v x
( ) ( )
) ( )
( ) ( ) ( ) ( )
v x q x dx c General solution v x
p x dx p x dx p x dx
y e e q x dx ce
1.
9.8 0.196 :
9.8 0.196 (1)
Re (1)
0.196 9.8 (2)
( ) 0.196 ( ) 9.8
Example Find the solution to the following differential equation
dv v
Solution dt
dv v
dt aaranging equation
dv v
dt
where
p t q t
The solut
( ) (3)
0.196 0.196 0.196
0.196 9.8 0.196
0.196
= 50 ion is given by
pdt pdt pdt
v e e q t dt ce
pdt dt t
e e e
t t t
v e e dt ce
v ce t Answer
2. : 9.8 0.196 (0) 48
0.196 50
in t
48 (0) 50 2
,
Example Solve the following IVP
dv v v
dt
Solution
Find the general solution v ce t
Plug he initial codition to solve for c
v c
c
So the actual solutio
0.196
50 2
n to IVP is
v e t
3.
' 3
cos( ) sin( ) 2cos ( )sin( ) 1; 3 2, 0
4 2
' 3
cos( ) sin( ) 2cos ( )sin( ) 1
Re (1)
' tan( ) 2cos ( )sin( ) sec( ) 2 tan( )
Example Solve the following IVP
x y x y x x y x
Solution
x y x y x x
arranging equation
y x y x x x
pdx x
e e
lnsec( ) sec( )
1 2
( ) sec( )(2cos ( )sin( ) sec( ))
sec( ) sec( )
1 2
( ) (sin(2 ) sec ( ))
sec( ) sec( )
cos(2 )
( ) 1 tan( )
2
sec( ) sec( )
( ) 1 cos( )cos(2 ) sin( ) cos( ) 2
dx e x x
y x x x x x dx c
x x
y x x x dx c
x x
x c
y x x
x x
y x x x x c x
Plug
the initial condition: 7
( ) 1 cos( )cos(2 ) sin( ) 7cos( ) 2
c
y x x x x x
. int
:
1. 2cos sin , 2
2. cos 3sin 0, 2
. int
1. 3
E 3
I Show that the given function is an egrating factor and solve
ydx ydy e x
y xdx xdy y
II In each case find an egrating factor and solve ydx
Class xercise
2 3 4 )
2 0
2. 3 (3 0
. int
1. 2 0, (2) 1
2. 2 0, (1) 2 -ln 1
. ( - )
y y
xdy
x dx x dy
III Find egrating factors and solve the following initial value problems
ydx xdy y
ydx xdy y
IV Show that e x x but not x