620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients 620123 Applied Mathematics (Advanced) Lectures on second order (ordinary) differential equations S. Ole Warnaar Department of Mathematics and Statistics The University of Melbourne 620123 Applied Mathematics (Advanced) Introduction S. Ole Warnaar Introduction Reduction of order Definition An equation of the form Second order linear ODEs d2 y dy = f x, y , 2 dx dx Second-order linear ODEs with constant coefficients is called a second-order ODE Examples of second order ODEs are x2 d2 y dy + xy + sin(xy ) = 0 2 dx dx and y 00 (t) = y (t). Unfortunatelty, second order ODEs are even harder to solve than first order ODEs and we will only look at a limited number of (very) special cases. 620123 Applied Mathematics (Advanced) Reduction of order S. Ole Warnaar Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients Some second order ODEs are really not much more than first order ODEs in disguise and can be reduced to the latter by reduction of order. We will consider two classes of such reducible second order ODEs. The “independent” y -variable is missing: dy d2 y = f x, . 2 dx dx The “independent” x-variable is missing: dy d2 y = f y, . dx 2 dx 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction When the independent y -variable is missing we simply set Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients p(x) = dy . dx This gives the following first order ODE for p: p 0 (x) = f x, p(x) . Solving this for p(x) and then integrating yields y (x). Note: Since the general solution of the p-ODE contains an arbitary constant, the general solution of the y -ODE will contain two arbitrary constants. This is a more general feature of second order ODEs. 620123 Applied Mathematics (Advanced) Example 1 S. Ole Warnaar Find the general solution of Introduction x y 00 + y 0 = 6x Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients Since the independent y -variable is missing we set p = y0 so that the p-ODE reads xp 0 + p = 6x. This may be rewritten as (xp)0 = 6x so that xp = 3x 2 + C . The general solution of the p-ODE is thus p(x) = 3x + C . x 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients To obtain y we need one more integration: Z y (x) = y 0 (x) dx Z = p(x) dx Z C dx = 3x + x 3 = x 2 + C log|x| + D 2 for x 6= 0. 620123 Applied Mathematics (Advanced) Example 2 S. Ole Warnaar Find the general solution of the IVP Introduction Reduction of order 2 −2 e x x x 2 y 00 − 2y 0 = y 0 (1) = 2y (1) = − e−2 y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients Since the independent y -variable is missing we again set p = y0 so that the p-ODE reads x 2 p 0 − 2p = 2 −2 e x. x This is a first order linear ODE with canonical form 2 2p 2 p 0 − 2 = 3 e− x . x x As integrating factor we may take Z dx 2 I (x) = exp −2 = exp . x2 x 620123 Applied Mathematics (Advanced) Multiplying the canonical form by I (x) leads to S. Ole Warnaar Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients 2 0 p ex = 2 x3 so that the general solution of the p-ODE is 1 2 p(x) = C − 2 e− x . x If we try to find y by integrating p = y 0 we run into the problem that we cannot explicitly calculate the integral Z 2 e− x dx. A way around this is to note that one of the initial conditions states that p(1) = y 0 (1) = − e−2 . Since p(1) = C − 1 e−2 this implies that C = 0. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients Therefore Z y (x) = − 1 −2 e x dx x2 1 2 = − e− x + D. 2 Using the second initial condition: y (1) = − 12 e−2 shows that D = 0 so that we obtain the final solution 1 2 y (x) = − e− x . 2 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients Note: Given a second order IVP one usually first tries to find the general solution of the ODE containing two arbitrary constants. Then the two constants are fixed by the two initial conditions. The previous example shows that sometimes it is better to fix one of the constants at an earlier stage to simplify difficult calculations. 620123 Applied Mathematics (Advanced) When the independent x-variable is missing we set S. Ole Warnaar p(y ) = Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients dy . dx (∗) Then d2 y d dy d dy = = p(y ) = p 0 (y ) = p 0 (y )p(y ). 2 dx dx dx dx dx Hence the substitution (∗) transforms the ODE y 00 = f y , y 0 into the first order ODE pp 0 = f (y , p). (∗∗) Note: (∗∗) is a first order ODE for the function p(y ) and makes no reference to any x-variables. 620123 Applied Mathematics (Advanced) Example 1 S. Ole Warnaar Solve the non-linear second order ODE Introduction (y + 1)y 00 = (y 0 )2 Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients Since the independent x-variable is missing we set p = p(y ) = y 0 (∗). Then (as before) y 00 = pp 0 so that we obtain the reduced ODE (y + 1)pp 0 = p 2 There are now two cases to consider. 1 The first case is p = 0. By (∗) this implies y 0 = 0 so that y = C. Of course we could have observed this singular solution directly from the original ODE. 620123 Applied Mathematics (Advanced) 2 The second case is (y + 1)p 0 = p. S. Ole Warnaar Introduction Reduction of order y missing x missing Second order linear ODEs Second-order linear ODEs with constant coefficients This is a separable ODE so that Z Z dy dp = . p y +1 Computing the integrals yields log|p| = log|y + 1| + E which after exponentiating gives p(y ) = D(y + 1). By (∗) this implies y 0 = D(y + 1). This again is a separable ODE so that Z Z dy dx =D y +1 Computing the integrals yields the general solution y (x) = B eDx − 1. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order y missing x missing Note: The singular solution Second order linear ODEs Second-order linear ODEs with constant coefficients y =C corresponds to the D = 0 (and B − 1 = C ) case of the general solution y (x) = B eDx − 1. 620123 Applied Mathematics (Advanced) Second order linear ODEs S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Definition An equation of the form d2 y dy + P(x) + Q(x)y = R(x) dx 2 dx (∗) is called a second-order linear ODE When R(x) = 0 the equation (∗) is homogeneous and when R(x) 6= 0 it is inhomogeneous. The solution to (∗) for R(x) = 0 is also known as the complementary function of the full equation (∗). An arbitrary function that solves (∗) is known as a particular solution. 620123 Applied Mathematics (Advanced) Lemma 1 S. Ole Warnaar If y1 (x) and y2 (x) are solutions of Introduction d2 y dy + P(x) + Q(x)y = 0 dx 2 dx Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients then so is the linear combination y (x) = c1 y1 (x) + c2 y2 (x) Proof. y 00 (x)+P(x)y 0 (x) + Q(x)y (x) = c1 y100 (x) + c2 y200 (x) + P(x) c1 y10 (x) + c2 y20 (x) + Q(x) c1 y1 (x) + c2 y2 (x) h i = c1 y100 (x) + P(x)y10 (x) + Q(x)y1 (x) h i + c2 y200 (x) + P(x)y20 (x) + Q(x)y2 (x) = c1 × 0 + c2 × 0 = 0. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Note: We are (of course) only interested in linear combinations of linearly independent solutions y1 and y2 , i.e., y1 6= Cy2 . Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Lemma 2 If y1 (x) and y2 (x) are linearly independent solutions of dy d2 y + P(x) + Q(x)y = 0 dx 2 dx for some interval I ⊂ R, then the general solution on I is given by the linear combination y (x) = c1 y1 (x) + c2 y2 (x). Lemma 2 tells us that the problem of finding the general solution of a second-order linear homogeneous ODE boils down to finding two linearly independent solutions. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients The bad news is that we have no general method for finding two such solutions. The good news is that once we have found one solution, we can always find a second (linearly) independent solution. If we are lucky (or smart . . . ) enough to guess one solution we can thus find the general solution. Lemma 3 Let y1 (x) be a solution to y 00 (x) + P(x)y 0 (x) + Q(x)y (x) = 0 Then a second solution may be found by the substitution y2 (x) = u(x) y1 (x) The above substitution is (again) known as reduction of order for reasons that will become clear shortly. 620123 Applied Mathematics (Advanced) Proof. We know that y1 solves the ODE, i.e., S. Ole Warnaar y100 + Py10 + Qy1 = 0 Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients (1). (For brevity we suppress all x-dependence.) Defining y2 = uy1 we get y20 = u 0 y1 + uy10 y200 00 = u y1 + 2u 0 y10 (2a) + uy100 . (2b) We want y2 to solve the ODE, i.e., y200 + Py20 + Qy2 = 0. Substituting (2a) and (2b) this becomes u 00 y1 + 2u 0 y10 + u y100 + Py10 + Qy1 + Pu 0 y1 = 0. | {z } = 0 by (1) 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients We thus find that y2 is a solution if y0 u 00 + u 0 P + 2 1 = 0 y1 Defining u 0 = v this becomes a first order linear ODE of the form v 0 + f (x)v = 0. and can be solved using an integration factor. Since u(x) 6= C it is clear that y1 and y2 are linearly independent. y0 (Possibly u 0 is constant (namely if P + 2 1 = 0) but then y1 u = Cx + D.) 620123 Applied Mathematics (Advanced) S. Ole Warnaar Example Solve the ODE x 2 y 00 + 2xy 0 − 6y = 0 Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients We “guess” the solution y1 (x) = x 2 . To find a second linearly independent solution we use reduction of order and set y2 = uy1 = ux 2 . Then y20 = u 0 x 2 + 2ux and y200 = u 00 x 2 + 4u 0 x + 2u. Substituting this in the ODE gives x 2 (u 00 x 2 + 4u 0 x + 2u) + 2x(u 0 x 2 + 2ux) − 6ux 2 = 0. The terms involving u cancel (as they should) and we are left with u 00 x 4 + 6u 0 x 3 = 0 or u 00 + 6 0 u = 0. x 620123 Applied Mathematics (Advanced) The linear first order ODE u 00 + S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients 6 0 u =0 x can be integrated using the integrating factor Z dx = exp(6 log x) = x 6 . I (x) = exp 6 x Therefore (u 0 x 6 )0 = 0 and u0 = C . x6 One more integration gives us u=− A C + B = 5 + B. 5x 5 x Recalling that y2 = ux 2 we finally obtain y2 (x) = A + Bx 2 . x3 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Since we are only interested in that part of y2 that is linearly independent of y1 we may take y2 (x) = 1 . x3 Now that we have two linearly independent solution we know from Lemma 2 that the general solution is given by y (x) = c1 y1 (x) + c2 y2 (x) = c1 x 2 + c2 . x3 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Note: In our proof of Lemma 3 we reduced the problem of finding a second solution of y 00 (x) + P(x)y 0 (x) + Q(x)y (x) = 0 to the problem of finding the solution to the homogeneous first order linear ODE y0 u 00 + u 0 P + 2 1 = 0 y1 Because we know how to solve the above even when the right-hand side is non-zero, the following generalization of Lemma 3 is suggested. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Lemma 4 Let y1 (x) be a solution to y 00 (x) + P(x)y 0 (x) + Q(x)y (x) = 0 Then the substitution y (x) = u(x)y1 (x) may be used to find a solution to the inhomogeneous linear ODE y 00 (x) + P(x)y 0 (x) + Q(x)y (x) = R(x). Proof. The proof follows the proof of Lemma 3 mutatis mutandis and lead to the ODE y0 u 00 + u 0 P + 2 1 = R(x) y1 for the function u. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Example Solve the ODE x 2 y 00 + 2xy 0 − 6y = 12x Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients From our previous example we already know two solutions to the homogeneous ODE and we can either take 1 . x3 We will apply Lemma 4 for either choice of y1 . y1 (x) = x 2 or y1 (x) = y1 = x 2 In this case y (x) = u(x)x 2 . By almost of a repeat of our earlier calculations we get x 2 (u 00 x 2 + 4u 0 x + 2u) + 2x(u 0 x 2 + 2ux) − 6ux 2 = 12x. Again cancelling the terms involving u we are left with u 00 x 4 + 6u 0 x 3 = 12x or u 00 + 6 0 12 u = 3. x x 620123 Applied Mathematics (Advanced) S. Ole Warnaar By the same integrating factor as before (I (x) = x 6 ) Introduction (u 0 x 6 )0 = 12x 3 Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients and u0 = C 3 + 2. 6 x x One more integration gives us u= 3 B +A− . x5 x Recalling that y = ux 2 we finally obtain y (x) = A + Bx 2 − 3x. x3 620123 Applied Mathematics (Advanced) S. Ole Warnaar y1 = x −3 Introduction In this case y (x) = u(x)x −3 . Reduction of order Then Second order linear ODEs y 0 = u 0 x −3 − 3ux −4 linear independence Reduction of order Second-order linear ODEs with constant coefficients y 00 = u 00 x −3 − 6u 0 x −4 + 12ux −5 . Substituting this in the ODE gives x 2 (u 00 x −3 −6u 0 x −4 +12ux −5 )+2x(u 0 x −3 −3ux −4 )−6ux −3 = 12x. The terms involving u cancel (as they should) and we are left with u 00 x −1 − 4u 0 x −2 = 12x. or u 00 − 4u 0 x −1 = 12x 2 . 620123 Applied Mathematics (Advanced) An integrating factor is S. Ole Warnaar Z dx = x −4 . I (x) = exp −4 x Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Hence (u 0 x −4 )0 = 12x −2 and u 0 = Cx 4 − 12x 3 . One more integration yields u = Ax 5 + B − 3x 4 . Since y = ux −3 this finally gives y (x) = Ax 2 + as before. B − 3x x3 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients It may be shown that y (x) = Ax 2 + B − 3x x3 corresponds to the general solution of the linear ODE x 2 y 00 + 2xy 0 − 6y = 12x (∗) so that we indeed have “solved the ODE”. Note that x 2 and x −3 correspond to two linearly independent solutions of the homogeneous equation. According to Lemma 2 yH (x) = Ax 2 + B x3 is therefore the complementary function of (∗). Similar to the terminology used for first order linear ODEs we call yP (x) = −3x a particular solution of (∗). We therefore have that the general solution of (∗) is of the form y (x) = yH (x) + yP (x). 620123 Applied Mathematics (Advanced) The previous example is typical and we have the following result S. Ole Warnaar Introduction Reduction of order Theorem 1 The general solution of the second order linear ODE d2 y dy + P(x) + Q(x)y = R(x) dx 2 dx Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients is given by y (x) = yH (x) + yP (x). In the theorem yH (x) refers to the complementary function, i.e., to the general solution of the ODE with R(x) = 0, and yP (x) refers to any particular solution. From Lemma 2 we know that yH (x) is of the form yH (x) = c1 y1 (x) + c2 y2 (x) with y1 and y2 two linearly independent solutions to the homogeneous equation. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs linear independence Reduction of order Second-order linear ODEs with constant coefficients Due to the lack of a general method for finding such a solution our best hope is to 1 Guess (or ask someone really clever) one solution y1 (x) to the homogeneous equation. 2 Apply the substitution y (x) = y1 (x)u(x) to find the general solution of the inhomogeneous equation. The above is exactly what we did in the previous example. There is one special type of second order linear ODEs that we can solve without resorting to guess-work or phoning a clever friend . . . 620123 Applied Mathematics (Advanced) Second-order linear ODEs with constant coeffients S. Ole Warnaar Introduction Reduction of order Definition Second order linear ODEs A second-order linear ODE with constant coefficients is an equation of the form dy d2 y + c y = R(x) (∗) a 2 +b dx dx where a, b, c are constants such that a 6= 0 Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Our general method of solution is as follows. 1 2 Find the complementary function yH , i.e., the solution to (∗) with R(x) = 0. Find a particular solution yP . Note: To find yH there is a method that always works, so that we do no longer need to rely on guesswork or a clever friend. 620123 Applied Mathematics (Advanced) Consider the homogeneous linear ODE with constant coefficients: S. Ole Warnaar Introduction a Reduction of order Second order linear ODEs From Lemma 2 we know that the general solution is of the form Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order d2 y dy +b + c y = 0. dx 2 dx y (x) = c1 y1 (x) + c2 y2 (x) (H) with y1 and y2 two linearly independent solutions. To find these we try y (x) = eλx . Then y 0 (x) = λ eλx and y 00 (x) = λ2 eλx . Substituting this in (H) yields aλ2 eλx + bλ eλx + c eλx = 0. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Since eλx 6= 0 we may divide by eλx to obtain the characteristic equation Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order aλ2 + bλ + c = 0 (C ) There are several possible scenarios. 1 If b 2 − 4ac > 0 then (C ) has two distinct real roots λ1 and λ2 . Hence two linearly independent solutions are y1 (x) = eλ1 x and y2 (x) = eλ2 x . Therefore, by Lemma 2, y (x) = c1 eλ1 x + c2 eλ2 x . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction 2 If b 2 − 4ac = 0 then (C ) has one real root λ1 of multiplicity two. Hence one solution of (H) is given by Reduction of order y1 (x) = eλ1 x . Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order According to Lemma 3 we can find a second, linearly independent solution by reduction of order, i.e., by setting y2 = uy1 . Doing the algebra (homework) this leads to y2 (x) = x eλ1 x . Note: You can also directly verify that this indeed solves (H) (provided that b 2 − 4ac = 0.) By Lemma 2 y (x) = c1 eλ1 x + c2 x eλ1 x = (c1 + c2 x) eλ1 x . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction 3 If b 2 − 4ac < 0 then (C ) has a pair of complex conjugate roots λ1 = α + iβ and λ2 = α − iβ with β 6= 0. Hence two linearly independent solutions are Reduction of order y1 (x) = eαx+iβx and y2 (x) = eαx−iβx . Second order linear ODEs Second-order linear ODEs with constant coefficients Therefore, by Lemma 2, y (x) = c1 eαx+iβx + c2 eαx−iβx = c1 eiβx + c2 e−iβx eαx Homogeneous Inhomogeneous IVP nth order Since eiθ = cos θ + i sin θ We may also write the above solution as y (x) = b1 cos(βx) + b2 sin(βx) eαx (where b1 = c1 + c2 and b2 = i(c1 − c2 )). 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Example 1 Solve y 00 + 7y 0 + 12y = 0 Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order The characteristic equation is λ2 + 7λ + 12 = 0. This has two distinct roots: λ1 = −3 and λ2 = −4. Two linearly independent solutions are thus y1 (x) = e−3x and y2 (x) = e−4x and the general solution is y (x) = c1 e−3x + c2 e−4x . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Example 2 Solve y 00 + 2y 0 + y = 0 Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order The characteristic equation is λ2 + 2λ + 1 = 0. This has a single root of multiplicity two: λ1 = −1. Two linearly independent solutions are thus y1 (x) = e−x and y2 (x) = x e−x and the general solution is y (x) = (c1 + c2 x) e−x . 620123 Applied Mathematics (Advanced) Example 3 S. Ole Warnaar Solve y 00 − 4y 0 + 5y = 0 Introduction Reduction of order The characteristic equation is Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order λ2 − 4λ + 5 = 0. Since λ2 − 4λ + 5 = (λ − 2)2 + 1 this give the complex conjugate pair λ1 = 2 + i and λ2 = 2 − i. Two linearly independent solutions are thus y1 (x) = e2x cos x and y2 (x) = e2x sin x and the general solution is y (x) = c1 cos x + c2 sin x) e2x . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Now that we know how to solve any homogeneous second order linear ODE with constant coefficients we consider several examples of the inhomogeneous counterpart a d2 y dy +b + c y = R(x). dx 2 dx (∗) 620123 Applied Mathematics (Advanced) Example 1 S. Ole Warnaar Solve y 00 + y 0 − 2y = x 2 − 2x + 3 Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order First we solve the homogeneous equation y 00 + y 0 − 2y = 0 with corresponding characteristic equation λ2 + λ − 2 = 0. This has two distinct roots: λ1 = −2 and λ2 = 1. Two linearly independent solutions are thus y1 (x) = e−2x and y2 (x) = ex and the complementary function is yH (x) = c1 e−2x + c2 ex . 620123 Applied Mathematics (Advanced) S. Ole Warnaar According to Lemma 4 we can now find the solution to the inhomogeneous equation by reduction of order, i.e., by taking Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order y (x) = u(x) e−2x or y (x) = u(x) ex . Let us take the second option. Then y 0 = (u 0 + u) ex y 00 = (u 00 + 2u 0 + u) ex . Substituting this into the ODE gives u 00 + 3u 0 = e−x (x 2 − 2x + 3). This is a linear first order ODE for u 0 with integrating factor I (x) = e3x . Hence 0 u 0 e3x = (x 2 − 2x + 3) e2x . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Integrating once this becomes Z 1 0 3x u e = (x 2 − 2x + 3) e2x dx = (2x 2 − 6x + 9) e2x + C 4 so that u0 = 1 (2x 2 − 6x + 9) e−x + C e−3x 4 Integrating a second time we find Homogeneous Inhomogeneous IVP nth order u= 1 (−2x 2 + 2x − 7) e−x + c1 e−3x + c2 . 4 Since y = u ex we have thus found the general solution 1 y (x) = c1 e−2x + c2 ex + (−2x 2 + 2x − 7) = yH (x) + yP (x), 4 with yP (x) = a particular solution. 1 (−2x 2 + 2x − 7) 4 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order The previous method for finding the general solution is somewhat cumbersome and a better method to find yP (x) proceeds as follows. Take the ODE y 00 + y 0 − 2y = x 2 − 2x + 3 (∗) and observe that the function R(x) = x 2 − 2x + 3 is a polynomial. Differentiating the ODE gives y 000 + y 00 − 2y 0 = 2x − 2 (∗∗) and differentiating again gives y (4) + y (3) − 2y 00 = 2. (∗ ∗ ∗) Because the right-hand side is now a constant (in this case 2) it is easy to find a particular solution to (∗ ∗ ∗), namely yP00 = −1. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Substituting this in (∗∗) yields Introduction (0) + (−1) − 2yP0 = 2x − 2 Reduction of order Second order linear ODEs so that 1 yP0 = −x + . 2 Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Substituting this in (∗) yields 1 − 2yP = x 2 − 2x + 3 (−1) + −x + 2 so that yP = 1 (−2x 2 + 2x − 7). 4 Hence we have recovered the previous particular solution. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Note: The above method for finding a particular solution to a second order ODE with constant coefficients always works, provided the function R(x) is a polynomial. Moreover, if the degree of the polynomials is n, then we need to differentiate the ODE n times. In Example 1, R(x) = x 2 − 2x + 3 which is a polynomials of degree 2. Hence we differentiated twice. The following examples show that with a few extra tricks we may also apply the previous method when R(x) is a polynomial times an exponential, R(x) is a polynomial times a simple trigonometric function. 620123 Applied Mathematics (Advanced) Example 2 S. Ole Warnaar Solve y 00 − y = 3x e2x Introduction Reduction of order First we solve the homogeneous equation Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order y 00 − y = 0 with corresponding characteristic equation λ2 − 1 = 0. This has two distinct roots: λ1 = −1 and λ2 = 1. Two linearly independent solutions are thus y1 (x) = e−x and y2 (x) = ex and the complementary function is yH (x) = c1 e−x + c2 ex . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order It is homework to find the general solution by means of Lemma 4, and below we take the alternative approach of finding a particular solution without using the complementary function. Since the right-hand side (i.e., the function R(x)) of Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order y 00 − y = 3x e2x (∗) is not a polynomial, no amount of differentiating will reduce it to a constant. We thus have to get rid of the exponential first. The trick is to put y (x) = u(x) e2x with u(x) an unknown function. Then y 0 = (u 0 + 2u) e2x y 00 = (u 00 + 4u 0 + 4u) e2x . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Substituting this in (∗) and dividing by e2x yields Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order u 00 + 4u 0 + 3u = 3x. (∗∗) Note that this only has a polynomial on the right! To now find a particular solution of (∗∗) we differentiate to get u 000 + 4u 00 + 3u 0 = 3 which has the particular solution uP0 = 1. Substituting this in (∗) gives uP = x − 4/3. Recalling that y = u e2x we thus find the following particular solution to (∗): 4 2x yP (x) = x − e . 3 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Finally, from Theorem 1 we know that the general solution is given by Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order y (x) = yH (x) + yP (x). Therefore 4 2x y (x) = c1 e−x + c2 ex + x − e . 3 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Example 3 Solve y 00 − y = 2x cos x The complementary function is the same as that of Example 2: yH (x) = c1 e−x + c2 ex . It is again homework to find the general solution by means of Lemma 4, and below we (again) take the alternative approach of finding a particular solution without using the complementary function. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order From Example 2 we have learned how to handle a polynomial times an exponential function. This may also be used in the present case by going complex. That is, we first determine a particular solution of z 00 − z = 2x eix Second order linear ODEs Second-order linear ODEs with constant coefficients (∗) and then take the real part of this to get a particular solution of y 00 − y = 2x cos x. Homogeneous Inhomogeneous IVP nth order Using the previous trick we put z(x) = u(x) eix with u(x) an unknown function. Then z 0 = (u 0 + iu) eix z 00 = (u 00 + 2iu 0 − u) eix . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Substituting this in (∗) and dividing by eix yields u 00 + 2iu 0 − 2u = 2x. (∗∗) Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Again this only has a polynomial on the right. To now find a particular solution of (∗∗) we differentiate to get u 000 + 2iu 00 − 2u 0 = 2 which has the particular solution uP0 = −1. Substituting this in (∗∗) gives uP = −x − i. Recalling that z = u eix we thus find the following particular solution to (∗): zP (x) = −(x + i) eix . As a final step we need to take the real part to obtain a particular solution yP (x). 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Now −(x + i) eix = −(x + i)(cos x + i sin x) Second order linear ODEs = (sin x − x cos x) + i(. . . ). Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Therefore yP (x) = sin x − x cos x. Again appealing to Theorem 1 yields the general solution y (x) = c1 e−x + c2 ex + sin x − x cos x. 620123 Applied Mathematics (Advanced) S. Ole Warnaar We have now seen how to find a particular solution of Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients a dy d2 y +b + c y = R(x) dx 2 dx without using the complementary function when R(x) is a polynomial a polynomial times an exponential function a polynomial times a simple trigonometric function. Homogeneous Inhomogeneous IVP nth order The above three cases are enough to also deal with linear combination of the above three types, for example R(x) = x 2 + 2x + 1 + e2x (x + 1) or R(x) = x 3 + cos(2x) + x ex . 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Lemma 5 Reduction of order If yP1 is a particular solution of Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order a d2 y dy +b + c y = R1 (x) dx 2 dx and yP2 is a particular solution of a dy d2 y +b + c y = R2 (x) 2 dx dx then yP = yP1 + yP2 is a particular solution of a d2 y dy +b + c y = R1 (x) + R2 (x). dx 2 dx Proof. Homework 620123 Applied Mathematics (Advanced) Example S. Ole Warnaar Find a particular solution of y 00 − 2y 0 + y = x 2 + 1 + e−2x + cos x Introduction Reduction of order We first find a particular solution of Second order linear ODEs Second-order linear ODEs with constant coefficients y 00 − 2y 0 + y = x 2 + 1. (∗) Hence we differentiate twice to get Homogeneous Inhomogeneous IVP nth order y 000 − 2y 00 + y 0 = 2x (∗∗) and y (4) − 2y 000 + y 00 = 2. Therefore yP001 = 2, so that, by (∗∗) −4 + yP0 1 = 2x. This yields yP0 1 = 2x + 4, so that by (∗) 2 − 2(2x + 4) + yP1 = x 2 + 1. This finally yields yP1 = x 2 + 4x + 7. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Next we find a particular solution of y 00 − 2y 0 + y = e−2x . Hence we set y (x) = u(x) e−2x to get u 00 − 6u 0 + 9u = 1. This obviously has the particular solution uP2 = 1/9 leading to yP2 = 1 −2x e . 9 620123 Applied Mathematics (Advanced) S. Ole Warnaar Finally we find a particular solution of y 00 − 2y 0 + y = cos x. Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Hence we first consider the complex ODE z 00 − 2z 0 + z = eix . If we set z(x) = u(x) eix we get u 00 + 2u 0 (i − 1) − 2iu = 1. This obviously has the particular solutotion uP3 = i/2 leading to zP3 = i ix e . 2 Taking the real part yields 1 yP3 = − sin x. 2 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order According to (an iterated version of) Lemma 5 a particular solution of the ODE is thus yP (x) = yP1 (x) + yP2 (x) + yP3 (x) 1 1 = x 2 + 4x + 7 + e−2x − sin x. 9 2 620123 Applied Mathematics (Advanced) S. Ole Warnaar Now that we know how to solve second order linear ODEs with constant coefficients we can of course also deal with IVPs of this type. Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Example Solve the IVP y 00 + y = cos x y (0) = 2 y 0 (0) = −3 First we solve the homogeneous equation y 00 + y = 0 with corresponding characteristic equation λ2 + 1 = 0. This has the pair of complex conjugate roots λ1 = −i and λ2 = i. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Two linearly independent solutions are thus Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order y1 (x) = e−ix and y2 (x) = e−ix (∗) y1 (x) = cos x and y2 (x) = sin x. (∗∗) but also You are of course free to choose either (∗) or (∗∗). Taking the second pair, the complementary function is yH (x) = c1 cos x + c2 sin x. 620123 Applied Mathematics (Advanced) S. Ole Warnaar For the sake of variation let us use Lemma 4 to find the general solution. Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order It is homework to find the particular solution without using the complementary function. For this problem this is actually the quicker method. We set y (x) = u(x) sin x. (It is homework to try y (x) = u(x) cos x.) Then y 0 = u 0 sin x + u cos x y 00 = u 00 sin x + 2u 0 cos x − u sin x. Substituting this in the ODE gives the first order linear ODE (in u 0 ) u 00 sin x + 2u 0 cos x = cos x. 620123 Applied Mathematics (Advanced) S. Ole Warnaar The canonical form is Introduction u 00 + 2u 0 cotan x = cotan x Reduction of order Second order linear ODEs leading to the integrating factor Second-order linear ODEs with constant coefficients Z I (x) = exp 2 cotan x dx = exp 2 log|sin x| Homogeneous Inhomogeneous IVP nth order = sin2 x. Therefore (u 0 sin2 x)0 = cos x sin x and 0 2 u sin x = Z sin x cos x dx = 1 2 sin x − c1 . 2 620123 Applied Mathematics (Advanced) S. Ole Warnaar Dividing by sin2 x this yields Introduction u0 = Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order 1 c1 − 2 . 2 sin x Hence 1 x + c1 cotan x + c2 . 2 Since y = u sin x we finally get u= y (x) = 1 x sin x + c1 cos x + c2 sin x. 2 To fix c1 and c2 we use the initial conditions to find c1 = 2 and c2 = −3 so that y (x) = 1 x sin x + 2 cos x − 3 sin x. 2 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Our final example shows that nearly everything we have done so far extends to nth order linear ODEs with constant coefficients. Example Solve the fourth order ODE y (4) + y (3) − y 00 + y 0 − 2y = x Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order First we solve the homogeneous equation y (4) + y (3) − y 00 + y 0 − 2y = 0 with corresponding characteristic equation λ4 + λ3 − λ2 + λ − 2 = 0. Since λ4 + λ3 − λ2 + λ − 2 = (λ − 1)(λ + 2)(λ2 + 1) this has four distinct roots λ1 = 1, λ2 = −2, λ3 = −i, λ4 = i. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction Reduction of order Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order Four linearly independent solutions are thus y1 (x) = ex , y2 (x) = e−2x , y3 (x) = e−ix , y4 (x) = eix but also y1 (x) = ex , y2 (x) = e−2x , y3 (x) = cos x, y4 (x) = sin x. Choosing the latter, the complementary function may be written as yH (x) = c1 ex + c2 e−2x + c3 cos x + c4 sin x. 620123 Applied Mathematics (Advanced) S. Ole Warnaar Introduction To find a particular solution we differentiate the ODE: Reduction of order y (5) + y (4) − y 000 + y 00 − 2y 0 = 1 Second order linear ODEs Second-order linear ODEs with constant coefficients Homogeneous Inhomogeneous IVP nth order so that yP0 = − 12 . Substituting this in the original ODE yields 1 yP (x) = − (2x + 1) 4 so that 1 y (x) = c1 ex + c2 e−2x + c3 cos x + c4 sin x − (2x + 1). 4