Primer for ordinary differential equations

31
TARUN GEHLOT Primer for Ordinary Differential Equations After reading this chapter, you should be able to: 1. define an ordinary differential equation, 2. differentiate between an ordinary and partial differential equation, and 3. solve linear ordinary differential equations with fixed constants by using classical solution and Laplace transform techniques. Introduction An equation that consists of derivatives is called a differential equation. Differential equations have applications in all areas of science and engineering. Mathematical formulation of most of the physical and engineering problems leads to differential equations. So, it is important for engineers and scientists to know how to set up differential equations and solve them. Differential equations are of two types (A) ordinary differential equations (ODE) (B) partial differential equations (PDE)

Transcript of Primer for ordinary differential equations

Page 1: Primer for ordinary differential equations

TARUN GEHLOTPrimer for Ordinary Differential Equations

After reading this chapter, you should be able to:

1. define an ordinary differential equation,2. differentiate between an ordinary and partial differential equation, and3. solve linear ordinary differential equations with fixed constants by using classical

solution and Laplace transform techniques.

Introduction

An equation that consists of derivatives is called a differential equation. Differential equations have applications in all areas of science and engineering. Mathematical formulation of most of the physical and engineering problems leads to differential equations. So, it is important for engineers and scientists to know how to set up differential equations and solve them.

Differential equations are of two types (A) ordinary differential equations (ODE) (B) partial differential equations (PDE)

An ordinary differential equation is that in which all the derivatives are with respect to a single independent variable. Examples of ordinary differential equations include

d2 ydx2

+2dydx

+ y=0,

dydx

( 0)=2, y (0)=4,

d3 ydx3

+3d2 ydx 2

+5dydx

+ y=sin x ,

d2 ydx2

(0)=12 ,

dydx

( 0)=2, y (0 )=4

Ordinary differential equations are classified in terms of order and degree. Order of an ordinary differential equation is the same as the highest derivative and the degree of an ordinary differential equation is the power of highest derivative.

Page 2: Primer for ordinary differential equations

K b

x

Figure 1 Spring-mass damper system.

M

Thus the differential equation,

x3 d3 ydx3

+x2 d2 ydx2

+ xdydx

+xy=ex

is of order 3 and degree 1, whereas the differential equation

( dydx

+1)2

+ x2 dydx

=sin x

is of order 1 and degree 2.An engineer’s approach to differential equations is different from a mathematician. While, the latter is interested in the mathematical solution, an engineer should be able to interpret the result physically. So, an engineer’s approach can be divided into three phases:

a) formulation of a differential equation from a given physical situation,b) solving the differential equation and evaluating the constants, using given conditions,

and c) interpreting the results physically for implementation.

Formulation of differential equations

As discussed above, the formulation of a differential equation is based on a given physical situation. This can be illustrated by a spring-mass-damper system.

Above is the schematic diagram of a spring-mass-damper system. A block is suspended freely using a spring. As most physical systems involve some kind of damping - viscous damping, dry damping, magnetic damping, etc., a damper or dashpot is attached to account for viscous damping.

Let the mass of the block be M , the spring constant be K , and the damper coefficient be b . If we measure displacement from the static equilibrium position we need not consider gravitational force as it is balanced by tension in the spring at equilibrium.

Below is the free body diagram of the block at static and dynamic equilibrium. So, the equation of motion is given by

Page 3: Primer for ordinary differential equations

SF

Ma

DFT

Mg

Figure 2 Free body diagram of spring-mass-damper system.

Static Dynamic

Primer for Ordinary Differential Equation

Ma=FS+F D (1) where

FS is the restoring force due to spring.FD is the damping force due to the damper.a is the acceleration.

The restoring force in the spring is given byFS=−Kx (2)

as the restoring force is proportional to displacement and it is negative as it opposes the motion. The damping force in the damper is given by

FD=−bv (3)as the damping force is directly proportional to velocity and also opposes motion.Therefore, the equation of motion can be written as

Ma=−Kx−bv (4)

Since

a=d2 xdt2

and v=dx

dtfrom Equation (4), we get

Md2 xdt 2

=−Kx−bdxdt

Page 4: Primer for ordinary differential equations

M

d2 xdt 2

+bdxdt

+Kx=0 (5)

This is an ordinary differential equation of second order and of degree one.

Solution to linear ordinary differential equations

In this section we discuss two techniques used to solve ordinary differential equations(A) Classical technique (B) Laplace transform technique

Classical Technique

The general form of a linear ordinary differential equation with constant coefficients is given by

dn ydxn

+kndn−1 ydxn−1

+. .. .. . .. .+k3d2 ydx 2

+k2dydx

+k1 y=F ( x ) (6)

The general solution contains two parts

y= yH + y P (7)where

y H is the homogeneous part of the solution andy P is the particular part of the solution.

The homogeneous part of the solution y H is that part of the solution that gives zero when

substituted in the left hand side of the equation. So, y H is solution of the equationdn ydxn

+kndn−1 ydxn−1

+. .. .. . .. .+k3d2 ydx 2

+k2dydx

+k1 y=0 (8)

The above equation can be symbolically written as

Dn y+kn Dn−1 y+ .. .. . .. .. . .. .. . ..+k 2 Dy+k 1 y=0 (9)( Dn+kn Dn−1+. .. . .. .. .. . .. .. . .+k2 D+k1) y=0 (10)

