MA156 - Mathematical Methods for Physical Sciences Second Order Ordinary Differential Equations Contents 1 Introduction 1.1 Some definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Initial conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 2 2 Equations reducible to first order 2.1 Dependent variable missing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Independent variable missing . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 5 3 Second order linear differential equations 3.1 Homogeneous equations . . . . . . . . . . . . . . 3.2 Nonhomogeneous equations . . . . . . . . . . . . 3.2.1 The method of undetermined coefficients 3.2.2 Method of variation of parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7 12 14 19 4 The Euler Equation 22 A 24 How to find a second solution of a linear differential equation MA156 - Ordinary Differential Equations 1 1.1 2 Introduction Some definitions An Ordinary Differential Equation (ODE) is a relationship between an independent variable x, an unknown dependent variable y(x) and one or more derivatives of y. Examples of ordinary differential equations are dy + 3 sin(x)y = 0 dx dy d2 y + x2 + y = x2 . 2 dx dx and We have solved a differential equation when we have found all possible functions y = y(x) which satisfy the equation. The derivative of the dependent variable can be written in many different ways. I will use the following three: dy , dx y0, ẏ. The last one usually means derivative with respect to time. The order of a differential equation is the order of the highest derivative occurring in it. Thus the two previous equations are respectively of first and second order. A very important class of differential equations are the linear equations. Their importance is not only that they comprise nearly all the equations that we know how to solve. They are ubiquitous in the description of physical phenomena whenever we try to study small deviations from an equilibrium state. A differential equation is linear if the dependent variable and all its derivatives appear only linearly in it, i.e. the are not raised to any power different from one and they are not multiplied by each other. The two equations above are both linear. The equations y dy + x2 y = sin(x) dx and d2 y + dx2 dy dx 2 + √ y=0 are both non linear. The first because it contains the product of the dependent variable and its derivative, the second because the last two terms are nonlinear. 1.2 Initial conditions The are many physical problems that can be modelled by using simple differential equations. As an example, consider a stone in free fall: its acceleration y 00 is equal to the acceleration of gravity g, a constant. Hence the model of this problem of “free fall” is d2 y = g. dt2 (1) This is a good approximation if the object is heavy and its speed is relatively small. If these two conditions are not satisfied, for example if we drop a feather instead of a stone, then we should include in the model the air resistance. If you think of a ball falling on the ground you realise that it is not enough to give the equation of motion in order to describe the ball’s behaviour. The equation is always the same, namely Eq. (1), but the possible motions are completely different. In order to specify in a MA156 - Ordinary Differential Equations 3 unique way the ball’s trajectory we need not only to give the equation of motion but also the initial conditions: we must specify where the ball starts falling from and with what speed. What is the mathematical translation of this physical statement? To solve Equation (1) we need to integrate twice with respect to time. The first integration gives Z t 2 Z t d y dy dτ = gdτ =⇒ (2) = gt + v0 , 2 dt 0 dτ 0 where v0 is the integration constant. At this stage it is not specified and it can assume any real value. In order to obtain y(t), the position as a function of time, we must integrate once again with respect to time: Z t Z t dy 1 (gτ + v0 ) dτ =⇒ y(t) = gt2 + v0 t + y0 , (3) dτ = 2 0 dτ 0 where y0 is a second integration constant. In other words, all the possible solutions of Equation (1) can be written as: 1 y(t) = y0 + v0 t + gt2 , 2 where y0 and v0 are two integration constants. In order to specify a unique trajectory we must fix these two constants. In order to do so we must specify two initial conditions, namely the initial position of the ball and its initial velocity. For example, suppose that the ball starts from a height of 1m with velocity 10m/s. From Equation (2) we obtain that at t = 0 its velocity is v(t = 0) = v0 =⇒ v0 = 10m/s. From Equation (3) we obtain that at t = 0 the ball’s position is y(t = 0) = y0 =⇒ y0 = 1m. We thus have two results. The trajectory of the particle is given by 1 y(t) = gt2 + 10 t + 1, 2 where time is measured in seconds and distances in meters. Moreover, we now know the physical meaning of the two integration constants: v0 is the initial velocity, y0 is the initial position. We have successfully and completely translated a physical problem and the physical intuition we have of it in a mathematical model. The take home message is that when solving a differential equation it is usually not sufficient to know the form of the equation in order to have a unique solution. We must also specify the value of the dependent variable and/or of its derivatives at certain points. If the function and its derivatives are specified at the start of the trajectory we talk of an initial value problem. The ball in free fall is an initial value problem. For linear equations the number of initial conditions that must be specified in order to have a unique solution is equal to the order of the equation. In the free fall problem, described by a second order differential equation, we need two initial conditions, the initial velocity and height. MA156 - Ordinary Differential Equations 2 4 Equations reducible to first order Some second order differential equations are only apparently second order and can be transformed, by a suitable change of variable, into a first order differential equation. We will consider to types of such equations. 2.1 Dependent variable missing A second order Ordinary Differential Equation of the form F (y 00 , y 0 , x) = 0, where y is a function of the independent variable x, y(x), can be reduced to a first order differential equation by a change of the dependent variable. Let v= dy , dx and consider v(x) as the “unknown function”, solution of the first order differential equation dv F , v, x = 0. dx Once v(x) has been found, the original unknown function y(x) can be obtained by integrating v(x): Z y(x) = v(x) dx. Example 1 - Find the general solution of xy 00 − y 0 = 3x2 . (4) Introduce the variable z = y 0 so that (4) becomes xz 0 − z = 3x2 . The solution of this equation can be obtained by dividing both sides by x2 : 1 0 z d z z z − 2 = 3 =⇒ = 3 =⇒ = 3x + C1 =⇒ z = 3x2 + C1 x, x x dx x x where the integration constant C1 is fixed by the initial condition on z = y 0 . The functional form of y(x) can be obtained by integrating z(x): z= dy C1 2 dy =⇒ = 3x2 + C1 x =⇒ y(x) = x3 + x + C2 . dx dx 2 Example 2 - Solve the initial value problem 2 d2 y dy =x , y(0) = 1, y 0 (0) = −2. 2 dx dx Introduce the variable v(x) = y 0 (x). The differential equation for v(x), v 0 = xv 2 , MA156 - Ordinary Differential Equations 5 can be solved by separations of variables: dv 2 = xdx =⇒ v(x) = − 2 . 2 v x + C1 The value of C1 is determined by the initial value of y 0 (x): y 0 (0) = v(0) = −2 =⇒ −2 = − 2 2 =⇒ C1 = 1 =⇒ v(x) = − . C1 1 + x2 The solution of the original problem, y(x) is the integral of v(x): Z dy 2 v(x) = dx = −2 arctan(x) + C2 . =⇒ y(x) = − dx 1 + x2 Finally, the integration constant C2 is determined by the last initial condition: y(0) = 1 =⇒ y(0) = −2 arctan(0) + C2 = 1 =⇒ C2 = 1. Therefore the solution to the initial value problem is y(x) = −2 arctan(x) + 1. 2.2 Independent variable missing A second order Ordinary Differential Equation of the form F (y 00 , y 0 , y) = 0, where y is a function of the independent variable x, y(x), can be reduced to a first order differential equation by a change of both the dependent and the independent variable. Let v= dy , dx but consider v function of y and not of x: v(y). Using the chain rule we can transform y 00 into a first order derivative of v(y): d2 y dv dv dy dv = = =v , 2 dx dx dy dx dy so that the original second order equation becomes the first order equation: dv F v , v, y = 0. dy Once v(y) has been found, y(x) can be obtained by solving the separable equation v(y) = dy . dx Example 1 - Find the general solution of y 00 − 2yy 0 = 0. Introduce v(y) = dy , dx MA156 - Ordinary Differential Equations 6 replace y 00 with vdv/dy and obtain: dv v − 2vy = 0 =⇒ dy dv − 2y v(y) = 0. dy This equation has two solutions: (a) v(y) ≡ 0 ∀y. The function y(x) that corresponds to this solution can be obtained by integrating dy = v(y) = 0 =⇒ y(x) = C. dx (b) The other possibility is dv − 2y = 0 =⇒ v(y) = y 2 + C1 . dy The function y(x) that corresponds to this solution can be obtained by integrating dy dy = dx =⇒ = v(y) = y 2 + C1 =⇒ 2 dx y + C1 √ √ y(x) = C1 tan C1 (x + C2 ) . Example 2 - Solve the initial value problem y 00 − 2yy 0 = 0, y(0) = 0, y 0 (0) = 1. This equation has been studied in the previous example. The first solution, y(x) = C, cannot satisfy the initial conditions and must be excluded. The constant C1 in the second solution is fixed by making use of both initial conditions. At x = 0 we have y(0) = 0, v[y(0)] = [y(0)]2 + C1 = C1 , =⇒ =⇒ C1 = 1. y 0 (0) = 1, v[y(0)] = y 0 (0) = 1, The constant C2 is fixed by using the initial condition on y(x): y(0) = 0: y(0) = tan(0 + C2 ) = 0 =⇒ C2 = 0. Therefore the solution is y(x) = tan(x). 3 Second order linear differential equations We will consider only linear second order differential equations with constant coefficients, ay 00 + by 0 + cy = f (x), (5) where a, b and c are constants(a 6= 0) and f (x) is a known function of the independent variable x. If f (x) ≡ 0 then (5) can be written as ay 00 + by 0 + cy = 0, MA156 - Ordinary Differential Equations 7 and is called homogeneous. If f (x) is not identically zero Equation (5) is called non-homogeneous. The function f (x) is called then non-homogeneous term or the forcing term. The reason why we study only linear equations with constant coefficients is that they are the most important second order equations that it is possible to solve in a standard way. In fact, while it is always possible to solve a first linear equation, even if its coefficients are not constant, this is no longer true for second order equations. A quick reminder of the consequences of linearity: 1. If y1 (x) and y2 (x) are two solutions of (5) with f (x) = 0 then any linear combination of them, y(x) = α y1 (x) + β y2 (x), is a solution of (5) whatever the values of the two real numbers α and β. 2. Equation (5) has two solutions that are linearly independent, that is, they are not a multiple of each other. If we call y1 (x) and y2 (x) these two linearly independent solutions then the general solution of Equation (5) with f (x) = 0 is y(x) = C1 y1 (x) + C2 y2 (x), where the two integration constants C1 and C2 are fixed by the boundary conditions. 3.1 Homogeneous equations The method of solution of a second order homogeneous equation with constant coefficients, a d2 y dy +b + cy(x) = 0, dx2 dx (6) is to suppose that the solution is an exponential, y = emx . If we substitute this expression into (6) we obtain that the exponent m must satisfy the equation a m2 + b m + c = 0. This is known as the auxiliary equation. It is a quadratic for m and gives two roots m1 and m2 that correspond to the two linearly independent solutions. The relation between the roots of the auxiliary equation and the linearly independent solution of the homogeneous equation (6) is Roots Solutions em1 x y2 (x) = em2 x Distinct real, m1 and m2 . y1 (x) = Complex conjugate, m1,2 = α ± iω y1 (x) = eαx cos(ωx) y2 (x) = eαx sin(ωx) Real double root, m y1 (x) = emx y2 (x) = xemx The first two cases are relatively straightforward. The auxiliary equations has two roots that correspond to two linearly independent solutions of the homogeneous equation. If the MA156 - Ordinary Differential Equations 8 roots are real the two linearly independent solutions are two real exponentials. If the roots are complex the linearly independent solutions are complex exponentials: ŷ1 (x) = eαx eiωx m1,2 = α + iω = ŷ2 (x) = eαx e−iωx Often it is more convenient to have to deal with two real solutions. It is possible to repackage ŷ1 (x) and ŷ2 (x) into two real functions using the property of (6) that any linear combination of ŷ1 (x) and ŷ2 (x) is a solution. Therefore y1 (x) = ŷ1 (x) + ŷ2 (x) = eαx cos(ωx), 2 y2 (x) = ŷ1 (x) − ŷ2 (x) = eαx sin(ωx), 2i are two linearly independent solutions of (6). The last case is a little bit more complex: the auxiliary equation has only one root 2 [b − 4ac = 0] and, therefore, we can write only one solution of the differential equation, y1 (x) = emx . However, we know that the equation must have two linearly independent solutions. To find the second solution we can use the method described in Appendix A. The solution given by the auxiliary equation is y1 (x) = e−(b/2a)x . Therefore we write the second linearly independent solution as y2 (x) = v(x)y1 (x) = v(x)e−(b/2a)x . If we substitute this expression and its derivatives, y2 (x) = v(x)e−(b/2a)x , b v(x)e−(b/2a)x , 2a b b2 − v 0 (x)e−(b/2a)x + 2 v(x)e−(b/2a)x , a 4a y20 (x) = v 0 (x)e−(b/2a)x − y200 (x) = v 00 (x)e−(b/2a)x into (6) we obtain that v(x) satisfies the equation 2 b av 00 + − + c v = 0 =⇒ v 00 = 0, 4a since b2 − 4ac = 0. The solutions of this equations are v1 (x) = k and v2 (x) = x, where k is a constant. The two solutions y2 (x) that correspond to these forms of v(x) are y2 (x) = ky1 (x), not linearly independent, −(b/2a)x y2 (x) = xy1 (x) = xe , linearly independent. The first one is not acceptable because it is not linearly independent from y1 (x). The second is the solution we are looking for. Therefore the two linearly independent solutions of (6) if the auxiliary equation has a repeated root are y1 (x) = emx and y2 (x) = xemx . MA156 - Ordinary Differential Equations 9 Example 1 - Solve the initial value problem y 00 + y 0 − 2y = 0, y(0) = 4, y 0 (0) = 5. The auxiliary equation, m2 + m − 2 = 0, has two real roots, −1 + m1 = 2 √ 9 = 1 and −1 − m2 = 2 √ 9 = −2, so that the general solution is y(x) = C1 ex + C2 e−2x . To fix the two integration constants we must satisfy the initial conditions. The first step is to evaluate the derivative of y(x): y 0 (x) = C1 ex − 2C2 e−2x . We can now use the initial conditions to find the two integration constants: y(0) = 4 =⇒ C1 + C2 = 4, y 0 (0) = −5 =⇒ C1 − 2C2 = −5. The values of the integration constants are C1 = 1 and C2 = 3, so that the solution of the initial value problem is y(x) = ex + 3e−2x . Example 2 - Solve the initial value problem y 00 − 4y 0 + 4y = 0, y(0) = 3, y 0 (0) = 1. The auxiliary equation, m2 − 4m + 4 = 0 has a repeated root, m = 2. Therefore the general solution is y(x) = (C1 + C2 x)e2x . The derivative of the solution is y 0 (x) = C2 e2x + 2(C1 + C2 x)e2x . From the initial conditions it follows that y(0) = C1 = 3 and y 0 (0) = C2 + 2C1 = 1, so that C1 = 3, C2 = −5 and the solution of the initial value problem is (3 − 5x)e2x . MA156 - Ordinary Differential Equations 10 Example 3 - Find the general solution of y 00 − 2y 0 + 10y = 0. The auxiliary equation m2 − 2m + 10 = 0 has roots m1,2 = 1 ± 3i. Therefore the two linearly independent solutions are y1 (x) = ex cos(3x) and y2 (x) = ex sin(3x). The general solution is a linear combination of the two, y(x) = ex [C1 cos(x) + C2 sin(x)]. We could have also use a complex notation and say that the two independent solutions are y1 = e(1+3i)x and y2 = e(1−3i)x , while the general solution is y(x) = D1 e(1+3i)x + D2 e(1−3i)x . Example 4 - Until now we have always considered initial value problems. However, applications sometimes lead to conditions of the type y(P1 ) = k1 and y(P2 ) = k2 . These are known as boundary conditions, since they refer to the endpoints P1 and P2 (boundary points P1 and P2 ) of the interval I where the differential equation is considered. The ensemble of a differential equation and the boundary conditions constitute a boundary value problem. As an example we can solve the boundary value problem y 00 + y = 0, y(0) = 3, y(π/2) = −3. The general solution of the differential equation is y(x) = C1 cos(x) + C2 sin(x). The left boundary condition gives y(0) = C1 = 3. The right hand boundary condition gives y(π/2) = C2 = −3. Therefore the solution of the boundary value problem is y(x) = 3 cos(x) − 3 sin(x). Remark - It is true that two initial conditions are all that is needed to find a unique solution to a second order linear differential equation. However, two boundary conditions may not be enough: if the boundary conditions in the previous example had been y(0) = 3, y(π) = −3, MA156 - Ordinary Differential Equations 11 v -c v -kx m x 0 Figure 1: A trolley of mass m is attached to an ideal spring that pulls it with a force F = −kx. The fluid in which it is moving exerts a viscous drag, FD = −cv, where v = ẋ is the speed of the trolley. then it would have been impossible to fix the integration constant C2 . If they had been y(0) = 3, y(π) = 3, the boundary value problem would not have had a solution. Example 5 - A trolley is attached to a spring (see Figure 1) that exerts a force on it proportional to the displacement and pulls it towards the origin, Fs = −kx. The apparatus is placed in a bowl of liquid that exerts a drag resistance on the trolley, a force proportional to the trolley speed and pointing in the opposite direction: FD = −cẋ. Newton law relates the acceleration to the forces acting on the body: mẍ = Fs + FD = −kx − cẋ. Therefore the motion of the trolley is described by the second order linear differential equation with constant coefficients mẍ + cẋ + kx = 0. We would now like to discuss the possible types of motions as a function of the model parameters, namely of the viscosity of the liquid. The more viscous the liquid, the stronger the drag force. Therefore we expect that for small viscosity, i.e. small c, the motion of the trolley is a slowly damped oscillatory motion. If however, the drag force coefficient is very big, then the trolley does not oscillate, but slowly moves back towards the origin. The auxiliary equation is mλ2 + cλ + k = 0, MA156 - Ordinary Differential Equations 12 and has roots λ1,2 = − c 1 p 2 c − 4mk. ± 2m 2m We write these √ exponents as λ1,2 = −α ± β, where α = c/(2m) is a positive real number. β = 1/(2m) c2 − 4mk can be either real or imaginary. We distinguish three cases: 1. (Overdamping) If the damping c is so large that c2 > 4mk then β is real and there are two distinct real roots of the auxiliary equation. The solution is a combination of two decaying exponentials y(t) = C1 e−(α−β)t + C2 e−(α+β)t . The viscous drag is too strong and the trolley slowly goes back to the origin (continuous line on Figure 2). 2. (Critical damping) If c2 = 4mk then β = 0 and the general solution of the dynamical equation is y(t) = (C1 + C2 x)e−αt . The motion is again a decaying exponential (dotted line in Figure 2): the trolley cannot oscillate and tends towards the origin. This case, however, marks the border between non oscillatory motion and oscillations. This explains its name. 3. (Underdamping) If, finally, the damping constant c is so small that c2 < 4mk, then β is purely imaginary, r k c2 β = iβ̄, β̄ = , − m 4m2 and the general solution of the trolley equation is y(t) = e−αt [C1 cos(β̄t) + C2 sin(β̄t)]. The trolley oscillates backwards and forwards around the origin, while the amplitude of the oscillations decreases slowly in time (dashed line in Figure 2). 3.2 Nonhomogeneous equations The typical form of a nonhomogeneous linear equation with constant coefficients is ay 00 + by 0 + cy = f (x). The general solution of this equation can be written as y(x) = yCF (x) + yp (x), where yCF (x) is the complementary function, the general solution of the associated homogeneous problem, ay 00 + by 0 + cy = 0. MA156 - Ordinary Differential Equations 13 1.5 1.0 x(t) 0.5 0.0 -0.5 -1.0 0 5 10 time 15 20 Figure 2: Three possible motions for the trolley in Example 5: overdamped (solid line), critically damped (dotted line) and underdamped (dashed line). The function yp (x) is a particular integral of the nonhomogeneous equation, a solution that you have either guessed or obtained in some way. Example - Solve the initial value problem y 00 + 3y 0 + 2y = 4, y(0) = 1, y 0 (0) = 0. The procedure to solve these problems is always the same: 1. Find the complementary function, i.e. the solution of the associated homogeneous problem: y 00 + 3y 0 + 2y = 0. The auxiliary equation is m2 + 3m + 2 = 0 and has roots m1 = −1 and m2 = −2. Therefore the complementary function is yCF (x) = C1 e−x + C2 e−2x . 2. Find a particular integral. The function y(x) = 2 is a solution. As we have complete freedom in choosing the particular integral, we can just as well use this very simple function: yp (x) = 2. 3. Write the general solution. The general solution is the sum of the complementary function and of the particular integral: y(x) = C1 e−x + C2 e−2x + 2. MA156 - Ordinary Differential Equations 14 4. Impose the initial conditions. We need the derivative of the solution: y 0 (x) = −C1 e−x − 2C2 e−2x . We can now impose the boundary conditions: y(0) = C1 + C2 + 2 = 1, C1 = −2, =⇒ y 0 (0) = −C1 − 2C2 = 0, C2 = 1. Therefore the solution of the initial value problem is y(x) = −2e−x + e−2x + 2. From this example we see that the extra difficulty in solving nonhomogeneous equations is to find a particular solution. We will discuss two methods: one is less general, but simpler, it is called the method of undetermined coefficients. The other can be applied to any nonhomogeneous term and also to linear equations with non constant coefficients. However, it is more difficult to apply and it generally returns the particular solution in the form of an integral that is impossible to solve. It is called the Variation of parameters method. 3.2.1 The method of undetermined coefficients Given the constant coefficients linear equation ay 00 + by 0 + cy = f (t), where f (t) is an exponential, a simple sinusoidal function, a polynomial or a product of these functions: 1. Solve the homogeneous equation for a pair of linearly independent solutions y1 (t) and y2 (t). 2. if f (t) is not a solution of the homogeneous equation, take trial solution of the same type as f (t) according to the suggestions given in the table below. 3. If f (t) is a solution of the homogeneous equation, take a trial solution of the same type of f (t) multiplied by the lowest power of t for which no term of the trial solution is a solution of the homogeneous equation. 4. Substitute the trial solution into the differential equation and solve for the undetermined coefficients so that it is a particular solution yp (t). 5. The general solution is y(t) = yp (t) + c1 y1 (t) + c2 y2 (t), where the constants c1 and c2 can be determined if initial conditions are given. 6. if f (t) is a sum of non-homogeneous terms of the type described above, split the problem into simpler parts. Find a particular solution for each part, then add the particular solutions to obtain yp (t). MA156 - Ordinary Differential Equations Non-homogeneous term aert a sin(ωt), a cos(ωt) atn , n > 0 integer atn ert , n > 0 integer tn [a sin(ωt), +b cos(ωt)] ert [a sin(ωt), +b cos(ωt)] Pn (t) 15 Trial solution Aert A sin(ωt) + B cos(ωt) Pn (t) Pn (t)ert Pn(1) (t) sin(ωt) + Pn(2) (t) cos(ωt) ert [A sin(ωt) + B cos(ωt)] is a polynomial of degree n in t. Example 1 Polynomial non-homogeneous term: f (t) = an tn + an−1 t(n−1) + . . . + a1 t + a0 . y 00 − y 0 − 2y = t The solution of the homogeneous equation is yCF (x) = C1 e2t + C2 e−t . A guess of the particular solution is yp (t) = At + B. Plug this guess into the equation and see what happens: yp0 (t) = A, yp00 (t) = 0, yp00 − yp0 − 2yp = t, =⇒ −A − 2At − 2B = t. This last equation must be valid for all values of t. Two polynomials in t are equal for all t only if the coefficients of equal powers of t are equal. Therefore, the last equation is equivalent to two equations, one for the coefficient of t, one for the constant term (coefficient of t0 ): −2A = 1, A = −1/2, =⇒ −A − 2B = 0, B = 1/4. The particular solution is yp (t) = −t/2 + 1/4. Example 2 Exponential forcing term: f (t) = aert . y 00 − 4y = 6et The solution of the associated homogeneous equation is yCF (x) = C1 e−2t + C2 e2t . A guess of the particular solution is yp (t) = Aet . In this case yp0 = Aet , yp00 = Aet , yp00 − 4yp = 6et , =⇒ A − 4A = 6, =⇒ A = −2. The particular solution is yp (t) = −2et . Example 3 Sinusoidal forcing term: f (t) = A sin(ω1 t) + B cos(ω2 t). y 00 − 2y 0 + y = sin(ωt) MA156 - Ordinary Differential Equations 16 The solution of the associated homogeneous equation is yCF (x) = (C1 + C2 t)et . A guess of a particular solution is yp (t) = A sin(ωt) + B cos(ωt). yp0 (t) = ωA cos(ωt) − ωB sin(ωt), yp00 (t) = −ω 2 A sin(ωt) − ω 2 B cos(ωt), y 00 − 2y 0 + y = sin(ωt), =⇒ (−ω 2 A + 2ωB + A) sin(ωt) + (−ω 2 B − 2ωA + B) cos(ωt) = sin(ωt) This last equation must be satisfied for all t. This implies that the coefficients of the sines and cosines on the left and on the right hand side must be equal. −ω 2 A + 2ωB + A = 1, =⇒ −ω 2 B − 2ωA + B = 0, =⇒ A = 1 − ω2 , (1 + ω 2 )2 B= 2ω . (1 + ω 2 )2 Example 4 The forcing term is a solution of the associated homogeneous equation. y 00 + y = cos(t) Two linearly independent solutions of the associated homogeneous equation are: y1 (t) = cos(t) and y2 (t) = sin(t) The forcing term has the same form as y1 (t) and so we cannot use the standard guess yp (t) = A cos(t) + B sin(t) as we did in the previous example (why?). The way out of this bind is to use as a guess the function yp (t) = t[A cos(t) + B sin(t)]. yp0 (t) = A cos(t) + B sin(t) + t[−A sin(t) + B cos(t)], yp00 (t) = −A sin(t) + B cos(t) − A sin(t) + B cos(t) + t[−A cos(t) − B sin(t)], yp00 + yp = cos(t) =⇒ −2A sin(t) + 2B cos(t) − t[A cos(t) + B sin(t)] + t[A cos(t) + B sin(t)] = cos(t) =⇒ =⇒ A = 0, B = 1/2. 1 A particular solution is then: yp (t) = t sin(t). 2 Example 5 - Forced oscillations and resonance Consider once again the trolley in Figure 1, but assume that an external force F (t) is acting on it, pulling it backwards and forwards with frequency ω and amplitude F0 : F (t) = F0 cos(ωt). The equation of motion of the trolley subject to this force is mẍ + cẋ + kx = F0 cos(ωt). (7) MA156 - Ordinary Differential Equations 17 We would like to study the effects of the periodic forcing term. The general solution is the sum of the general solution of the homogeneous problem plus a particular solution. In the underdamped case the solution of the homogeneous equation is yCF (t) = e−αt [C1 cos(β̄t) + C2 sin(β̄t)], p where α = c/2m and β̄ = k/m + c2 /(4m2 ). The trolley oscillates with a frequency β̄ and the amplitude of the oscillations decays with a decay rate equal to α. Using the method of undetermined coefficients we can obtain a particular solution. A guess of the solution is yp (t) = A cos(ωt) + B sin(ωt). Substituting this expression and is derivatives into (7) we can write [−Amω 2 + Bcω + kA] cos(ωt) + [−Bmω 2 − Acω + kB] sin(ωt) = F0 cos(ωt). Equating the coefficients of cos(ωt) and sin(ωt) on both sides we obtain that A = F0 m(ω02 − ω 2 ) , m2 (ω02 − ω 2 ) + c2 ω 2 B = F0 cω , m2 (ω02 − ω 2 ) + c2 ω 2 (8) p where ω0 ≡ k/m is called the natural frequency of the trolley: it is the frequency at which it would oscillate if there was no damping. The general solution of (7) is y(t) = e−αt [C1 cos(β̄t) + C2 sin(β̄t)] + m(ω 2 − ω 2 ) cω F0 2 2 0 2 cos(ωt) + F0 2 2 sin(ωt). 2 2 m (ω0 − ω ) + c ω m (ω0 − ω 2 ) + c2 ω 2 We can see in Figure 3 what is going on. There is a transient during which the oscillation at frequency β̄ decays. After a little time they become negligible and the trolley oscillates with constant amplitude and frequency ω. Figure 4, instead, is a plot of the amplitude of the trolley oscillations. You can see that as the frequency of the forcing term ω gets closer and closer to the natural frequency of the system the amplitude of the oscillations grows. This phenomenon is called resonance and is one of the most widespread and “amusing” physical effects: it is responsible for the sound that comes out of mechanical musical instruments, for the possibility of tuning a television or radio to a certain station, for the breaking of bridges. The maximum amplitude of the oscillations is inversely proportional to the damping coefficient: the smaller the damping the bigger the oscillations. Example 6 - Projectile with air resistance. We choose Cartesian coordinates with the origin at the launch site, the x-axis in the horizontal direction and the y-axis vertically upward (see Figure 5). Let the initial velocity of the projectile be v 0 with magnitude v0 and angle θ between v and the positive x-axis. Let v(t) denote the velocity at time t with t = 0 when the motion starts. Then v(t) = ẋ(t)i + ẏ(t)j. We assume that the air resistance is directly proportional to the speed of the projectile, but in the opposite direction. Moreover, we assume that the maximum height of the projectile is sufficiently small so that the acceleration of gravity g can be considered constant. MA156 - Ordinary Differential Equations 18 2 1.0 Final Amplitude x(t) ω0=4.0 0.8 1 0 -1 0.6 0.4 0.2 -2 0 20 40 60 80 100 0.0 0 2 time Figure 3: Trajectory of the trolley subjected to a periodic force 4 6 Forcing frequency 8 10 Figure 4: Amplitude of the trolley asymptotic oscillations as a function of the forcing frequency. The three curves correspond to increasing values of the damping coefficient, c, the solid line being the case with the smallest coefficient. 10 y 8 y 6 v 4 2 θ j i 0 0 x Figure 5: Variables and parameters of the projectile example. 10 20 x 30 40 Figure 6: Orbits of a projectile for various drag coefficients: the solid line corresponds to the smallest coefficient, the dashed line to the biggest. MA156 - Ordinary Differential Equations 19 By Newton’s second law of mechanics mass × acceleration = Total external force we have m dv = −kv(t) − mgj, dt where m denotes the mass of the projectile and k is its drag coefficient. The initial velocity is v(t = 0) = v 0 = v0 cos(θ)i + v0 sin(θ)j. Separating the components of the equation of motion gives dẋ k = − ẋ, ẋ(0) = v0 cos(θ), dt m dẏ = − k ẏ − g, ẏ(0) = v0 sin(θ), dt m whose solutions are , ẋ(t) = v0 cos(θ)e−(k/m)t mg m k ẏ(t) = − sin(θ) e−(k/m)t . + g + v 0 k k m (9) By choice of the coordinate axes we also have that x(0) = y(0) = 0, so that, integrating (9) with respect to time we obtain i h m x(t) = v0 cos(θ) 1 − e−(k/m)t , k h i m 2 mg k y(t) = − g + v0 sin(θ) 1 − e−(k/m)t . t+ k k m Figure 6 shows a few trajectories for different drag coefficients. 3.2.2 Method of variation of parameters This is a general method: it works for all linear second order differential equations, but one must know the general solution of the associated homogeneous problem. Suppose we are looking for a particular solution of a(t)y 00 + b(t)y 0 + c(t)y = f (t) (10) and that we know two linearly independent solutions, y1 (t) and y2 (t), of the associated homogeneous equation, a(t)y 00 + b(t)y 0 + c(t) = 0 We write the particular solution as: yp (t) = u1 (t)y1 (t) + u2 (t)y2 (t) , MA156 - Ordinary Differential Equations 20 where u1 (t) and u2 (t) are two functions that we need to determine by substituting yp (t) into (10). In order to do this we need the first and second derivative of yp (t). The first derivative is: yp0 (t) = u1 y10 + u2 y20 + u01 y1 + u02 y2 We are looking for one particular solution of the non-homogeneous equation. However we are using two functions, u1 (t) and u2 (t) to achieve this aim. This gives us a lot of freedom in choosing these two functions and we can use it to simplify the first derivative of yp (t). We choose two functions u1 (t) and u2 (t) such that u01 y1 + u02 y2 = 0 , (11) so that the first derivative of the particular solution is “simply”: yp0 (t) = u1 y10 + u2 y20 The second derivative is: yp00 (t) = u1 y100 + u2 y200 + u01 y10 + u02 y20 When we substitute yp (t) and its derivatives into (10) a lot of terms cancel out: a(t)yp00 + b(t)yp0 + c(t)yp = f (t) ⇒ u1 (t) [ay100 + by10 + cy1 ] + u2 (t) [ay200 + by20 + cy2 ] + a(t)[u01 y10 + u02 y20 ] = f (t) ⇒ a(t)[u01 y10 + u02 y20 ] = f (t) . (12) [ The boxed terms are both zero because y1 and y2 are solutions of the homogeneous equation associated to (10). ] At this stage we have established two equations that must be satisfied by the two unknown functions u1 (t) and u2 (t), namely Equations (11) and (12). 0 0 u1 y1 + u02 y2 = 0 u1 0 y1 y2 = ⇔ f (t)/a(t) u01 y10 + u02 y20 = f (t)/a(t) y10 y20 u02 This is a linear algebraic system in two unknowns u01 and u02 . We can solve it to obtain u01 (t) = −f (t)y2 (t)/a(t) , W (y1 , y2 )(t) u02 (t) = f (t)y1 (t)/a(t) , W (y1 , y2 )(t) where W (y1 , y2 )(t) is called the Wronskian of the two linearly independent solutions y1 (t) and y2 (t), W (y1 , y2 )(t) ≡ y1 y20 − y10 y2 . These are two first order linear differential equations that can be solved (at least formally) to give: Z t Z t f (τ )y2 (τ )/a(τ ) f (τ )y1 (τ )/a(τ ) u1 (t) = − dτ dτ , u2 (t) = , W (y1 , y2 )(τ ) W (y1 , y2 )(τ ) t0 t0 MA156 - Ordinary Differential Equations 21 so that Z y p = u1 y 1 + u2 y 2 = t t0 f (τ ) y1 (τ )y2 (t) − y1 (t)y2 (τ ) dτ. a(τ ) y1 (τ )y20 (τ ) − y10 (τ )y2 (τ ) (13) This form is convenient for initial value problems because both yp (t0 ) and yp0 (t0 ) are zero (why?). Example 1 - Find the general solution of y 00 + y = sec(t). Two linearly independent solutions of the associated homogeneous equation are y1 (t) = cos(t), y2 (t) = sin(t). This gives the Wronskian W (y1 , y2 ) = cos(t) cos(t) − [− sin(t)] sin(t) = 1. Hence from (13) we get the particular solution Z yp (t) = 0 t 1 [cos(τ ) sin(t) − cos(t) sin(τ )]dτ = t sin(t) + cos(t) ln [| cos(t)|] cos(τ ) and from this the general solution y(t) = {C1 + ln [| cos(t)|]} cos(t) + (C2 + t) sin(t). Example 2 - Find the general solution of y 00 − y = g(t) The two independent solutions of the homogeneous equation are: y1 (t) = et y2 (t) = e−t ⇒ W (y1 , y2 )(t) = y1 y20 − y10 y2 = −2 Applying Equation (13) the particular solution is: 1 yp (t) = 2 Z t t −τ g(τ )(e e t0 Z τ −t − e e )dτ = t t0 g(τ ) sinh(t − τ )dτ. Hence, the general solution is given by: t −t y(t) = c1 e + c2 e Z − t t0 g(τ ) sinh(t − τ )dτ. MA156 - Ordinary Differential Equations 4 22 The Euler Equation There are no fail proof methods to solve a linear second order differential equation whose coefficients are not constant. Like in integration one has to resort to various tricks and hope for the best. One such “trick” is substitution and its use is best illustrated by Euler’s equation: x2 y 00 + axy 0 + by = 0. (14) We can simplify considerably this equation if we change the independent variable and use t = ln(x) ⇔ x = et . The derivatives of y(t) with respect to x can be expressed as derivatives with respect to t using the chain rule: dy dy dy dt dy 1 = = = e−t , dx dt dx dt x dt 2 d2 dt d dy dy 1 d −t dy −2t d y = − = e =e . dy 2 dx dt dx x dt dt dt2 dt We can substitute the first and second derivatives of y with respect to x in Equation (14) with these expression and obtain d2 y dy + (a − 1) + by = 0. 2 dt dt In other words, using substitution we have transformed a linear equation with non constant coefficients in a linear equation with constant coefficients. Example 1 - Find the general solution of x2 y 00 + xy 0 + y = 0. In terms of t = ln(x) this equation becomes: d2 y +y =0 dt2 whose solution is y(t) = A cos(t) + B sin(t). The last step is to express this as a function of x: y(x) = A cos[ln(x)] + B sin[ln(x)]. Example 2 - Find the general solution of x2 y 00 + 5xy 0 + 4y = 0. (15) In terms of t = ln(x) this equation becomes d2 y dy + 4 + 4y = 0. 2 dt dt (16) MA156 - Ordinary Differential Equations 23 The auxiliary equation, r 2 + 4r + 4 = 0, has two repeated roots, r = −2. Therefore the general solution of equation (16) is y(t) = (C1 + C2 t)e−2t . Replacing t with ln(x) we obtain the solution of equation (15): y(x) = [C1 + C2 ln(x)] 1 . x2 Example 3 - If there is a non-homogeneous term we can still apply this method. For example, find the general solution of x2 y 00 − 2y = 4x3 . In terms of t = ln(x) this equation becomes d2 y dy − − 2y = 4e3t , dt2 dt i.e. a non-homogeneous linear equation with constant coefficients, whose solution is left as an exercise to the reader. MA156 - Ordinary Differential Equations 24 Appendix A How to find a second solution of a linear differential equation Given one solution y1 (x) of a homogeneous linear second order differential equation, a(x)y 00 (x) + b(x)y 0 (x) + c(x)y(x) = 0, (17) it is always possible, at least formally, to find another linear independent solution. Let y2 (x) be this second, yet unknown, solution and write it as y2 (x) = v(x)y1 (x), (18) where v(x) is an unknown function. We can find an equation for v(x) by substituting (18) and its derivatives, y2 (x) = v(x)y1 (x), y20 (x) = v 0 (x)y1 (x) + v(x)y10 (x), y200 (x) = v 00 (x)y1 (x) + 2v 0 (x)y10 (x) + v(x)y100 (x), into (17): a(x)y1 (x)v 00 (x) + 2a(x)y10 (x) + b(x)y1 (x) v 0 (x) = 0. This is a second order equation with the independent variable missing and can be transformed into a separable first order differential equation by changing variable to u(x) = v 0 (x): a(x)y1 (x)u0 (x) + 2a(x)y10 (x) + b(x)y1 (x) u(x) = 0, whose solution is Z du =− u Z 2a(x)y10 (x) + b(x)y1 (x) dx. a(x)y1 (x) Example 1 - Find a second linearly independent solution of y 00 + 5y 0 + 6y = 0, (19) knowing that one solution is y1 (x) = exp(−2x). Write the second solution as y2 (x) = v(x)y1 (x) and substitute it into (19). The resulting equation for v(x) is v 00 + v 0 = 0, which has two solutions v1 (x) = k, v2 (x) = e−x , where k is a constant. To these two functions there correspond two possible solutions y2 (x): y2 (x) = ky1 (x) = ke−2x , not linearly independent, −x −3x y2 (x) = e y1 (x) = e , linearly independent. Therefore the two linearly independent solutions of (19) are: y1 (x) = e−2x and y2 (x) = e−3x .