ORDINARY DIFFERENTIAL EQUATIONS AKEJU A.O University of Ibadan Department of Mathematics 1 Course Outline 1. Introduction 2. Derivation of Differential Equations 3. Techniques for Solving Order 1 Linear and Non-Linear 4. Techniques for Solving Order 2 Linear and Non-Linear 5. Techniques for Solving nth Order Linear Equations 6. Finite Difference/Difference Equations 7. Numerical Differentiation/Integration: Interpolations, Errors. Reference Materials 1. Ordinary Differential Equations and Applications by E.O. Ayoola 2. Schaum’s Outline Series of Differential Equations by Frank Ayres JR 3. Elementary Differential Equations by Earl D. Rainville 4. Numerical Analysis by Ian Jacques and Collin Judd 5. Engineering Mathematics by K. A. Stroud Chapter 1 Introduction An ODE is an equation that involves the unknown dependent function and their derivatives which involve coefficients that are functions of the independent variables. Definition:ORDER The order of a differential equation is the highest derivative present in the differential equation Definition : DEGREE The degree of a differential equation is the highest power present in the equation Definition:LINEAR DIFFERENTIAL EQUATIONS A D.E is called linear if there is no product of the dependent variable (function) and it derivative,and neither the function or its derivative occurs to any power other than the first power Definition:NON LINEAR DIFFERENTIAL EQUATIONS If the differential equation is not linear,it is called non linear differential equation 2 3 Definition: SOLUTION A solution to a differential equation on the interval a ≤ x ≤ b is any function y(x) which satisfies the differential equation in question on the interval a≤x≤b Solution are often accompanied by interval and these intervals can impart some important information about the solution The solution of ODE are classified into (1)General Solution and (2)Particular Solution Definition:INITIAL CONDITION(S) This is a condition or set of conditions on the solution that allow us to determine the particular solution and which solution that we are after.Initial Condition are values of the solution and its derivative at specific points.The number of I.C required for the solution of a certain differential equation will depend on the order of the D.E Definition:INITIAL VALUE PROBLEM An initial value problem (IVP) is a differential equation along with an appropriate number of initial conditions Examples are: • dy = cosx dx order 1, linear equation, (y is dependent variable, x is independent variable) 4 • d2 y + k2y = 0 2 dx order 2, linear equation, (y is dependent variable, x is independent variable) • d3 x dx + x − 4xy = 0 dy 3 dy order 3, linear equation, (x is dependent variable, y is independent variable) • ( dw d2 w 3 ) − xy +w =0 dx2 dx order 2, degree 3, non linear equation,(w is dependent variable, x is independent variable) When an equation involves one or more derivatives with respect to a particular variable, that variable is called an independent variable. ∂ 2v ∂ 2v + =0 ∂x2 ∂y 2 PDE order 2, V is dependent, x and y are independent variable Generally, the equation F (x, y, y 0 , y 00 , . . . , y (n) ) = 0 (1.1) 5 is called an n th-order ODE. Equation (1.1) can be solved explicitly for y (n) in terms of the other n + 1 variables x, y, y0, y 00 , . . . , to obtain y (n) = f (x, y, y 0 , y 00 , . . . , y (n−1) ) (1.2) ODE arises from geometric, physical, biological problems (e.t.c.) Illustration If the population of a country doubles in 50 years, in how many years will it become triple under the assumption that the rate of increase is proportional to the number of inhabitants? Solution: Let y denote the population at time t years and y0 the population at time t = 0. Then dy dy dy ∝ y =⇒ = ky =⇒ = kdt. dt dt y where k is constant. Integrating both sides,we have ln y = kt + ln c y = cekt At time t = 0, y = y0 =⇒ y0 = ce0 =⇒ y0 = c =⇒ y = y0 ekt . At time t = 50 years, y = 2y0 , 2y0 = y0 e50 k , 2 = e50k 6 when y = 3y0 , 3 = ekt so 350 = e50kt = (e50k )t = 2t 350 = 2t =⇒ t = 79years. Exercises State the type, linearity, order ,independent and dependent variables of the following equations: 1. d2 x + k2x = 0 2 dt 2. (x2 + y 2 )dx + 2xydy = 0 3. ( d3 w 2 dw ) − 2( )4 + yw = 0 3 dx dx 4. 2 ∂ 2w 2∂ w = a ∂t2 ∂x2 5. x(y 00 )3 + (y 0 )4 − y = 0 Chapter 2 Derivative of ODE Just as a function can be obtained as a solution of any given differential equation, the reverse process can be carried out by obtaining an ODE from a given function through the process of eliminating some constants that appear in such functions. Examples: Form a DE by eliminating the constant(s) in the following equations: 1. y = Ax Solution: y0 = dy y dy = A =⇒ = y0 = dx dx x 2. y = Ax + B Solution: y 0 = A, y 00 = 0 but y0 = y − B 00 xy 0 − y + B ,y = x x2 7 8 3. y = Ax2 + Bx + c Solution: y 0 = 2Ax + B y 00 = 2A y 000 = 0 [free or arbitrary constants] 4. y = A cos ax + B sin ax Solution: y 0 = −Aa sin ax + Ba cos ax y 00 = −Aa2 cos ax − Ba2 sin ax = −a2 (A cos ax + B sin ax) = −a2 y y 00 + a2 y = 0 5. y = x + A x = x + Ax−1 Solution y 0 = 1 − Ax−2 but A x = y − x =⇒ A = x(y − x) = y 0 = 1 − x y−x x2 x−y+x x = 2x−y x Exercise Form a differential equation from these functions • y = Ax2 + Bx • y = −Asinx + Bcosx • y = c1 e3x + c2 e2x + c3 ex 9 Note: A function with 1 arbitrary constant gives a 1st order equation. A function with 2 arbitrary constants gives a 2nd order equation. A function with n arbitrary constant gives a n-th order equation. Chapter 3 Technique for Solving Order 1 Linear and Non Linear ODE We shall classify this into five categories as follows; • Separation of Variable • Homogeneous type • Exact type • Non exact type • Bernoulli equation 3.1 Separation of Variable If a first order ODE of the form dy = f (x)g(y) dx can be written in the form dy = f (x)dx g(y) 10 11 then the equation is a separable equation where f (x) and g(y) are given functions of the independent variable and the dependent variable respectively. Examples • dy = 2xy 2 dx • y −1 dy (x + 1)−1 dx • (3y 2 + ey ) dy = cosx dx • (x + 1) dy = 2y dx Examples Solve the following differential equations (1) 1+y dy = dx 2+x Solution This equation can be written in the separable form as 1 dy 1 = 1 + y dx 2+x Integrating both sides ,we have Z Z dy dx = 1+y 2+x 12 Hence,we have ln(1 + y) = ln(2 + x) + C = ln(2 + x) + lnA If we simplify ,we have ln(1 + y) = lnA(2 + x) Then we get y(x) = A(2 + x) − 1 where A is an arbitrary constant (2) dy = 2xy 2 dx Solution This equation can be written in the separable form as y −2 dy = 2xdx Integrating both sides,we have Z −2 y dy = Z 2xdx Hence,we have −1 = x2 + C y If we simplify ,we get y(x) = − 1 x2 + C where C is an arbitrary constant of integration 13 3.2 Homogeneous Type A differential equation of the form dy dx = f (x, y) is said to be homogeneous of degree n in x and y if and only if the function f(x,y) defined for all (x, y) ∈ R2 has the behaviour defined as follow; f (tx, ty) = tn f (x, y) ∀t Examples (1) The differential equation y dy x4 = 2y 3 e x − dx x + 3y is a homogeneous equation of order 3 since the function y f (x, y) = 2y 3 e x − x4 x + 3y is such that ty f (tx, ty) = 2t3 y 3 e tx − y = t3 [2y 3 e x − t4 x4 tx + 3ty x4 ] x + 3y = t3 f (x, y) (2) The differential equation dy = x3 y 2 − 3x5 dx is a homogeneous equation of order 5 since the function f (x, y) = x3 y 2 − 3x5 14 is such that f (tx, ty) = t3 x3 t2 y 2 − 3t5 x5 = t5 [x3 y 2 − 3x5 ] = t5 f (x, y) The solution of the homogeneous type required a change of variable y = vx that reduces the equation to the variable separable type of equation.Once this this is obtained,we can then use the separation of variable technique to solve the problem. Examples Solve the following differential equations (1) dy x2 + y 2 = dx xy Let y = vx =⇒ v = y x So that dy dv =v+x dx dx But dy x2 + v 2 x2 1 + v2 = = dx x2 v v This means that v+x dv 1 + v2 = dx v If we simplify this above equation ,we have x dv 1 = dx v 15 Integrating both sides of the equation ,we have Z vdv = Z dx x This gives v2 = ln x + c =⇒ v 2 = ln x2 + 2c 2 After further simplification,we have y 2 = x2 (ln x + 2c) So that √ y = x ln x2 + A (2) x + 3y dy = dx 2x Let y = vx =⇒ v = y x So that dv dy =v+x dx dx But dy x + 3xv 1 + 3v = = dx 2x 2 This means that v+x dv 1 + 3v = dx 2 16 If we simplify the above equation,we have x 1+v dv = dx 2 Integrating both sides of the equation ,we have Z Z 2 dx dv = 1+v x This gives 2 ln(1 + v) = ln x + c where c = ln A After further simplification,we have y (1 + v)2 = Ax =⇒ (1 + )2 = Ax =⇒ (x + y)2 = Ax3 x So that √ y= Ax3 − x Exercise Solve the following differential equations: dy 1. x2 + y 2 dx = xy dy = xy − y 2 2. (x2 + xy) dx dy 3. (x − y) dx =x+y 3.3 The Exact Type The equation we shall concern ourselves with here are either of the form: y 0 = F (x, y) (3.1) M (x, y)dx + N (x, y)dy = 0 (3.2) or 17 Example (sin(x + y))dx + (x + 2y)dy = 0 may be written as y0 = dy sin(x + y) =− dx x + 3y . Definition 3.3.1. Let F be a function of 2 variables such that F has 1st partial derivatives in the domain D. Then, the total differential equations of F ; dF (x, y) = ∂F (x, y) ∂F (x, y) dx + dy ∀x, y ∈ D ∂x ∂y (3.3) Example: Let F (x, y) = xy 2 + 2x3 y so that ∂F (x, y) dx = y 2 + 6x2 y, ∂x ∂F (x, y) dy = 2xy + 2x3 ∂y Hence, dF (x, y) = y 2 + 6x2 y + 2xy + 2x3 From (3.3), dF (x, y) = M (x, y)dx + N (x, y)dy then we can write ∂F = M (x, y), ∂x ∂F = N (x, y) ∂y (3.4) Theorem 3.3.1. Consider equation (3.2), where M and N have 1st partial derivatives in (x, y) ∈ D. Then, the DE (3.2) is exact in D iff ∂M ∂N = ∂y ∂x ∀ (x, y) ∈ D (3.5) 18 But M = ∂F ∂x and N = ∂F , ∂y then ∂ ∂M = ∂y ∂y ∂F ∂x ! ∂N ∂ = ∂x ∂x ∂F ∂y ! = ∂ 2F ∂y∂x = ∂ 2F ∂x∂y Equation (3.6) confirms (3.5) Consider y 2 dx + 2xydy = 0 where M (x, y) = y 2 , N (x, y) = 2xy so that ∂M = 2y, ∂y ∂N = 2y ∂x Since ∂M ∂N = = 2y ∂y ∂x Then the given DE is an exact DE ∀ (x, y) ∈ D. Exercise: Verify whether the following differential equations are exact or not: 1. x2 dx + 2xydy = 0 2. ydx + 2xdy = 0 19 Theorem 3.3.2. Suppose (2.2) satisfies the differentiability requirement of theorem (2.1) and its exact in (x, y) ∈ D, then the solution of the differential equation (2.2) is given as F (x, y) = c (3.6) where F is a function satisfying (2.4) and c is any arbitrary constant or function. Example 1: Solve the DE (3x2 + 4xy)dx + (2x2 + 2y)dy = 0 Solution: M (x, y) = 3x2 + 4xy, N (x, y) = 2x2 + 2y and ∂M = 4x, ∂y ∂N = 4x ∂x Hence, the DE is exact. ∂F = 3x2 + 4xy ∂x =⇒ F = Z 3x2 + 4xydx So, F = x3 + 2x2 y + Φ(y), (Φ is a f unction of In other to know the value of Φ , we find ∂F = 2x2 + Φ0 (y) ∂y y) 20 But ∂F = N (x, y) = 2x2 + 2y ∂y Therefore 2x2 + 2y = 2x2 + Φ0 (y) = ∂F ∂y and Φ0 (y) = 2y, =⇒ Φ(y) = y 2 + c F = x3 + 2x2 y + y 2 + c c at this level is optional. Example 2: Solve the DE (2x cos y + 3x2 y)dx + (x3 − x2 sin y)dy Solution: M (x, y) = 2x cos y + 3x2 y, N (x, y) = x3 − x2 sin y and ∂M = −2x sin y + 3x2 , ∂y ∂N = 3x2 − 2x sin y ∂x Hence the differential equation is exact ∂F = 2x cos y + 3x2 y, ∂x =⇒ F = Z 2x cos y + 3x2 ydx So F = x2 cos y + +x3 y + φ(y) 21 In other to evaluate the value of Φ ,we find ∂F = −x2 sin y + x3 + φ0 (y) ∂y But ∂F = N (x, y) = x3 − x2 sin y ∂y Therefore x3 − x2 sin y = −x2 sin y + x3 + φ0 (y) and φ0 (y) = 0, =⇒ φ(y) = 0 Hence F = x2 cos y + x3 y Example 3: Solve the D.E 3x(xy − 2)dx + (x3 + 2y)dy = 0 Solution M (x, y) = 3x2 y − 6x, ∂M = 3x2 , ∂y N (x, y) = x3 + 2y ∂N = 3x2 ∂x Hence the differential equation is exact ∂F = 3x2 y − 6x, ∂x =⇒ F = Z 3x2 y − 6xdx So F = x3 y − 3x2 + φ(y) 22 In other to evaluate the value of Φ ,we find ∂F = x3 + φ0 (y) ∂y But ∂F = N (x, y) = x3 + 2y ∂y Therefore x3 + 2y = x3 + φ0 (y) and φ0 (y) = 2y, =⇒ φ(y) = y 2 Hence F (x, y) = x3 y − 3x2 + y 2 The general solution F (x, y) = C , ⇒ x3 y − 3x2 + y 2 = C Exercise (1) Determine which of the following differential equations are exact and Solve those that are exact (a.) (3x2 y + 2)dx − (x3 − y)dy = 0 (b.) (θ2 + 1) cos rdr + 2θ sin rdθ = 0 (c.) (2y sin x cos x + y 2 sin x)dx + (sin2 x − 2y cos x)dy = 0 (d.) ydx + (x2 y − x)dy = 0 (e.) y dx x2 + (y − x1 )dy (2.) Determine the value of constant A which the equations below are exact 23 (a.) (x2 + 3xy)dx + (Ax2 + 4y)dy = 0 (b.) ( x12 + 3.4 1 )dx y2 + ( Ax+1 )dy = 0 y3 Non-Exact Equation To Exact Equation Observe that the D.E ydx + (x2 y − x)dy = 0 is not exact i.e ∂N ∂M 6= ∂y ∂x However, if we multiply the equation by 1/x2 for instance, then we have y 1 dx + (y − )dy = 0 2 x x which is exact (observe) Generally, if M (x, y)dx + N (x, y)dy = 0 is not exact, it is possible to make it exact by multiplying the equation with a specific function that will make the equation exact.This function is called Integrating factor. Consider a Linear Differential equation of order 1 of the form dy + Py = Q dx (3.7) where P and Q are functions of x or constant Equation(3.7) is not exact, but it can be solved using Integrating factor which is always e R pdx 24 Example 1 Solve the D.E dy + 3y = e2x dx Solution Compare this with (3.7), then, we observe that P = 3, Q = e2x then I.F = e R 3dx = e3x Multiply the given D.E by I.F, we have e3x dy + e3x 3y = e5x dx Observe that the LHS is the differential coefficient of ye3x i.e d dy (ye3x ) = e3x + e3x 3y dx dx Hence d (ye3x ) = e5x dx Integrating both sides, we have 3x ye = Z e5x dx = e5x +C 5 Divide both sides by e3x ,we have y= e2x + Ce−3x 5 25 Example 2 Solve the D.E y0 − y = x Solution Compare with (3.7), P = −1, Q = x, then R I.F = e −1dx = e−x Multiply the given D.E by I.F ,we have e−x dy − e−x y = xe−x dx Observe that the LHS is the differential coefficient of ye−x i.e d dy (ye−x ) = e−x − e−x y dx dx Hence d (ye−x ) = xe−x dx Integrating both sides,we have ye−x = Z xe−x dx = −e−x (x + 1) + C Using Integration by part Divide both sides by e−x ,we have y = −(x + 1) + Cex = Cex − x − 1 Example3 Solve dy + ycotx = cosx dx 26 Solution Comparing with (3.7), p = cotx , Q = cosx, R cotxdx R cosx dx sinx I.F = e I.F = e = eln sinx = sinx Multiply the given D.E by I.F ,we have sinx dy + ycotxsinx = sinx dy 2 ysinx= cosxsinxdx= sin2 x + c R y= sinx + ccosecx 2 Exercise Solve the following D.E dy + y = (x + 1)2 (1) (x + 1) dx dy (2) (1 − x2 ) dx − xy = 1 dy (3) x dx − 5y = x7 27 3.5 Bernoulli Equation This is a non linear special type of D.E which can be reduced to a linear equation via logical transformation. The equation of the form dy + p(x)y = q(x)y n dx (3.8) is called Bernoulli equation where n ∈ N If n = 0 or n = 1, then(3.8) reduced to a linear equation which can be solved using our previous method(s). It is therefore assume that n 6= 0, 1 for (3.8) to retain its identity as Bernoulli D.E.The solution of this type of D.E require the following transformation, dy + p(x)y = q(x)y n dx Divide (3.8) by y n i.e y −n dy + p(x)y 1−n = q(x) dx (3.9) Let Z = y 1−n (3.10) dz dy = (1 − n)y −n dx dx (3.11) Then Substitute (3.10) and (3.11) in (3.9), we have 1 dz + p(x)z = q(x) 1 − n dx 28 Multiple through by 1 − n,we have dz + (1 − n)p(x)z = (1 − n)q(x) dx This can be written in the form dz + Φ(x)z = Q(x) dx (3.12) where (1 − n)p(x) = Φ(x) and (1 − n)q(x) = Q(x) . Observe that (3.12) is of the form (3.7) which is a linear D.E in variable x and z Example 1 Solve the D.E dy y + = xy 2 dx x Solution: Divide through by y 2 , y −2 dy 1 1−2 + y =x dx x Let z = y 1−2 ..............(3.13) Then dz dy = −y −2 dx dx ..........(3.14) Substitute (3.13) and (3.14) into the given differential equation,we have dz 1 − z = −x dx x 29 The given equation has reduce to linear differential equation that be solve using integrating factor i.e I.F = e R −1 dx x −1 = elnx = x−1 = 1 x Multiply both sides of the last equation by this integrating factor,we have 1 1 dz + 2 z = −1 x dx x Note that the left hand side of the above equation satisfy the differential coefficient z d (+ ) = −1 dx x Integrating both sides,we have Z z = − dx = −x + c x Then z = −x2 + cx Therefore y = (−x2 + cx)− 1 Example 2 Solve the D.E x2 y − x3 dy = y 4 cos x dx Solution: This equation can be re-arrange as dy 1 −y 4 cosx − y= dx x x3 30 Divide through by y 4 , we have y −4 dy 1 cosx − y −3 = 3 ....... + dx x x Let z = y 1−4 = y −3 .......... ∗ So that the derivative dz dy = −3y −4 .......... dx dx ∗∗ Substitute ∗ and ∗∗ in equation +, and divide both sides of the equation by −3 we have 3 dz + z = −3x−3 cosx dx x This is a linear differential equation with variable z and x Where I.F = e R 3 dx x = x3 Multiple the linear equation by the integrating factor ,we have x3 dz + 3x2 z = 3cosx dx Observe that the RHS of above equation is the derivative of So that d 3 (x z) = 3 cos x dx Integrate both sides, we have x3 z = Z 3cosxdx d (x3 z) dx 31 z= 3 sin x + c x3 and x3 x3 y3 = R = [ 3cosxdx] + c 3sinx + c Therefore, y=( 1 x3 )3 3sinx + c Exercise Solve the D.E 2y −3 dy = y 4 e3x dx Chapter 4 Techniques for Solving Second order Linear and Non Linear O.D.E 4.1 Homogeneous Non Linear With Missing Dependent/Independent Variable An equation of the form 0 00 F (x, y, y , y ) = 0 (4.1) is called a second oder O.D.E involving 2nd order derivative of the unknown function y(x) as the highest order. We consider this type of equation under 2 cases Case 1 The case when dependent variable 0 y 0 is missing is of the form 0 00 G(x, y , y ) = 0 Suppose y is the solution of (4.2), then we can set v = 32 (4.2) dy dx such that V becomes 33 a solution of the first order equation 0 G(x, v, v ) = 0 (4.3) If (4.3) is solvable, then the solution of (4.2) can be obtained by integrating v= dy dx Example: Solve the diferential equation x dy dy d2 y = 2([ ]2 − ) 2 dx dx dx This is of the form (4.2) with missing variable y i.e the dependent variable Solution: Let v = dy dx then the equation becomes x dv = 2(v 2 − v) dx Seperating variable,we have dx dv = 2 v2 − v x Appling partial fraction,we have, ( 1 1 dx − )dv = 2 v−1 v x Integrating both sides,we have ln(v − 1) − lnv = 2lnx + lnc Simplify,we have v−1 = cx2 v 34 But v= dy dx then 1− −1 = cx2 v =⇒ dy 1 = dx 1 − c1 x 2 By integration y= 1 + ax 1 ln( ) + c2 2a 1 − ax if C1 ≥ 0 And 1 y = tan−1 bx + c if C1 ≤ 0 b Case 2 The case when independent variable is missing i.e G(y, y 0 , y 00 ) = 0 (4.4) Let v= d2 y dv dv dy dv = = . =v 2 dx dx dy dx dy dy , dx Then we ca write 4.4 as G(y, v, v dy )=0 dx (4.5) (4.5) is a first order D.E for dependent variable v. If (4.5) is solvable then, (3.7) has a solution by solving dy = v(y) dx Example: Solve the D.E d2 y dy dy = ( )2 + 2 2 dx dx dx (4.6) 35 Solution: Since x is missing , then v = dy , dx and yv d2 y dx2 dv = v dy , so (4.6) becomes dv = v 2 + 2v dy This is can be reduce to y dv =v+2 dy Seperate the variable,we have dy dv = v+2 y Solving, we have lnv + 2 = lny + lnc1 = lnc1 y v + 2 = cy and v = c1 y − 2 i.e dy = c1 y − 2 dx Seperate the variables ,we have dy = dx c1 y − 2 Integrate both sides,we have 1 ln(c1 y − 2) = x + c2 c1 so that C1 y − 2 = ec1 x+c = Aec1 x (4.7) 36 Where C = c1 c2 .So C1 y = Aec1 x + 2 Therefore, y= A c1 x 2 e + c1 c1 Exercise Solve the differential equations 2 dy 2 d y (1) y dx 2 + ( dx ) = 0 2 d y dy 2 (2) 2x dx 2 = ( dx ) − 1 4.2 Second order Homogeneous Linear Differential Equation Generally,second order linear Ordinary Differential Equation is of the form a0 (x) d2 y dy + a1 (x) + a2 (x)y = f (x) 2 dx dx (4.8) where a0 , a1 ,a2 are either constant or functions of x and f is a functions of (x) If a0 , a1 and a2 are constant and f = 0, then (4.8) becomes Homogeneous Second Order Linear Differential Equation with constant coefficients i.e a0 d2 y dy + a1 + a2 y = 0 2 dx dx If y1 (x) and y2 (x) are the solutions of (4.9),so also is y(x) = y1 (x) + y2 (x) a solution (4.9) 37 Procedure for solution of (4.9) If a0 = 0 in (4.9),we have the 1st order ordinary differential equation provided a0 and a0 are not equal to zero,so a1 dy + a2 y = 0 dx Divide through by a1 ,we have dy a2 + y=0 dx a1 Let a2 a1 = k ,then we have dy = −ky dx Seperate the variable and intergrate both sides,we have lny = −kx + c, y = e−kx+c = Ae−kx If − k = m then y = Aemx If y is a solution of (4.9),then dy = Amemx , dx d2 y = Am2 emx dx2 Substitute these into equation(4.9),we have a0 Am2 emx + a1 Amemx + a2 Aemx = 0 so Aemx (a0 m2 + a1 m + a2 ) = 0 Hence a0 m2 + a1 m + a2 = 0 (4.10) 38 Equation (4.10) is called the Auxilliary or Characteristics Equation of the differential equation (4.9) The solution of (4.10) can be classify into three i.e (a) Real and distinct solutions (roots) (b) Real and equal solution (roots) (c) Complex solution (roots) Real and Distinct roots Example 1 Consider the differential equation dy d2 y − 3 + 2y = 0 dx2 dx The auxilliary equation is m2 − 3m + 2 = 0 Solve this,we have (m − 1)(m − 2), m1 = 1, m2 = 2 Since the roots of the auxilliary equation are distinct,then the general solution is y(x) = A1 em1 x + A2 em2 x = A1 ex + A2 e2x Example 2 Given the differential equation d2 y dy = −4 + 5 = 0 2 dx dx 39 with auxilliary equation m2 + 4m − 5 = 0 solve this ,we have m1 = 1, m2 = 5 So the general solution is given by y(x) = A1 ex + A2 e−5x Real and Equal (Repeated) roots Example Consider tge differential equation d2 y dy − 6 + 9y = 0 dx2 dx The auxilliary equation is given as, m2 − 6m + 9 = 0 solve this ,we have m1 = 3, m2 = 3 so the general solution is expected to be y(x) = A1 e3x + A2 e3x = (A1 + A2 )e3x = Ae3x (Since the addition of two constant is another constant) But we know that every second order differential equation must have two arbotrary constants,so there must be anotherterm containing a second constant. 40 Thus,we must have two linearly independent solutions as y(x) = Ae3x + Bxe3x (A + Bx)e3x Generally,the general solution of a differential equation whose auxilliary roots are real and repeated is y(x) = (A + Bx)e3x Complex Conjugate roots If the roots of the auxilliary equation are complex conjugate roots such that m1 = α + iβ, m2 = α − iβ then the solution of (4.9) are y1 (x) = A1 e(α+iβ)x , y2 (x) = A2 e(α−iβ)x so that we have y(x) = A1 e(α+iβ)x + Ae(α−iβ)x = A1 eαx eiβ)x + A2 eαx e−iβ)x eαx (A1 eiβ)x + A2 e−iβ)x ) eαx (A1 (cos β + i sin βx) + A2 (cos β + i sin βx) since eiθ = cos θ + i sin θ, e−iθ = cos θ − i sin θ therefore y(x) = eαx [A1 cos βx + A2 cos βx + iA1 sin βx − iA2 sin βx] 41 = eαx [A cos βx + B sin βx] where A1 +A2 = A and i(A1 −A2 ) = B where A and B are arbitrary constants Example Find the general solution of the differential equation y 00 − 2y 0 + 10y = 0 Solution The auxilliary equation associated with above differential equation is given by m2 − 2m + 10 = 0 Solve this ,we have the auxilliary roots as m1 = 1 + 3i, m2 = 1 − 3i This means that α = 1 and β = 3 Therefore ,the general solution of the differential equation is given by y(x) = ex [A cos 3x + B sin 3x] Exercise Solve the following differential equations (1) y 00 − 5y 0 + 6 = 0 (2) y 00 − 8y 0 + 16y = 0 (3) y 00 + cy = 0 if c>0 Initial Value Problem (IVP) 42 The initial value problem is a difeferntial equation with initial condition(s).This initial condition(s) helps us to find the particular solution of the differential equation after obtaining the general solution.We shall illustrate this with the example Example Solve the Initial Value Problem d2 y dy − 6 + 25y = 0, 2 dx dx y(0) = −3, y 0 (0) = −1 Solution The auxilliary equation of the above D.E is m2 − 6m + 25 = 0 Solve this ,we have m1 = 3 + 4i, m1 = 3 − 4i i.e α = 3 ,and β = 4 The general solution therefore is y(x) = e3x (A1 sin 4x + A2 cos 4x) We can find A1 and A2 by using the initial condition −3 = e0 (A1 sin 0 + A2 cos 0) −3 = A2 y 0 (x) = e3x [(3A1 − 4A2 ) sin 4x + (3A2 + 4A1 ) cos 4x) −1 = e0 [(3A1 − 4A2 ) sin 0 + (3A2 + 4A1 ) cos 0) 43 −1 = (3A2 + 4A1 ) −1 = (4A1 − 9) A1 = 2 Therefore ,the particular solution of the differential equation is y(x) = e3x (2 sin 4x − 3 cos 4x) 4.3 Second Order Non Homogeneous Differntial Equation Consider the differential equation of the form a0 (x) d2 y dy + a1 (x) + a2 (x)y = f (x) 2 dx dx (4.11) If f (x) is zero,the equation is homogeneous as previously stated,but if f (x) is not zero,then the equation is Non-Homogenous.The solution of this non homogeneous equation is the addition of the solution of the homogeneous part and the non homogeneous part i.e y(x) = yc (x) + yp (x) where yc (x) is called the complimentary equation and yp (x) is called the particular integral We shall solve this type of differential equation with the following techniques namely • Method of Undertermined Coefficient • Method of Variation of Parameter or Constant 44 • The Operator D method We shall examine these methods one after the other as follows Method of Undertermined Coefficient We shall consider when the function f (x) is of the form (a) Pn (x) (b) Pn (x)eax (c) Pn (x) sin βx (d) Pn (x) cos βx (e) Pn (x) sinh x (f) Pn (x) cosh x We summarize these and the corresponding particular integral on the table below f (x) Pn (x) Pn (x)eax Pn (x) sin βx Pn (x) cos βx yp (x) a0 + a1 x + a2 x2 ....an xn (a0 + a1 x + a2 x2 ....an xn )eax (a0 + a1 x + a2 x2 ....an xn )eax sin bx + (c0 + c1 x + c2 x2 ....cn xn )eax cos bx (a0 + a1 x + a2 x2 ....an xn )eax sin bx + (c0 + c1 x + c2 x2 ....cn xn )eax cos bx This require that we solve the homogeneous part first to get the complimentary function and then the part with f (x) 6= 0 to get the paticular integral Example Solve the differential equation y 00 − 5y 0 + 6y = x2 45 This has auxilliary equation m2 − 5m+ = 0 Solve this to get m = 2, m=3 Therefore the complimentary function is y(x) = A1 e2x + A2 e3x To find the particular integral,we assume the general form of the RHS of the given problemwhich is a polynomial of order 2. so the that, yp (x) = Cx2 + Dx + E where C,D and D are unknown constant to be determine Next,we find the first and the second derivative of the particular intgral and the substitute them into the given problem to find the unknown constants so yp0 = 2Cx + D, yp00 = 2C Substitute these into the given D.E, we have 2C − 5(2Cx + D) + 6(Cx2 + Dx + E) = X 2 6Cx2 + (6D − 10C)x + (2C − 5D + 6E) = x2 46 Equating corresponding coefficients,we have 6C = 1, =⇒ 6D − 10C = 0, 2C − 5D + 6E = 0, C= =⇒ 1 6 5 18 19 E= 108 D= =⇒ So the particular integral for the given D.E is given by 5 19 1 yp (x) = x2 + x + 6 18 108 And the general soution is 1 5 19 y(x) = A1 e2x + A2 e3x + x2 + x + 6 18 108 where A1 and A2 are arbitrary constant that can be determined if the initial conditions are given. Example Solve the D.E y 00 + y 0 = xe2x Solution The auxilliary equation of the homogeneous part is m2 + 1 = 0 If we solve,we get m1 = i, m2 = −i So the complimentary function is yc (x) = A1 sin x + A2 cos x 47 But f (x) is of the form Pn (x)eax where Pn (x) is a polynomial of degree one,so the particular integral is yp (x) = e2x (a + bx) Differentiate the P.I twice and substitute into the given D.E,we have y 0 = e2x (2a + 2bx + b) and y 00 = e2x (4a + 4bx + 4b) substitute these we have, e2x (4a + 4bx + 4b) + e2x (a + bx) = xe2x simplify we have, e2x (4a + 4bx + 4b + a + bx) = xe2x so (5a + 4b + +5bx) = x Equating corresponding coefficients ,we have 5a + 4b = 0, 5b = 1 Solve these simultaneously ,we have a= −4 , 25 b= 1 5 This implies that the particular integral is yp (x) = e2x ( −4 1 + x) 25 5 48 Therefore the general solution of the D.E is given as A1 sin x + A2 cos x + e2x ( −4 1 + x) 25 5 Method of Variation of Parmeters If f (x) is not in any of the form described under the method of undetermined coefficient,then we require another method which is method of variation of parameter,which is more general Consider y 00 + ay 0 + by = f (x) (4.12) If we have two linearly independent solutions y1 and y2 of the homogeneous equation y 00 + ay 0 + by = 0 so that a general solution is given by yc (x) = C1 (x)y1 (x) + C2 y2 with C1 and C2 satisfying the differential C10 (x) = − C20 (x) = − f (x)y2 (x) ) − y2 (x)y10 (x y1 (x)y20 (x) f (x)y1 (x) ) − y2 (x)y10 (x y1 (x)y20 (x) provided the denominator is not zero, where y1 (x)y20 (x) − y2 (x)y10 (x) = |W (y1 , y2 )| 49 is the Wronskian Therefore the general solution will be y(x) = yc (x) + yp (x) Example Solve the differential equation y 00 + y = tan x Solution If we follow the previous discussion,we see that the general solution of this equation is given as yc (x) = A1 cos x + A2 sin x where y1 (x) = cos x and y2 (x) = sin x so C10 (x) = − tan x sin x = cos x − sec x cos x cos x + sin x sin x Integrate both sides we have C1 = Z cos x − sec xdx = sin x − ln| sec x + tan x| Also, C20 (x) = − tan x cos x = − sin x cos x cos x + sin x sin x Integrate both sides we have C2 = Z − sin xdx = cos x 50 This implies that yp (x) = (sin x − ln| sec x + tan x|) cos x + cos x sin x Therefore the general solution of the D.E is y(x) = A1 cos x + A2 sin x + (sin x − ln| sec x + tan x|) cos x + cos x sin x 4.4 Operator D Method Chapter 5 Higher Order Homogeneous and Non Homogeneous Differential Equation 5.1 Homogeneous Type The process of solving this type of differential equation is similar to other homogeneous equation Example 1 Solve the D.E y 000 + 14y 00 + y 0 − 6y = 0 Solution The auxilliary equation of this D.E is m3 + 14m2 + m − 6 = 0 If we solve this ,we have m1 = 1, m2 = −2, 51 m3 = −3 52 Therefore the general solution is y(x) = c1 ex + c2 e−2x + c3 e−3x Example 2 Solve the D.E y iv + 16y 000 + 96y 00 + 256y 0 + 256y = 0 Solution The auxilliary equation of this D.E is m4 + 16m3 + 96m2 + 256m + 256 = 0 If we solve this ,we have m1 = −4, m2 = −4, m3 = −4, m4 = −4 Therefore the general solution is y(x) = c1 e−4x + c2 xe−4x + c3 x2 e−4x + c4 x3 e−4x 5.2 Non Homogeneous Type Consider the nth order non homogeneous equation y n + a1 (x)y n−1 + a2 (x)y n−2 + .... + an (x)y = f (x) (5.1) and it associated homogeneous equation y n + a1 (x)y n−1 + a2 (x)y n−2 + .... + an (x)y = 0 (5.2) 53 If y1 , y2 ....yn are linearly independent solutions of (5.2),then the solutiony(x) of (5.2) is expressed as y(x) = c1 y1 (x) + c2 y2 (x) + .... + cn yn (x) where c1 , c2 ,.....cn are constant If y1 , y2 ....yn are independent solutions of (5.2),then the Wronskian W (y1 , y2 ....yn ) = |y1 , y2 ....yn y10 , y20 ....yn0 ....y1n−1 , y2n−1 ....ynn−1 | |= 0 (5.3) Using the method of Variation of Parameter,we find a solution (Partivular Integral) of the form yp (x) = c1 (x)y1 (x) + c2 (x)y2 (x) + .... + cn (x)yn (x) Differentiating ,we have yp0 (x) = c1 (x)y10 (x)+c01 (x)y1 (x)+c2 (x)y20 (x)+c02 (x)y2 (x)+....+cn (x)yn0 (x)+c0n (x)yn (x) = (c1 (x)y10 (x)+c2 (x)y20 (x)+...+cn (x)yn0 (x))+(c01 (x)y1 (x)+c02 (x)y2 (x)+....+c0n (x)yn (x)) If we set (c01 (x)y1 (x) + c02 (x)y2 (x) + .... + c0n (x)yn (x)) = 0 Then yp0 (x) = c1 (x)y10 (x) + c2 (x)y20 (x) + ... + cn (x)yn0 (x) Differentiating one more time ,we have yp00 (x) = c1 (x)y100 (x)+c01 (x)y10 (x)+c2 (x)y200 (x)+c02 (x)y20 (x)+....+cn (x)yn00 (x)+c0n (x)yn0 (x) = (c1 (x)y100 (x)+c2 (x)y200 (x)+....+cn (x)yn00 (x))+(c01 (x)y10 (x)+c02 (x)y20 (x)+....+c0n (x)yn0 (x)) 54 If we set (c01 (x)y10 (x) + c02 (x)y20 (x) + .... + c0n (x)yn0 (x)) = 0 then we have yp00 (x) = c1 (x)y100 (x) + c2 (x)y200 (x) + .... + cn (x)yn00 (x) If we continue this way,we set c01 (x)y1k (x) + c02 (x)y2k (x) + .... + c0n (x)ynk (x) = 0, k = 0, 1, 2...(n − 1) then we have ypk (x) = c1 (x)y1k (x) + c2 (x)y2k (x) + .... + cn (x)ynk (x), k = 0, 1, 2...(n − 1) and ypn−1 (x) = c1 (x)y1n−1 (x) + c2 (x)y2n−1 (x) + .... + cn (x)ynn−1 (x) so that ypn (x) = (c1 (x)y1n (x)+c2 (x)y2n (x)+....+cn (x)ynn (x))+(c01 (x)y1n−1 (x)+c02 (x)y2n−1 (x)+....+c0n (x)ynn−1 (x)) This represent the nth derivative of yp (x) With all these,we have suceeded in forming a system of n equations in 4n4 unknowns i.e c01 (x)y1 (x) + c02 (x)y2 (x) + .... + c0n (x)yn (x) = 0 c01 (x)y10 (x) + c02 (x)y20 (x) + .... + c0n (x)yn0 (x) = 0 . . . c01 (x)y1n−1 (x) + c02 (x)y2n−1 (x) + .... + c0n (x)ynn−1 (x) = 0 55 The determinant of this system is called WRONSKIAN which is non zero since the funcyions y1 , y2 , ....yn are linearly independent Example Solve the differential equation d3 y dy − 2y = 3e−x + 3 dx3 dx Solution The homogeneuos part has an auxilliary equation given as m3 + 3m − 2 = 0 Solve this,we have the roots m1 = −1, m2 = −1, m3 = 2 and this will have a complimentary function given as yc (x) = A1 e−x + A2 xe−x + A3 e2x where y1 = e−x , y2 = xe−x , so the wronskian is given by w(x)= e−x xe−x e2x −e−x (1 − x)e−x 2e2x e−x (x − 2)e−x 4e2x w(0)= 1 0 1 −1 1 2 1 −2 1 =9 =0 y3 = e2x 56 By Crammer’s rule, 0 xex e2x 0 (1 − x)e−x 2e2x −x 3e (x − 2)e−x 4e2x w1 (x)= e−x 0 e2x −e−x 0 2e2x e−x e−x 4e2x e−x xe−x −x −e (1 − x)e−x e−x (x − 2)e−x w2 (x)= w3 (x)= C10 = w1 w = 9x−3 9 C20 = w2 w = −9 9 C30 = w3 w = 3e−3x 9 C1 = x2 2 − x 3 = 9x 9 − 3 9 = 9x − 3 = −9 0 0 3ex =x− = 3ex 1 3 =1 , = e−3x 3 C2 = −x , C3 = −1 −3x e 9 So, y(x) = C1 (x)y1 (x) + C2 (x)y1 (2) + C3 (x)y1 (3) = x2 2 2 − x 3 = x2 e−x − e−x -x(xe−x ) - Therefore, x 3 + 1 9 e−x 1 −3x e 9 e2x 57 y(x) = yc + yp A1 e−x + A2 xe−x + A3 e2x − x2 −x e 2 − x 3 + 1 9 e−x Chapter 6 Numerical Solution 6.1 Error and Interpolation Error/Types of Error (1.) Gross Error or Blunder: This is the error committed whwn a wrong answer is written for a correct one. e.g. Writing 0.5971 instead of 0.5791. (2.) Truncation Error This is the error committed when an infinite process is replaced by a finite process.e.g. The expansion of 1 (1 + x) 2 = 1 + x x2 − + ....... 2 8 (3.) Round-Off Errors: This is the error committed when certain arithmetic calculation obtain as fraction is required to be expressed as decimal, leading to approximation e.g. 1/3 = 0.333,. . . , 3. . . Let E = Error, X = true value , and X ∗ = approximated value. then, Absolute Error = |X − X ∗ | 58 59 Relative Error = Actual Error E X − X∗ X∗ = = =1− T rue V alue X X X If X is a real number which in general has an infinite decimal representation, we say that x has been rounded off to a d-decimal places written as x(d) i.e. |E| = x − x(d) ≤ × 10−d 1 2 x(2) = 0.14 If x = 0.1428571, |E| = x − x(2) = |0.1428571 − 0.14| = 0.0028571 0.0028571 ≤ 1 2 × 10−d ≤ 1 2 × 1 100 ≤ 1 200 ≤ 0.005 x(3) = 0.333 If x = 0.333333 |E| = |0.333333 − 0.333| = 0.000333 0.000333 ≤ 1 2 × 10−3 = Hence, x − x(d) ≤ 1 2 1 2 × 1 1000 = 1 2000 = 0.0005 × 10−d Errors Propagation Let X and Y be the real values and let X ∗ and Y ∗ be their respective approximation with εX and εY as their respective error. then, X∗ = X − ε and Y∗ =Y −Y εX = X − X ∗ and εY = Y − Y ∗ (1.) Addition X ∗ + Y ∗ = (X − εX ) + (Y − εY ) = X − εX + Y − εY =(X + Y ) − (εX + εY ) (εX + εY ) = (X + Y ) − (X ∗ + Y ∗ ) The sum is the addition of the errors 60 (2.) Subtraction X ∗ − Y ∗ = (XεX ) − (Y − εY ) =X − εX − Y + εY =(X − Y ) − (εX − εY ) = (X − Y ) + (εY − εX ) ⇒ (εX − εY ) = (X − Y ) − (X ∗ − Y ∗ ) The error is the difference of the error (3.) Multiplication X ∗ × Y ∗ = (X − εX )(Y − εY ) = XY − XY − Y εX + εX εY Neglecting εX εY , then X ∗ × Y ∗ = XY − Xεy − Y εX XY − X ∗ Y ∗ = XεY + Y εX But Relation Error = Actual Error XY − X ∗ Y ∗ XεY Y εY εY εX = = + = + T rue V alue XY XY XY Y X Therefore, the relative error in the product equals the sum of the relative error in the number we are multiplying. (4.) Division X∗ Y∗ = X−εX Y −εY X X∗ X X − εX X(Y − εY ) − Y (X − εX ) − ∗ = − = Y Y Y Y − εY Y (Y − εY ) XY − XεY − XY + Y εX Y εX − XεY = Y (Y − εY ) Y (Y − εY ) Relative Error Y X −X Y 1 = × P Y (Y − Y ) x/y P P 61 = X X 1 Y × (Y −X ) × P Y2−Y Y X x Y 1 Y2 = 2 P · Y −Y Y X P ! P XY − X X 1 Y2 = 2 P · Y −Y Y X P 1 = 2 P · Y −Y Y = 1 Y 2 (1 − = 1 (1 − · P Y Y P X − X P ) Y Y −Y P X X ) ! X Y Y2 X ·Y2 P X Y X − P Y Y P ! XY − X Y P Y Y P = Plim y →0 Y Y P = X X →0 P − Y Y Therefore, the relative error in the division equals the difference of the relative error of the respective number we are dividing. Interpolation 62 Given n+1 data with (xi , fi ), i = 0, 1, ..., n, we seek a polynomial Pn (x) which takes fi at every xi i.e Pn (xi ) = fi Pn (x0 ) = f0 , Pn (x1 ) = f1 , ..., Pn (xn ) = fn The polynomial Pn (x) is called INTERPOLATING POLYNOMIAL and fi are 0 certain mathematical functions Pn (xi ) is an estimate of fi at respective xis The process of obtaining the Pn (xi ), the estimate of fi (xi ) is called INTERPOLATION,If x of interest lies within xi and it iss called EXTRAPOLATION, if x of interest does not lies within xi Special Cases: 1. Linear interpolation: This is interpolation by means of straight line through two points (x0 , f0 ) & (x1 , f1 ) given by P1 (x) = f0 + (x − x0 )f (x0 , x1 ) where f (x0 , x1 ) = f1 −f0 x1 −x0 Note: (1) P1 (x0 ) = f0 P1 (x1 ) = f0 + (x1 − x0 ) f1 − f0 x1 − x0 P1 (x1 ) = f0 + f1 − f0 = f1 Exercise: (1) Estimate the population of Nigeria in 1999 given that Year 1990 2006 Population(million) 120 150 63 Answer is 136.875 million (2) Find ln 9.2 from ln 9.0=2.1972, ln 9.5=2.2513 2. Quadratic interpolation: This is interpolation of second order polynomial with a curve through (x0 , f0 ), (x1 , f1 ), (x2 , f2 ) given by P2 (x) = f0 + (x − x0 )f (x0 , x1 ) + (x − x0 )(x − x1 )f (x0 , x1 , x2 ) where f (x0 , x1 , x2 ) = f (x1 , x2 ) − f (x0 , x1 ) , x2 − x0 f (x1 , x2 ) = f2 − f1 x2 − x1 Exercise: (1) verify that P2 (X0 ) = f0 and P2 (X1 ) = f1 (2) Compute the quadratic interpolation for f (0.9) from f (0.5) = 0.479, f (1.0) = 0.841, f (2.0) = 0.909 (3) Compute the quadratic interpolation for Γ(1.01) and Γ(1.03) from Γ(1.00) = 1.000, Γ(1.02) = 0.989, Γ(1.04) = 0.978 (4) Obtain the polynomial for ln8.0 = 2.0794, ln9.0 = 2.1972, ln9.5 = 2.2573 64 3. Lagrange Interpolation This invplves the interpolation of polynomial with order n > 2 Given a table of n-values [(x0 , f0 ), ..., (xn , fn )] of a function f (xj ) evaluated at x = xj , j = 1, 2, ..., n, we require to evaluate the value of f (x) when x is not tabulated. The process is to approximate f (x) by a function which passes through each of the tabulated point. This is carried out by the Lagrange interpolation formula. f (x) = Ln (x) = n X lk (x) k=0 lk (xk ) f (xk ) where lk (x) (x − x0 )(x − x1 )...(x − xj−1 )(x − xj+1 )...(x − xn ) = lj (x) = , lk (xk ) (xj − x0 )(xj − x1 )...(xj − xj−1 )...(xj − xn ) L3 (x) = = j = 0, 1, ..., n l0 (x) l1 (x) l2 (x) l3 (x) f0 + f1 + f2 + f3 l0 (x0 ) l1 (x1 ) l2 (x2 ) l3 (x3 ) (x − x1 )(x − x2 )(x − x3 ) (x − x0 )(x − x2 )(x − x3 ) (x − x0 )(x − x1 )(x f (x0 )+ f (x1 )+ (x0 − x1 )(x0 − x2 )(x0 − x3 ) (x1 − x0 )(x1 − x2 )(x1 − x3 ) (x2 − x0 )(x2 − x1 )(x Exercise: (1) Find the lagrange interpolation polynomial for the data x 0 2 3 5 f(x) 1 3 2 5 x0 = 0, x1 = 2, x2 = 3, x3 = 5 f0 = 1, f1 = 3, f2 = 2, f3 = 5 65 Answer: 3 3 x 10 − 15 2 x 6 + 62 x 15 +1 (2) Let f (x) = lnx. Estimate the value of ln(0.6) from the table x 0,4 0.5 0.7 0.8 f(x) -0.9165 -0.6931 -0.3567 -0.2231 Answer = −0.5100 (3) Find ln9.2 using the table below x 9.0 9.5 10.0 11.0 ln x 2.69722 2.25129 2.30259 2.39790 Answer = 2.21920