where,

Dn= dn

dxn (11)

Dn−1=dn−1

dxn−1

.

.

.

operating on y is the same as ( D−r 1) , ( D−r 2) , ( D−r n )

Page 5: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

operating one after the other in any order, where( D−r 1) ,( D−r2 ), . .. .. . .. .. . .,( D−rn )

are factors ofDn+kn Dn−1+. .. . .. .. . .. .. . .+k2 D+k 1=0 (12)

To illustrate

( D2−3 D+2) y=0 is same as

( D−2 )( D−1 ) y=0( D−1 )( D−2 ) y=0

Therefore,

( Dn+kn Dn−1+. .. . .. .. .. . .. .. . .. ..+k2 D+k1 ) y=0 (13)is same as

( D−r n )(D−rn−1) . .. .. . .. .. .. . .. .. .( D−r1) y=0 (14) operating one after the other in any order.

Case 1: Roots are real and distinct

The entire left hand side becomes zero if (D−r1) y=0 . Therefore, the solution to (D−r1) y=0 is a solution to a homogeneous equation. (D−r1) y=0 is called Leibnitz’s linear differential equation of first order and its solution is

(D−r1) y=0 (15)dydx

=r1 y (16)

dyy

=r1 dx (17)

Integrating both sides we getln y=r1 x+c (18)

y=cer1 x

(19)Since any of the n factors can be placed before y , there are n different solutions corresponding to n different factors given by

Cn ernx

,Cn−1ern−1 x

, .. . .. .. . .. .. . .,C2er2 x

,C1er1 x

where rn , rn−1 , . .. .. .. . .. . ,r 2 , r1 are the roots of Equation (12) andCn, Cn−1 , .. .. . . ,C2 , C1 are constants.

We get the general solution for a homogeneous equation by superimposing the individual Leibnitz’s solutions. Therefore

y H=C1 er1 x

+C2er2 x

+. .. . .. .. .. . ..+Cn−1 er n−1 x

+Cn er nx

(20)

Page 6: Primer for ordinary differential equations

Case 2: Roots are real and identical

If two roots of a homogeneous equation are equal, say r1=r2 , then( D−r n )(D−rn−1) . .. .. . .. .. .. . .. .. . .. ..( D−r1 )( D−r1 ) y=0 (21)

Let’s work at( D−r 1)( D−r1 ) y=0 (22)

If( D−r 1) y=z (23)

then( D−r 1) z=0

z=C2 er1x

(24)Now substituting the solution from Equation (24) in Equation (23)

( D−r 1) y=C2 er1x

dydx

−r1 y=C2er1x

e−r1 x dy

dx−r1 e

−r1 xy=C2

d (e−r1x

y )dx

=C2

d (e−r1 x

y )=C2 dx (25)Integrating both sides of Equation (25), we get

e−r1 x

y=C2 x+C1 y=(C2 x+C1 )e

r1 x

(26) Therefore the final homogeneous solution is given by

y H=(C1+C2 x )er1 x

+C3er3 x

+. ..+Cn ern x

(27)Similarly, if m roots are equal the solution is given by

y H=(C1+C2 x+C3 x2+ .. .. . ..+Cm xm−1) erm x

+Cm+1 erm+1 x

+. ..+Cn er nx

(28)

Case 3: Roots are complex

If one pair of roots is complex, say r1=α +iβ and r2=α−iβ ,where

i=√−1then

y H=C1 e( α+iβ ) x+C2 e ( α−iβ ) x+C3 er3 x

+.. . .. .+Cn ern x

(29)Since

e iβx=cos βx+isin βx , and (30a)

e−iβx=cos βx−i sin βx (30b)then

Page 7: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

y H=C1 eαx (cos βx+i sin βx )+C2 eαx ( cos βx−isin βx )+C3 er3x

+ .. .. . .. ..+Cn er nx

=(C1+C2) eαx cos βx+i (C1−C2)eαx sin βx+C3er3 x

+.. .. . .. ..+Cn ernx

=eαx ( A cos βx+B sin βx )+C3 er3 x

+. . .. .. . .+Cn ern x

(31) where

A=C1+C2 andB=i(C1−C2 ) (32)

Now, let us look at how the particular part of the solution is found. Consider the general form of the ordinary differential equation

( Dn+kn Dn−1+k n−1 Dn−2+.. . .. .. . ..+k 1) y=X (33)

The particular part of the solution y P is that part of solution that gives X when substituted for y in the above equation, that is,

( Dn+kn Dn−1+k n−1 Dn−2+.. . .. .+k1 ) yP=X (34)

Sample Case 1

When X=eax, the particular part of the solution is of the form Aeax

. We can find A by

substituting y=Aeax in the left hand side of the differential equation and equating

coefficients.

Example 1

Solve

3dydx

+2 y=e−x

, y (0 )=5Solution

The homogeneous solution for the above equation is given by(3 D+2 ) y=0

The characteristic equation for the above equation is given by 3 r+2=0The solution to the equation is r=−0 .666667

y H=Ce−0 .666667 x

The particular part of the solution is of the form Ae− x

3d ( Ae−x )

dx+2 Ae− x=e− x

