ENGI 3424 2. 2 - Second Order Linear ODEs Page 2-01 Second Order Linear Ordinary Differential Equations The general second order linear ordinary differential equation is of the form d2y dy P x Q x y R x 2 dx dx Of the second (and higher) order ordinary differential equations, the linear equations with constant coefficients will command most of our attention in this chapter: d2y dy P Q y R x 2 dx dx Contents: 2.1 2.2 2.3 2.4 2.5. Complementary Function Particular Solution (Variation of Parameters) Particular Solution (Undetermined Coefficients) Higher Order Linear Ordinary Differential Equations Numerical Methods ENGI 3424 2.1 2.1 – Complementary Function Page 2-02 Complementary Function d2y dy The homogeneous equation associated with the ODE P Q y R x is 2 dx dx d2y dy P Qy 0 2 dx dx The principle of superposition of solutions of the homogeneous equation is valid because it is linear. That is, if y = u(x) and y = v(x) are both solutions of the homogeneous ODE, then so also is any linear combination of these functions: y = c1 u(x) + c2 v(x) , where c1 and c2 are any constants. Adding any solution of the homogeneous ODE to a particular solution of the original ODE generates another solution of the original ODE. Thus the general solution (abbreviated as G.S.) of d2y dy P Q y Rx 2 dx dx can be partitioned into two parts: the complementary function (C.F., which is the general solution of the associated homogeneous ODE) and a particular solution (P.S.). If y e x then Substituting y e x into the homogeneous ODE: from which the auxiliary equation (A.E.) follows: 2 + P + Q = 0 [The choice of y e x as a trial solution to the homogeneous ODE is justified later, on page 2-09, when a more general method for finding the complementary function is introduced.] ENGI 3424 2.1 – Complementary Function The solution of the auxiliary equation 2 + P + Q = 0 is Distinct roots (1 2) the complementary function is [The case of equal roots will be dealt with later, on page 2.08 .] Example 2.1.1 Solve the differential equation y" + 3y' 4y = 0 The auxiliary equation is The complementary function (which is also the general solution) is Checking the solution: Page 2-03 2.1 – Complementary Function ENGI 3424 Page 2-04 Example 2.1.2 Solve y" 2y' + 2y = 0 In general, when the roots of the auxiliary equation are a complex conjugate pair of values, = a ± bj , then the complementary function is yC x eax c1 e jbx c2 e jbx eax c3 cos bx c4 sin bx (where the arbitrary constants are related by c3 = c1 + c2 and c4 = j (c2 or yC(x) = A eax cos(bx ) c3 c4 where A c32 c4 2 , cos and sin 2 2 c3 c4 c32 c4 2 or yC(x) = A eax sin(bx ) c3 c4 where A c32 c4 2 , sin and cos c32 c4 2 c32 c4 2 c1) ) Note that, for an auxiliary equation of this type, with real coefficients, where the solution is constrained to be real, the arbitrary constants c3 and c4 are both real, but c1 and c2 often are not. For this reason, the forms involving the trigonometric functions are usually preferred to the complex exponential form. ENGI 3424 2.1 – Complementary Function Page 2-05 Example 2.1.3 A spring, that is not at its natural length, experiences a restoring force R that is proportional to the extension s beyond the natural length and is directed towards the equilibrium position. In the absence of friction, this would lead to undamped simple harmonic motion. Let us suppose that there is also a friction force D that is proportional to the speed and acts in the opposite direction to the velocity. Restoring force proportional to displacement Friction (drag) proportional to speed Newton’s second law of motion: Therefore the ODE governing the motion of the spring is ENGI 3424 2.1 – Complementary Function Page 2-06 Example 2.1.3 (continued) Suppose that m = 1 kg, b = 6 kg s−1 , c = 25 kg s−2 and that the spring begins at its equilibrium position, but moving at 2 m s−1 to the right, so that s(0) = 0 and v(0) = 2, then the ODE becomes Note that if b = 0 (no friction at all), then the system is totally undamped and exhibits simple harmonic motion: s(t) = A sin (kt ) c where k . m 2.1 – Complementary Function ENGI 3424 Page 2-07 The General Spring Problem d 2s b ds c s 0 2 dt m dt m 2 Case 1: b c 4 m m λ = 2 Case 2: b c 4 m m λ = or or 2 Case 3: λ = b c 4 m m 2.1 – Complementary Function ENGI 3424 Page 2-08 Complementary Function when the Auxiliary Equation has Equal Roots λ 1 = λ 2 (= λ) the ODE becomes y" − 2λ y' + λ 2 y = 0 One solution to this equation is C1 eλx We require another solution that is independent of this one (so that there will be two distinct arbitrary constants of integration in the complementary function). Try f (x) = C2 x eλx [This second form arises naturally from the operator method, on page 2.09.] Then f '(x) = and f "(x) = Example 2.1.4 Solve y" 6y' + 9y = 0 ENGI 3424 2.1 – Complementary Function Page 2-09 The Operator Method The homogeneous ordinary differential equation with constant coefficients, d2y dy P Qy 0 2 dx dx can also be written, using differential operators, in the form d d k1 k 2 y 0 dx dx Justification: The second order ODE can therefore be re-written as a linked pair of first order linear ordinary differential equations [the method of reduction of order, section 1.4]: d (A) k1 0 , dx where dy k2 y . (B) dx Solution: ENGI 3424 2.1 – Complementary Function Operator Method (continued) Page 2-10 2.1 – Complementary Function ENGI 3424 Page 2-11 Operator Method (continued) Summary for the Complementary Function: ODE: y" + P y' + Q y = 0 A.E.: λ2 + P λ + Q = 0 1x λ real and distinct yC A e Be λ real and equal yC Ax B e x 2x λ complex conjugate pair yC ea x C cos bx D sin bx , where a Re , b Im 2.2 – Variation of Parameters ENGI 3424 2.2 Page 2-12 Particular Solution (Variation of Parameters) The method of variation of parameters is a general method for finding the particular solution of a linear ODE. If the complementary function for the ODE d2y dy P Q y Rx 2 dx dx is yC(x) = C1 y1(x) + C2 y2(x) , (so that { y1(x), y2(x) } is a basis for the space of all solutions to the homogeneous ODE), then the particular solution is yP(x) = u(x) y1(x) + v(x) y2(x) , where the functions u(x) and v(x) need to be determined. We need two constraints in order to pin down the functional forms of u(x) and v(x). An obvious constraint is that u(x) y1(x) + v(x) y2(x) be a particular solution of the ODE. We have considerable freedom as to what the other constraint will be. yP = u y1 + v y2 Impose our “free” constraint, 2.2 – Variation of Parameters ENGI 3424 Page 2-13 Define the Wronskian function W(x) to be y Wy1, y2 x det 1 y1 y2 y2 together with the associated determinants 0 y2 y 0 W1 det y2 R and W2 det 1 y1R R y2 y1 R then Cramer’s rule yields solutions for u' and v' : W1 W and v 2 . W W Therefore a particular solution is yP = u y1 + v y2 , where u u x y2 x R x dx , v x W x y y1 x R x dx , W x 1 y1 W x y2 y2 Note that we can ignore the arbitrary constants of integration in both integrals, because A y1 and B y2 are both solutions of the homogeneous ODE and can therefore be absorbed into the complementary function. Example 2.2.1 Find the general solution of the ODE y" + 2y' − 3y = x2 + e2x . ENGI 3424 2.2 – Variation of Parameters Example 2.2.1 (continued) Particular Solution by Variation of Parameters: Page 2-14 ENGI 3424 Example 2.2.1 (continued) 2.2 – Variation of Parameters Page 2-15 ENGI 3424 2.2 – Variation of Parameters Example 2.2.2 Find the general solution of: y" + y = tan x Page 2-16 2.2 – Variation of Parameters ENGI 3424 Example 2.2.2 (continued) Page 2-17 ENGI 3424 2.2 – Variation of Parameters Page 2-18 Example 2.2.3 Use the variation of parameters method to find the particular solution, then find the complete solution of the initial value problem y" − 2y' + y = ex, y(0) = 0, y'(0) = 1 2.2 – Variation of Parameters ENGI 3424 Example 2.2.3 Page 2-19 (continued) Note that a complete solution requires additional information (often in the form of initial conditions). Two pieces of information are needed in order to evaluate both arbitrary constants of integration. However, do not substitute these conditions into the complementary function; wait until the general solution has been obtained. 2.2 – Variation of Parameters ENGI 3424 Page 2-20 The method of variation of parameters may also be used to find the particular solution of a linear second order ODE whose coefficients are not constant. However, general methods for finding the complementary functions in these cases are beyond the scope of this course. Example 2.2.4 Verify that the complementary function for the ODE d2y dy x2 2 5x 8 y 3x dx dx is yC A x 4 B x 2 and hence find the general solution of the ODE. yC A x 4 B x 2 yC The particular solution is yP x u x y1 x v x y2 x where y1 x 4 and y2 x 2 ENGI 3424 2.2 – Variation of Parameters Page 2-21 Example 2.2.4 (continued) [This example appeared in the journal note “A seldom used formula for ODEs”, George, G.H., Mathematical Gazette, vol. 92, #524, pp. 344-348] 2.3 – Undetermined Coefficients ENGI 3424 2.3 Page 2-22 Particular Solution (Undetermined Coefficients) The general solution to d2y dy P Q y Rx 2 dx dx is the sum of the complementary function and any one solution (the particular solution) that we can find to the original inhomogeneous ODE. The method of variation of parameters to find the particular solution is powerful, but it can involve an unnecessary level of effort. In some cases, an alternative method (undetermined coefficients) is available that is often faster to use. If the function R(x) does not contain any part of the complementary function, then assume that the particular solution yP(x) is of the same form as R(x). Example 2.3.1 (same as Example 2.2.1) Find the general solution of the ODE y" + 2y' − 3y = x2 + e2x . A.E.: C.F.: P.S.: R(x) contains neither e−3x nor ex . R(x) is the sum of a quadratic function and e2x . Therefore try the sum of a quadratic function and a multiple of e2x , where all four coefficients are to be determined. 2.3 – Undetermined Coefficients ENGI 3424 Example 2.3.1 (continued) yP = a x2 + b x + c + d e2x Matching coefficients: G.S.: y(x) = yC(x) + yP(x) Therefore Page 2-23 2.3 – Undetermined Coefficients ENGI 3424 Page 2-24 General Method: d2y dy P Q y Rx 2 dx dx If the function R(x) does not contain any part of the complementary function, then assume that the particular solution yP(x) is of the same form as R(x). If R(x) = ekx , then try yP = c ekx , with c to be determined. If R(x) = (a polynomial of degree n), then try yP = (a polynomial of degree n), with all (n + 1) coefficients to be determined. If R(x) = (a multiple of cos kx and/or sin kx), then try yP = c cos kx + d sin kx , with c and d to be determined. This method can be extended to cases where R(x) = (a sum and/or product of the functions above). But: if part (or all) of yP is included in the complementary function yC , then multiply yP by x. As seen above in Example 2.3.1, the method of undetermined coefficients can be used in Example 2.2.1 R x x 2 e2x . It can also be used in Example 2.2.3 R x e x . However, in Example 2.2.2, R(x) = tan x , which does not fall into any of these categories. The method of undetermined coefficients cannot be used in this case to find the particular solution (which was yP cos x ln sec x tan x ). ENGI 3424 2.3 – Undetermined Coefficients Example 2.3.2 Consider a model of the simple series RLC circuit, where the constants R, L, C are the resistance, inductance and capacitance respectively, E(t) is the applied electromotive force, t is the time and I(t) is the resulting current. Examine the voltage drops around the circuit: R: L: C: and note that i dQ . dt Page 2-25 ENGI 3424 2.3 – Undetermined Coefficients Example 2.3.2 (continued) Particular solution If E(t) = Eo (constant), then Suppose that the e.m.f. is sinusoidal, so that E(t) = Eo sin ωt , then E cos t 1 dE o L dt L P.S.: Try iP = a sin ωt + b cos ωt iP' = −bω sin ωt + aω cos ωt iP" = −aω2 sin ωt − bω2 cos ωt R 1 iP iP L LC b R a a R b 2 2 a sin t b cos t L LC L LC E 0 sin t o cos t L iP b R a a 2 L LC b a 1 2 LC RC a Eo a R 1 1 2 LC 2 L LC L RC a 1 2 LC 2 a R RC C Eo RC LC RC LC L Eo C RC E RC LC a o 2 2 2 2 L RC 1 2 LC RC 1 2 LC Eo C 1 2 LC Eo C RC 1 2 LC b 2 2 2 2 RC RC 1 LC RC 2 1 2 LC Page 2-26 2.3 – Undetermined Coefficients ENGI 3424 Page 2-27 Example 2.3.2 (continued) Therefore the particular solution is iP Eo C RC sin t 1 2 LC cos t RC 2 1 2 LC 2 which is a steady-state sinusoidal response to the sinusoidal electromotive force, but with RC a phase difference of arccos . 2 2 RC 1 2 LC The total current is then E C RC sin t 1 2 LC cos t Rt D D i t e 2 L A sin t B cos t 2 2 2 2 L 2 L RC 1 LC transient steady state As a specific example, if E(t) = 17 sin 2t, R = 120 Ω, C = 1 mF and L = 10 H, then it can be shown that 1 i t e6t A sin 8t B cos8t sin 2t 4 cos 2t 120 The transient current, iC t e 6t A sin 8t B cos8t , dies away very quickly. Its magnitude falls to under 1% of the total current permanently in less than a second. The values of the two arbitrary constants can be found from the initial conditions, but, given that the complementary function becomes negligible in a very short time, one often does not try to evaluate them. Example 2.3.3 Find the complete solution of the initial value problem y" + 2 y' + y = ex , y(0) = y' (0) = 1 ENGI 3424 2.3 – Undetermined Coefficients Example 2.3.3 (continued) Page 2-28 ENGI 3424 2.4 2.4 - Higher Order ODEs Page 2-29 Higher Order Linear Ordinary Differential Equations The nth order ordinary differential equation dny d n 1 y d n 2 y d2y dy a a a an 1 an y Rx 1 2 n 2 n n 1 n 2 2 dx dx dx dx dx (where the coefficients ai are all constant) can be solved as follows. Form the auxiliary equation n + a1n1 + ... + an22 + an11 + an = 0 Find all n values for . Form the complementary function yC , which will be a linear combination of e 1x ,e 2 x , ,e n x (except for repeated roots). Complex conjugate pairs can be re-written in terms of sine and cosine functions. Find a particular solution yP (by inspection, undetermined coefficients, or variation of parameters, as extended to this higher order equation). Write down the general solution y = yC + yP. n initial and/or boundary conditions will be needed at this stage to evaluate all of the n arbitrary constants of integration. Example 2.4.1 Find the general solution of 5 4 d y d y d3y d2y dy 2 3 4 4 8x 5 4 3 2 dx dx dx dx dx Auxiliary equation: 5 + 2 4 3 3 4 2 + 4 = 0 ENGI 3424 Example 2.4.1 (continued) 2.4 - Higher Order ODEs Page 2-30 ENGI 3424 2.4 - Higher Order ODEs Page 2-31 Example 2.4.2 A thin uniform beam of length L experiences a transverse deflection y(x) at location x (0 < x < L) due to a transverse force per unit length W(x) . From the elementary theory of beams, the governing differential equation is EI d4y W x dx 4 where EI is the flexural rigidity of the beam, E is Young’s modulus and I is the moment of inertia of the beam about its central axis. If the beam has uniform elastic properties and a uniform cross section along its length, then its flexural rigidity EI is constant. The initial conditions are: y 0 a the deflection at x = 0, y 0 b the slope at x = 0, EI y 0 c the bending moment at x = 0 and EI y 0 d the shear at x = 0. Find the deflection for a cantilever beam with uniform load W(x) = W (constant). For a cantilever beam, the deflection and slope are zero at the fixed end (x = 0), while the bending moment and the shear are zero at the free end (x = L ). ENGI 3424 Example 2.4.2 (continued) 2.4 - Higher Order ODEs Page 2-32 ENGI 3424 2.5. Numerical Methods 2.5 - Numerical Methods Page 2-33 [not examinable] An initial value problem with an nth order ordinary differential equation can be re-written as a linked set of n first order initial value problems. Where analytical solutions are difficult or impossible, extensions of numerical methods, such as the Euler and RK4 methods, can be applied to obtain approximate solutions to these initial value problems at particular values of the independent variable. A more general case for initial value problems involving second order ODEs, d2y dy P x, y Q x, y y R x , y 0 a , y 0 b , 2 dx dx transforms into the linked pair of first order initial value problems dy dz z , y 0 a and R x Q x, y y P x, y z , z 0 b dx dx This pair of problems can be solved sequentially (as in the operator method on pages 2.09 to 2.11) if the coefficients Q x, y 0 and P x, y f x . Otherwise analytical solutions are mostly beyond the scope of this course. Symbolic algebra software, such as Maple®, may be able to provide exact solutions or numerical approximations. Example 2.5.1 Use software to estimate the value of y(0.5) given that d2y dy y2 y sin x , y 0 0 , y 0 1 . 2 dx dx Using Maple software, the commands > with(DEtools): > DEplot(diff(y(x),x$2)+y(x)*y(x)*diff(y(x),x)+y(x)-sin(x),y(x), x=-3..12, [[y(0)=0,D(y)(0)=1]], y=-6..3, stepsize=.05, linecolour=[blue]); produce the plot ENGI 3424 2.5 - Numerical Methods Page 2-34 Example 2.5.1 (continued) which does not resemble any standard function. Zooming in (to x=0..0.5, y=0..0.5 and enhancing slightly), we can see that our estimate is y 0.5 0.495 The Maple worksheet is on the course web site, at "www.engr.mun.ca/~ggeorge/3424/ demos/ex251.mws" The further sequence of Maple commands > > > > ode1 := diff(y(x),x$2)+y(x)*y(x)*diff(y(x),x)+y(x)-sin(x); ic1 := y(0) = 0, D(y)(0) = 1; dsol1 := dsolve({ode1, ic1}, numeric, range=0..1); dsol1(0.5); produces y(0.5) = .494 671... ENGI 3424 2.5 - Numerical Methods Page 2-35 Example 2.5.2 Find the general solution of the ordinary differential equation d2y dy x2 2 6 x 12 y 24 dx dx and find the complete solution given the additional information y 1 2, y 1 1 . This is an example of a “dimensionally homogeneous” ODE (also known as a CauchyEuler ODE). A change of variables x et will convert the ODE into a form with constant coefficients, which can be solved exactly using the methods in the earlier sections of this chapter. The sequence of Maple commands > > > > with(DEtools): ode1 := x^2*diff(y(x),x$2) - 6*x*diff(y(x),x) + 12*y(x) - 24; ic1 := y(1) = 2, D(y)(1) = 1; dsolve(ode1); produces the general solution y(x) = x^3 _C2 + x^4 _C1 + 2 The additional command > dsolve({ode1, ic1}); produces the complete solution y(x) = –x^3 + x^4 + 2 The Maple worksheet is available at "www.engr.mun.ca/~ggeorge/3424/demos/ex252.mws" One can easily verify that this complete solution is correct: ENGI 3424 2.5 - Numerical Methods Example 2.5.2 Page 2-36 (continued) The exact solution (not examinable except possibly as a bonus question) is obtained as follows: dx et x dt dy dy dt dy dx dy 1 dy e t By the chain rule, dx dt dx dt dt dt x dt Let x et x dy dy dx dt d 2 y d dy d dy dx 1 d t dy 1 t d 2 y dy e et e 2 2 dx dx dx dt dx dt x dt dt x dt dt 2 1 d 2 y dy d 2 y dy 2 d y 2 2 x 2 x dt dt dx 2 dt dt d2y dy bx cy r x , 2 dx dx (where b and c are constants) therefore transforms into the ODE d 2 y dy dy d2y dy b cy r x b 1 cy r x 2 2 dt dt dt dt dt In this case, b = –6, c = 12 and r(x) = 24. d2y dy The equivalent ODE is 7 12 y 24 2 dt dt 2 A.E.: 7 12 0 3 4 0 3, 4 Any Cauchy-Euler ODE of the type x 2 C.F.: yC t Ae3t Be4t A et P.S.: r x is a constant. Therefore try yP x c yP x 0 yP x 0 3 B et Substituting into the ODE: 0 0 12c 24 4 yC x Ax 3 Bx 4 c2 yP x 2 Therefore the general solution is y x Ax3 Bx 4 2 Applying the conditions y 1 2, y 1 1 quickly leads to A 1, B 1 . The complete solution is therefore y x x4 x3 2 . ENGI 3424 2.5 - Numerical Methods Page 2-37 Example 2.5.3 (same as Example 5.11.2) Find the general solution (as a power series about x = 0) to the ordinary differential equation d2y x2 y 0 2 dx The sequence of Maple commands > with(DEtools): > ode := diff(y(x),x$2) > dsolve(ode); + x*x*y(x); produces the exact general solution 1 x2 1 x2 y x _ C1 x BesselJ , _ C 2 x BesselY , 4 2 4 2 where the Bessel functions J x and Y x are beyond the scope of this course. Converting the exact solution into a power series, > Order := 15; > dsolve(ode, y(x), series); produces 1 1 1 1 y 0 x4 D y 0 x5 y 0 x8 D y 0 x9 12 20 672 1440 1 1 y 0 x12 D y 0 x13 O x15 88704 224640 Letting A y 0 and B y 0 this solution can be re-written as y x y 0 D y 0 x 1 1 8 1 y x A 1 x 4 x x12 12 672 88704 1 5 1 9 1 B x x x x13 20 1440 224640 ENGI 3424 2.5 - Numerical Methods [Space for Additional Notes] END OF CHAPTER 2 Page 2-38