−3 Ae− x+2 Ae−x=e−x

−Ae− x=e−x

A=−1Hence the particular part of the solution is

y P=−e− x

Page 8: Primer for ordinary differential equations

The complete solution is given byy= yH + y P

=Ce−0 .666667 x−e−x

The constant C can be obtained by using the initial condition y (0 )=5

y (0 )=Ce−0 . 666667×0−e−0=5C−1=5C=6

The complete solution is

y=6 e−0. 666667 x−e−x

Example 2Solve

2dydx

+3 y=e−1 .5 x

, y (0 )=5Solution

The homogeneous solution for the above equation is given by(2 D+3 ) y=0

The characteristic equation for the above equation is given by 2 r+3=0The solution to the equation is r=−1. 5

y H=Ce−1 .5 x

Based on the forcing function of the ordinary differential equations, the particular part of the

solution is of the form Ae−1 .5 x, but since that is part of the form of the homogeneous part of

the solution, we need to choose the next independent solution, that is,y P=Axe−1 .5 x

To find A , we substitute this solution in the ordinary differential equation as

2d ( Axe−1. 5 x )

dx+3 Axe−1. 5 x=e−1 .5 x

2 Ae−1. 5 x−3 Axe−1.5 x+3 Axe−1. 5 x=e−1 .5 x

2 Ae−1. 5 x=e−1 .5 x

A=0 .5Hence the particular part of the solution is

y P=0 .5 xe−1 .5 x

The complete solution is given byy= yH + y P

=Ce−1.5 x+0 .5 xe−1 .5 x

The constant C is obtained by using the initial condition y (0 )=5 .

y (0 )=Ce−1. 5(0)+0. 5(0 )e−1. 5(0)=5C+0=5C=5

Page 9: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

The complete solution is

y=5 e−1 .5 x+0 .5 xe−1. 5 x

Sample Case 2 When

X=sin(ax ) or cos (ax ) , the particular part of the solution is of the form

A sin( ax )+B cos (ax ).We can get A and B by substituting y=A sin (ax )+B cos( ax ) in the left hand side of the differential equation and equating coefficients.

Example 3

Solve

2d2 ydx2

+3dydx

+3 .125 y=sin x,

y (0 )=5 , dydx

(x=0)=3

Solution

The homogeneous equation is given by

(2 D2+3 D+3 .125 ) y=0The characteristic equation is

2 r2+3 r+3 .125=0The roots of the characteristic equation are

r=−3±√32−4×2×3.125

2×2

=−3±√9−254

=−3±√−164

=−3±4 i4

=−0 . 75±iTherefore the homogeneous part of the solution is given by

y H=e−0.75 x( K1cos x+K2sin x )The particular part of the solution is of the form

y P=A sin x+B cos x

2d2

dx2( A sin x+B cos x )+3

ddx

( A sin x+B cos x )+3 .125 ( A sin x+B cos x )=sin x

2ddx

( A cos x−B sin x )+3 ( A cos x−B sin x )+3 .125( A sin x+B cos x )=sin x

2(−A sin x−B cos x )+3( A cos x−B sin x )+3 .125 ( A sin x+B cos x )=sin x(1. 125 A−3 B )sin x+(1 .125 B+3 A )cos x=sin x

Page 10: Primer for ordinary differential equations

Equating coefficients of sin x and cos x on both sides, we get1 .125 A−3 B=11 .125 B+3 A=0

Solving the above two simultaneous linear equations we get A=0 .109589 B=−0. 292237

Hencey P=0 .109589 sin x−0. 292237 cos x

The complete solution is given byy=e−0 .75 x (K 1cos x+K2sin x )+(0 . 109589 sin x−0 .292237 cos x )

To find K1 and K2 we use the initial conditions

y (0 )=5 , dydx

(x=0)=3

From y (0 )=5 we get5=e−0.75(0 )( K1cos (0)+K2 sin(0 ))+(0 . 109589 sin(0 )−0 .292237 cos(0 ))5=K1−0. 292237K1=5 .292237

dydx

=−0 .75 e−0 .75x( K1 cos x+K 2sin x )+e−0.75 x(−K 1sin x+K 2cos x )

+0. 109589cos x+0 . 292237sin xFrom dydx

( x=0)=3 ,

we get

3=−0 .75 e−0 . 75(0)( K 1cos(0 )+K2sin( 0))+e−0 . 75(0)(−K1 sin(0 )+K 2cos(0 ))+0 . 109589 cos(0 )+0 .292237 sin(0 ) 3=−0 .75 K1+K 2+0 . 109589

3=−0 .75 (5 . 292237 )+ K2+0 . 109589K2=6 . 859588

The complete solution is

y=e−0 . 75 x (5 . 292237 cos x+6 . 859588 sin x )+0 .109589 sin x−0 . 292237 cos x

Example 4

Solve

2d2 ydx2

+6dydx

+3. 125 y=cos ( x ),

y (0 )=5 , dydx

(x=0)=3

Solution

The homogeneous part of the equations is given by

(2 D2+6 D+3 . 125) y=0The characteristic equation is given by

Page 11: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

2 r2+6 r+3.125=0

r=

−6±√62−4(2 )(3. 125 )2(2 )

=−6±√36−25

4

=−6±√11

4 =−1 . 5±0 . 829156

=−0. 670844 ,−2 .329156

Therefore, the homogeneous solution y H is given byy H=K1e−0.670845 x+K 2e−2.329156 x

The particular part of the solution is of the formy P=A sin x+B cos x

Substituting the particular part of the solution in the differential equation,

2d2

dx2( A sin x+B cos x )+6

ddx

( A sin x+B cos x )

+3 .125( A sin x+B cos x )=cos x

2ddx

( A cos x−B sin x )+6 ( A cos x−B sin x )

+3 . 125( A sin x+B cos x )=cos x2(−A sin x−B cos x )+6( A cos x−B sin x )+3 . 125( A sin x+B cos x )=cos x

(1. 125 A−6 B )sin x+(1. 125 B+6 A )cos x=cos xEquating coefficients of cos x and sin x we get

1 .125 B+6 A=11 .125 A−6B=0

The solution to the above two simultaneous linear equations areA=0 .161006B=0 .0301887

Hence the particular part of the solution isy P=0 .161006 sin x+0 . 0301887 cos x

Therefore the complete solution isy= yH + y P

y=( K1e−0.670845 x+K 2e−2.329156 x)+0 .161006sin x+0. 0301887cos x

Constants K1 and K2 can be determined using initial conditions. From y (0 )=5 ,y (0 )=K1+ K2+0 .0301887=5

K1+K 2=5−0 .0301887=4 . 969811Now

Page 12: Primer for ordinary differential equations

dydx

=−0 .670845 K 1e−(0. 670845)x−2. 329156 K2e−(2 . 329156)x

+0 .161006 cos x−0 .0301887 sin x

From

dydx

( x=0)=3

−0 .670845 K1−2 . 329156 K2+0 .161006=30 .670845 K 1+2 .329156 K2=−3+0. 1610060 .670845 K 1+2 .329156 K2=−2 . 838994

We have two linear equations with two unknownsK1+K 2=4 . 969811 0 .670845 K 1+2 .329156 K2=−2 . 838994

Solving the above two simultaneous linear equations, we getK1=8 . 692253 K2=−3 .722442

The complete solution is

y=(8 .692253 e−0 . 670845 x−3 . 722442e−2 .329156 x ) +0 .161006 sin x+0 .0301887 cos x .

Sample Case 3When

X=eax sin bx or eax cos bx ,

the particular part of the solution is of the form

eax ( A sin bx+B cosbx ),we can get A and B by substituting

y=eax( A sin bx+B cosbx )in the left hand side of differential equation and equating coefficients.

Example 5

Solve

2

d2 ydx2

+5dydx

+3 . 125 y=e− x sin x,y (0 )=5 ,

dydx

(x=0)=3

Solution

The homogeneous equation is given by

(2 D2+5 D+3 .125 ) y=0 The characteristic equation is given by

2 r2+5 r+3 .125=0

r=−5±√52−4 (2)(3 .125 )

2(2)

Page 13: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

=−5±√25−25

4

=−5±0

4

=−1 . 25 ,−1 .25

Since roots are repeated, the homogeneous solution y H is given byy H=( K1+ K2 x )e(−1 .25)x

The particular part of the solution is of the formy P=e−x ( A sin x+B cos x )

Substituting the particular part of the solution in the ordinary differential equation

2d2

dx2{e−x( A sin x+B cos x )}+5

ddx

{e−x ( A sin x+B cos x )}

+3 .125 {e−x ( A sin x+B cos x )}=e− x sin x

2ddx

{−e−x( A sin x+B cos x )+e−x ( A cos x−B sin x )}

+5 {−e−x( A sin x+B cos x )+e−x ( A cos x−B sin x )}+3 .125 e− x( A sin x+B cos x )=e− x sin x

2 {e−x( A sin x+B cos x )−e− x( A cos x−B sin x )−e− x( A cos x−B sin x )−e−x( A sin x+B cos x )} +5 {−e− x( A sin x+B cos x )+e−x ( A cos x−B sin x )}+3 .125 e− x( A sin x+B cos x )=e− x sin x

−1 .875 e− x( A sin x+B cos x )+e−x ( A cos x−B sin x )=e−x sin x−1 .875 ( A sin x+B cos x )+( A cos x−B sin x )=sin x−(1 . 875 A+B)sin x+( A−1 . 875 B )cos x=sin x

Equating coefficients of cos x and sin x on both sides we getA−1. 875 B=0

1 .875 A+B=−1Solving the above two simultaneous linear equations we get

A=−0 . 415224 andB=−0. 221453

Hence, y P=−e− x(0 . 415224 sin x+0 .221453 cos x )

Therefore complete solution is given byy= yH + y P

y=( K1+xK 2 )e−1.25 x−e− x(0 .415224 sin x+0 .221453 cos x )

Constants K1 and K2 can be determined using initial conditions,

From y (0 )=5 , we get

K1−0 .221453=5K1=5 .221453

Nowdydx

=−1. 25 K1 e−1. 25 x−1 .25 K 2 xe−1 . 25 x+K2 e−1. 25 x−

e−x(0 . 415224 cos x−0 . 221453 sin x )+e−x(0 . 415224 sin x+0 . 221453 cos x )

Page 14: Primer for ordinary differential equations

From

dydx

( 0)=3 , we get

−1 .25 K1 e−1 .25 (0)−1.25 K2(0 )e−1 . 25(0)+ K2 e−1. 25(0)

−e0 (0. 415224 cos (0)−0. 221453 sin(0 ))+e0 (0 . 415224 sin( 0)+0 . 221453 cos(0 )=3−1 .25 K1+ K2+0 .221453−0 . 415224=3

−1 .25 K1+ K2=3 .193771−1 .25 (5 . 221453 )+K 2=3 . 193771K2=9 .720582

SubstitutingK1=5 .221453 and K2=9 . 720582

in the solution, we get

y=(5 .221453+9. 720582 x )e−1 . 25 x−e−x (0.415224 sin x+0. 221453 cos x )

The forms of the particular part of the solution for different right hand sides of ordinary differential equations are given below

X y P ( x )

a0+a1 x+a2 x2 b0+b1 x+b2 x2

eax Aeax

sin( bx ) A sin(bx )+B cos (bx )

eax sin (bx ) eax ( A sin (bx )+B cos(bx ))

cos (bx ) A sin(bx )+B cos (bx )

eax cos (bx ) eax ( A sin (bx )+B cos(bx ))

Laplace Transforms

If y=f ( x ) is defined at all positive values of x , the Laplace transform denoted by Y ( s ) is given by

Y ( s )=L {f ( x )}=∫0

e−sx f ( x )dx (35)

where s is a parameter, which can be a real or complex number. We can get back f ( x ) by

taking the inverse Laplace transform of Y ( s ).L−1{Y (s )}=f ( x ) (36)

Laplace transforms are very useful in solving differential equations. They give the solution directly without the necessity of evaluating arbitrary constants separately.

The following are Laplace transforms of some elementary functions

Page 15: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

L(1)=1s

L( xn )= n !

sn+1, where n=0,1,2,3 .. . .

L(eax )= 1s−a

L(sin ax )= a

s2+a2

L(cos ax )= s

s2+a2

L(sinh ax )= a

s2−a2

L(cosh ax )= s

s2−a2 (37)

The following are the inverse Laplace transforms of some common functions

L−1( 1s )=1

L−1( 1s−a )=eax

L−1( 1sn )= xn−1

(n−1 )! , where n=1,2,3 .. .. ..

L−1( 1( s−a )n )= eax xn−1

(n−1 )!

L−1( 1

s2+a2 )=1a

sin ax

L−1( s

s2+a2 )=cos ax

L−1( 1

s2−a2)=1a

sinh ax

L−1( s

s2−a2)=cosh at

L−1( 1

( s−a )2+b2 )=1b

eax sin bx

L−1( s−a

( s−a )2+b2 )=eax cosbx

L−1( s

( s2+a2)2 )= 12a

x sin ax

(38)

Page 16: Primer for ordinary differential equations

Properties of Laplace transforms

Linear property

If a ,b , c are constants and f ( x ) , g( x ), and h( x ) are functions of x thenL[ af ( x )+bg (x )+ch( x ) ]=aL( f (x ))+bL( g( x ))+cL(h( x ) ) (39)

Shifting propertyIf

L {f ( x )}=Y ( s ) (40)then

L {eat f (x )}=Y (s−a) (41)Using shifting property we get

L (eax xn)= n!

(s−a )n+1, n≥0

L (eax sin bx )= b

( s−a )2+b2

L (eax cosbx )= s−a

(s−a )2+b2

L (eax sinh bx )= b

( s−a )2−b2

L (eax cosh bx )= s−a

(s−a )2−b2 (42)

Scaling propertyIf

L {f ( x )}=Y ( s ) (43)then

L {f (ax )}=1a

Y ( sa )

(44)

Laplace transforms of derivatives

If the first n derivatives of f ( x ) are continuous then

L {f n( x )}=∫0

e−sx f n( x )dx (45)

Using integration by parts we get

∫0

e−sx f n ( x )dx=¿ [e− sx f n−1( x )−(−s )e−sx f n−2 ( x )¿ ]¿¿

¿¿¿

¿¿

Page 17: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

=−f n−1(0 )−sf n−2 (0)−s2 f n−3 (0)−.. .. . .. .. . .. .−sn−1 f (0)+sn∫0

e−sx f ( x )dx

=snY (s )−f n−1(0 )−sf n−2 (0 )−s2 f n−3 (0 )−.. . .. .. .−sn−1 f (0) (46)

Laplace transform technique to solve ordinary differential equations

The following are steps to solve ordinary differential equations using the Laplace transform method(A) Take the Laplace transform of both sides of ordinary differential equations.

(B) Express Y ( s ) as a function of s .(C) Take the inverse Laplace transform on both sides to get the solution.

Let us solve Examples 1 through 4 using the Laplace transform method.

Example 6

Solve

3dydx

+2 y=e−x

, y (0 )=5Solution

Taking the Laplace transform of both sides, we get

L(3 dy

dx+2 y )=L (e−x )

3[ sY (s )− y (0) ]+2 Y ( s )= 1s+1

Using the initial condition, y (0 )=5 we get

3[ sY (s )−5 ]+2Y (s )= 1s+1

(3 s+2)Y ( s )= 1s+1

+15

(3 s+2)Y ( s )=15 s+16s+1

Y ( s )=15 s+16( s+1)(3 s+2 )

Writing the expression for Y ( s ) in terms of partial fractions15 s+16( s+1 )(3 s+2 )

= As+1

+ B3 s+2

15 s+16( s+1 )(3 s+2 )

=3 As+2 A+Bs+B( s+1 )(3 s+2)

15 s+16=3 As+2 A+Bs+B

Equating coefficients of s1

and s0

gives

Page 18: Primer for ordinary differential equations

3 A+B=152 A+B=16

The solution to the above two simultaneous linear equations isA=−1B=18

Y ( s )= −1s+1

+183 s+2

= −1

s+1+ 6

s+0. 666667Taking the inverse Laplace transform on both sides

L−1{Y (s )}=L−1( −1s+1 )+ L−1( 6

s+0 .666667 )Since

L−1( 1s+a )=e−at

The solution is given by

y ( x )=−e−x+6 e−0. 666667 x

Example 7Solve

2dydx

+3 y=e−1 .5 x

, y (0 )=5Solution

Taking the Laplace transform of both sides, we get

L(2 dy

dx+3 y )=L (e−1. 5 x )

2[ sY (s )− y (0) ]+3 Y ( s )= 1s+1. 5

Using the initial condition y (0 )=5 , we get

2[ sY (s )−5 ]+3Y (s )= 1s+1 .5

(2 s+3)Y ( s )= 1s+1. 5

+10

(2 s+3)Y ( s )=10 s+16s+1 .5

Y ( s )=10 s+16( s+1 .5 )(2 s+3)

=10 s+16

2( s+1 .5 )(s+1 .5 )

=10 s+16

2( s+1 .5 )2

Page 19: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

= 5 s+8

( s+1 .5)2

Writing the expression for Y ( s ) in terms of partial fractions5 s+8

( s+1 .5 )2= A

s+1.5+ B

(s+1 .5 )2

5 s+8

( s+1 .5 )2= As+1.5 A+B

( s+1 .5)2

5 s+8=As+1.5 A+B

Equating coefficients of s1

and s0

givesA=51 .5 A+B=8

The solution to the above two simultaneous linear equations isA=5B=0 .5

Y ( s )= 5s+1.5

+ 0 .5

(s+1.5 )2

Taking the inverse Laplace transform on both sides

L−1{Y (s )}=L−1( 5s+1 . 5 )+L−1( 0 . 5

(s+1. 5)2 )Since

L−1( 1s+a )=e−ax

and L−1( 1

(s+a )2 )=xe−ax

The solution is given by

y ( x )=5e−1 .5 x+0 .5 xe−1 . 5 x

Example 8

Solve

2d2 ydx2

+3dydx

+3 .125 y=sin x,

y (0 )=5 , dydx

(x=0)=3

Solution

Taking the Laplace transform of both sides

L(2 d2 ydx2

+3dydx

+3 .125 y)=L (sin x )

and knowing

L( d2 ydx2 )

=s2Y ( s )−sy (0 )−dy

dx( x=0 )

Page 20: Primer for ordinary differential equations

L( dydx )=sY ( s)− y (0 )

L(sin x )= 1

s2+1 we get

2[ s2 Y ( s )−sy (0 )−dydx

( x=0)]+3 [ sY ( s )− y (0 )]+3. 125 Y (s )= 1

s2+1

2 [s2Y ( s )−5 s−3 ]+3 [ sY ( s )−5 ]+3 . 125Y (s )= 1

s2+1

[ s (2 s+3 )+3 .125 ]Y ( s )−10 s−21= 1

s2+1

[ s (2 s+3 )+3 .125 ]Y ( s )= 1

s2+1+10 s+21

[2 s2+3 s+3 . 125 ]Y (s )=22+10 s3+10 s+21 s2

(s2+1)

Y ( s )=10 s3+21 s2+10 s+22

(s2+1 ) (2 s2+3 s+3. 125 )Writing the expression for Y ( s ) in terms of partial fractions

As+B

(2 s2+3 s+3 .125 )+ Cs+D

(s2+1 )=10 s3+21 s2+10 s+22

( s2+1 ) ( 2 s2+3 s+3 .125 )As3+ As+Bs2+B+2 Cs3+3 Cs2+3 . 125Cs+2 Ds2+3 Ds+3 . 125 D

(2 s2+3 s+3 . 125 ) ( s2+1 )

=10 s3+21 s2+10 s+22

( s2+1 ) (2 s2+3 s+3 .125 )( A+2 C ) s3+( B+3C+2 D ) s2+( A+3 . 125 C+3 D ) s+( B+3 .125 D )( s2+1 ) (2 s2+3 s+3 .125 )

=10 s3+21 s2+10 s+22

( s2+1 ) (2 s2+3 s+3 .125 )Equating terms of s

3, s

2 , s1 and s

0 gives

A+2C=10B+3C+2 D=21

A+3 .125 C+3 D=10 B+3 .125 D=22The solution to the above four simultaneous linear equations is

A=10.584474 B=21 .657534 C=−0 .292237 D=0.109589Hence

Page 21: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

Y ( s )=10 .584474 s+21. 657534

2 s2+3 s+3 . 125+−0. 292237 s+0 .109589

s2+1

(2 s2+3 s+3 . 125 )=2{( s2+1. 5 s+0 .5625 )+1}=2 {(s+0 .75 )2+1}

Y ( s )=

10 .584474 ( s+0 .75)+13 .719179

2 {(s+0 .75 )2+1}+−0 .292237 s+0 .109589

s2+1

=

5 .292237 (s+0 .75 ){(s+0 .75 )2+1}

+ 6 .859589{(s+0 .75)2+1}

−0 .292237 s( s2+1)

+ 0 .109589(s2+1 )

Taking the inverse Laplace transform of both sides

L−1{Y (s )}=L−1(5. 292237 (s+0 .75 ){(s+0 .75 )2+1} )+L−1¿¿

¿

¿

L−1{Y (s )}=5 . 292237 L−1(s+0 . 75

{( s+0 . 75)2+1} )+6 . 859589 L−1¿¿

¿¿

Since

L−1( s+a

( s+a )2+b2 )=e−ax cos bx

L−1( b

( s+a )2+b2 )=e−ax sin bx

L−1( 1

s2+a2 )=sin ax

L−1( s

s2+a2 )=cos ax

The complete solution is

y ( x )=5.292237 e−0 .75 x cos x+6 .8595859 e−0 . 75 x sin x −0 . 292237 cos x+0 .109589 sin x

=e−0 .75 x (5 .292237 cos x+6.859589 sin x )−0 .292237 cos x+0 .109589 sin x

Example 9

Solve

2d2 ydx2

+6dydx

+3.125 y=cos x,

y (0 )=5 , dydx

(x=0)=3

Solution

Taking the Laplace transform of both sides

Page 22: Primer for ordinary differential equations

L(2 d2 ydx2

+6dydx

+3 .125 y )=L (cos x )

and knowing

L( d2 ydx2 )

=s2Y ( s )−sy (0 )−dy

dx( x=0 )

L( dydx )=sY ( s)− y (0 )

L(cos x )= s

s2+1we get

2[ s2 Y ( s )−sy (0 )−dydx

( x=0)]+6 [sY ( s )− y (0 )]+3 .125 Y ( s )= s

s2+1

2 [s2Y ( s )−5 s−3 ]+6 [sY (s )−5 ]+3 . 125 Y (s )= s

s2+1

[ s(2 s+6 )+3.125 ]Y (s )= s

s2+1+10 s+36

[2 s2+6 s+3 .125 ] Y (s )=36+10 s3+11 s+36 s2

s2+1

Y ( s )=10 s3+36 s2+11 s+36

(s2+1 ) (2 s2+6 s+3 .125 )Writing the expression for Y ( s ) in terms of partial fractions

As+B

(2 s2+6 s+3 . 125 )+ Cs+D

( s2+1 )=10 s3+36 s2+11 s+36

( s2+1 ) (2 s2+6 s+3 . 125 )

As3+ As+Bs2+B+2 Cs3+6 Cs2+3 . 125 Cs+2 Ds2+6 Ds+3 .125 D

(2 s2+6 s+3. 125 ) ( s2+1 )

=10 s3+36 s2+11 s+36

( s2+1 ) (2 s2+6 s+3 . 125 )

( A+2 C ) s3+( B+6C+2 D ) s2+( A+3. 125C+6 D ) s+( B+3 . 125D )( s2+1 ) (2 s2+6 s+3 .125 )

=10 s3+36 s2+11 s+36

( s2+1 ) (2 s2+6 s+3 . 125 )Equating terms of s

3,s

2 , s1 and s

0 gives

A+2C=10B+6 C+2 D=36A+3 .125 C+6 D=11B+3 .125 D=36

The solution to the above four simultaneous linear equations is A=9 .939622

Page 23: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

B=35 . 496855C=0 . 0301886

Then

Y ( s )=9 .939622 s+35 . 496855

2 s2+6 s+3 . 125+ 0. 0301886 s+0 . 161006

s2+1(2 s2+6 s+3. 125 )=2 {(s2+3 s+2 .25 )−0 . 6875}=2 {(s+1. 5 )2−0 . 8291562}

Y ( s )=9 .939622( s+1 . 5)+20 . 587422

2 {(s+1. 5 )2−0 .8291562}+ 0 .0301886 s+0 .161006

s2+1

=4 .969811( s+1 .5 ){( s+1 .5 )2−0 .8291562}

+10 .293711{( s+1 .5 )2−0 .8291562}

+0 . 0301886 ss2+1

+0 .161006s2+1

Taking the inverse Laplace transform on both sides

L−1{Y (s )}=L−1(4 . 969811(s+1. 5){(s+1.5 )2−0 . 8291562} )+L−1¿¿

¿

¿

=4 . 969811 L−1( (s+1.5)(s+1. 5)2−0 . 8291562 )+10 .293711 L−1 ( 1

(s+1. 5 )2−0 . 8291562 )+0 . 0301886 L−1( s

(s2+1))+0. 161006 L−1( 1

(s2+1) )Since

L−1( s+a

( s+a )2−b2 )=e−ax coshbx

L−1( 1

( s+a )2−b2 )=1b

e−ax sinh bx

L−1( 1

s2+a2 )=1a

sin ax

L−1( s

s2+a2 )=cos ax

The complete solution is

y ( x )=4 .969811e−1. 5 x cosh (0 .829156 x )+10 .2937110 . 829156

e−1. 5 x sinh(0 .829156 x )

+0 .0301886 cos x+0 .161006 sin x

=e−1. 5 x (4 .969811(e0 .829156 x+e−0. 829156 x

2 )+12 .414685(e0 .829156 x−e−0 .829156 x

2 )) +0 . 030188 cos x+0. 161006 sin x

161006.0D

Page 24: Primer for ordinary differential equations

=e−1.5 x ( 8. 692248 e0.829156 x−3 .722437 e−0 .829156 x )+0 .0301886 cos x +0 .161006 sin x

Example 10

Solve

2d2 ydx2

+5dydx

+3 . 125 y=e− x sin x,

y (0 )=5 , dydx

(x=0)=3

Solution

Taking the Laplace transform of both sides

L(2 d2 ydx2

+5dydx

+3 .125 y)=L ( e−x sin x )

knowing

L( d2 ydx2 )

=s2Y ( s )−sy (0 )−dy

dx( x=0 )

L( dydx )=sY ( s)− y (0 )

L(e− xsin x )= 1

(s+1)2+1we get

[ s (2 s+5 )+3 .125 ]Y ( s )−10 s−31= 1

(s+1)2+1

[ s(2 s+5 )+3 .125 ] Y (s )= 1

(s+1)2+1+10 s+31

[2 s2+5 s+3 .125 ]Y (s )=63+10 s3+82 s+51 s2

s2+2 s+2

Y ( s )=10 s3+51 s2+82 s+63

(s2+2 s+2 ) (2 s2+5 s+3 . 125 )

Writing the expression for Y ( s ) in terms of partial fractionsAs+B

2 s2+5 s+3 .125+ Cs+D

s2+2 s+2=10 s3+51 s2+82 s+63

(s2+2 s+2 ) (2 s2+5 s+3 . 125 )

1)1(

1)(125.35)(535)(2

1)1(

1)(125.3)0()(5)0()0()(2

22

22

ssYssYssYs

ssYyssYx

dx

dysysYs

Page 25: Primer for ordinary differential equations

Primer for Ordinary Differential Equation

2 Cs3+5 Cs2+3 . 125Cs+2 Ds2+5 Ds+3 . 125 D+ As3+2 As2+2 As+Bs2+2 Bs+2 B

(2 s2+5 s+3 . 125 ) ( s2+2 s+2 )

=10 s3+51 s2+82 s+63

( s2+2 s+2 ) (2 s2+5 s+3 .125 )(2C+ A ) s3+(5C+2 D+2 A+B ) s2+(3 .125 C+5 D+2 A+2 B ) s+(3 .125 D+2 B )( s2+2 s+2 ) ( 2 s2+5 s+3 .125 )

=10 s3+51 s2+82 s+63

( s2+2 s+2 ) (2 s2+5 s+3 .125 )Equating terms of s

3,s

2 , s1 and s

0 gives four simultaneous linear equations

2 C+ A=10 5C+2 D+2 A+B=51 3 .125C+5 D+2 A+2B=82 3 .125 D+2 B=63The solution to the above four simultaneous linear equations is

A=10. 442906B=32 .494809C=−0 .221453D=−0 .636678

Then

Y ( s )=10 . 442906 s+32 .494809

2 s2+5 s+3 . 125+−0 .221453 s−0 .636678

s2+2 s+2

(2 s2+5 s+3 . 125 )=2{( s2+2. 5 s+1. 5625 )}=2(s+1. 25 )2

Y ( s )=

10 .442906( s+1 .25)+19 .441176

2( s+1 . 25)2+−0. 221453( s+1 )−0 .415225

( s+1 )2+1

=

5 .221453( s+1 . 25)( s+1 .25 )2

+ 9. 720588(s+1 .25 )2

−0 .221453 (s+1)

(s+1)2+1−0 .415225

(s+1)2+1Taking the inverse Laplace transform on both sides

L−1{Y (s )}=L−1(5.221453( s+1 .25 ) )+L−1(9 .720588

( s+1 .25 )2 ) −L−1 (0 .221453 (s+1)

( s+1 )2+1 )−L−1 (0 .415225

( s+1 )2+1 ) =5 .221453 L−1 (1( s+1 .25) )+9 . 720588 L−1(1(s+1. 25)2 ) −0 .221453 L−1((s+1)

(s+1)2+1 )−0 . 415225 L−1 (1( s+1)2+1 )Since

L−1( s+a

( s+a )2+b2 )=e−ax cos bx

Page 26: Primer for ordinary differential equations

L−1( b

( s+a )2+b2 )=e−ax sin bx

L−1( 1s+a )=e−ax

L−1( 1(s+a )n )= e−ax xn−1

(n−1 )!The complete solution is

y ( x )=5.221453 e−1.25 x+9 .720588 e−1.25 x x−0 .221453 e− x cos x −0 . 415225 e− x sin x =e−1. 25 x (5. 221453+9.720588 x )+ex(−0 . 221453 cos x−0 . 415225 sin x )

Page 27: Primer for ordinary differential equations

Primer for Ordinary Differential Equation