Comments
Transcript
Linear equations with constant coefficients
HIGHER-ORDER ORDINARY DIFFERENTIAL EQUATIONS If the original equation (15.1) has f(x) = 0 (i.e. it is homogeneous) then of course the complementary function yc (x) in (15.3) is already the general solution. If, however, the equation has f(x) = 0 (i.e. it is inhomogeneous) then yc (x) is only one part of the solution. The general solution of (15.1) is then given by y(x) = yc (x) + yp (x), (15.7) where yp (x) is the particular integral, which can be any function that satisfies (15.1) directly, provided it is linearly independent of yc (x). It should be emphasised for practical purposes that any such function, no matter how simple (or complicated), is equally valid in forming the general solution (15.7). It is important to realise that the above method for finding the general solution to an ODE by superposing particular solutions assumes crucially that the ODE is linear. For non-linear equations, discussed in section 15.3, this method cannot be used, and indeed it is often impossible to find closed-form solutions to such equations. 15.1 Linear equations with constant coefficients If the am in (15.1) are constants rather than functions of x then we have an dn y dn−1 y dy + a0 y = f(x). + an−1 n−1 + · · · + a1 n dx dx dx (15.8) Equations of this sort are very common throughout the physical sciences and engineering, and the method for their solution falls into two parts as discussed in the previous section, i.e. finding the complementary function yc (x) and finding the particular integral yp (x). If f(x) = 0 in (15.8) then we do not have to find a particular integral, and the complementary function is by itself the general solution. 15.1.1 Finding the complementary function yc (x) The complementary function must satisfy an dn y dn−1 y dy + a0 y = 0 + an−1 n−1 + · · · + a1 dxn dx dx (15.9) and contain n arbitrary constants (see equation (15.3)). The standard method for finding yc (x) is to try a solution of the form y = Aeλx , substituting this into (15.9). After dividing the resulting equation through by Aeλx , we are left with a polynomial equation in λ of order n; this is the auxiliary equation and reads an λn + an−1 λn−1 + · · · + a1 λ + a0 = 0. 492 (15.10) 15.1 LINEAR EQUATIONS WITH CONSTANT COEFFICIENTS In general the auxiliary equation has n roots, say λ1 , λ2 , . . . , λn . In certain cases, some of these roots may be repeated and some may be complex. The three main cases are as follows. (i) All roots real and distinct. In this case the n solutions to (15.9) are exp λm x for m = 1 to n. It is easily shown by calculating the Wronskian (15.6) of these functions that if all the λm are distinct then these solutions are linearly independent. We can therefore linearly superpose them, as in (15.3), to form the complementary function yc (x) = c1 eλ1 x + c2 eλ2 x + · · · + cn eλn x . (15.11) (ii) Some roots complex. For the special (but usual) case that all the coefficients am in (15.9) are real, if one of the roots of the auxiliary equation (15.10) is complex, say α + iβ, then its complex conjugate α − iβ is also a root. In this case we can write c1 e(α+iβ)x + c2 e(α−iβ)x = eαx (d1 cos βx + d2 sin βx) sin = Aeαx (βx + φ), cos (15.12) where A and φ are arbitrary constants. (iii) Some roots repeated. If, for example, λ1 occurs k times (k > 1) as a root of the auxiliary equation, then we have not found n linearly independent solutions of (15.9); formally the Wronskian (15.6) of these solutions, having two or more identical columns, is equal to zero. We must therefore find k − 1 further solutions that are linearly independent of those already found and also of each other. By direct substitution into (15.9) we find that xeλ1 x , x2 eλ1 x , ..., xk−1 eλ1 x are also solutions, and by calculating the Wronskian it is easily shown that they, together with the solutions already found, form a linearly independent set of n functions. Therefore the complementary function is given by yc (x) = (c1 + c2 x + · · · + ck xk−1 )eλ1 x + ck+1 eλk+1 x + ck+2 eλk+2 x + · · · + cn eλn x . (15.13) If more than one root is repeated the above argument is easily extended. For example, suppose as before that λ1 is a k-fold root of the auxiliary equation and, further, that λ2 is an l-fold root (of course, k > 1 and l > 1). Then, from the above argument, the complementary function reads yc (x) = (c1 + c2 x + · · · + ck xk−1 )eλ1 x + (ck+1 + ck+2 x + · · · + ck+l xl−1 )eλ2 x + ck+l+1 eλk+l+1 x + ck+l+2 eλk+l+2 x + · · · + cn eλn x . 493 (15.14) HIGHER-ORDER ORDINARY DIFFERENTIAL EQUATIONS Find the complementary function of the equation dy d2 y −2 + y = ex . dx2 dx (15.15) Setting the RHS to zero, substituting y = Aeλx and dividing through by Aeλx we obtain the auxiliary equation λ2 − 2λ + 1 = 0. The root λ = 1 occurs twice and so, although ex is a solution to (15.15), we must find a further solution to the equation that is linearly independent of ex . From the above discussion, we deduce that xex is such a solution, so that the full complementary function is given by the linear superposition yc (x) = (c1 + c2 x)ex . Solution method. Set the RHS of the ODE to zero (if it is not already so), and substitute y = Aeλx . After dividing through the resulting equation by Aeλx , obtain an nth-order polynomial equation in λ (the auxiliary equation, see (15.10)). Solve the auxiliary equation to find the n roots, λ1 , λ2 , . . . , λn , say. If all these roots are real and distinct then yc (x) is given by (15.11). If, however, some of the roots are complex or repeated then yc (x) is given by (15.12) or (15.13), or the extension (15.14) of the latter, respectively. 15.1.2 Finding the particular integral yp (x) There is no generally applicable method for finding the particular integral yp (x) but, for linear ODEs with constant coefficients and a simple RHS, yp (x) can often be found by inspection or by assuming a parameterised form similar to f(x). The latter method is sometimes called the method of undetermined coefficients. If f(x) contains only polynomial, exponential, or sine and cosine terms then, by assuming a trial function for yp (x) of similar form but one which contains a number of undetermined parameters and substituting this trial function into (15.9), the parameters can be found and yp (x) deduced. Standard trial functions are as follows. (i) If f(x) = aerx then try yp (x) = berx . (ii) If f(x) = a1 sin rx + a2 cos rx (a1 or a2 may be zero) then try yp (x) = b1 sin rx + b2 cos rx. (iii) If f(x) = a0 + a1 x + · · · + aN xN (some am may be zero) then try yp (x) = b0 + b1 x + · · · + bN xN . 494 15.1 LINEAR EQUATIONS WITH CONSTANT COEFFICIENTS (iv) If f(x) is the sum or product of any of the above then try yp (x) as the sum or product of the corresponding individual trial functions. It should be noted that this method fails if any term in the assumed trial function is also contained within the complementary function yc (x). In such a case the trial function should be multiplied by the smallest integer power of x such that it will then contain no term that already appears in the complementary function. The undetermined coefficients in the trial function can now be found by substitution into (15.8). Three further methods that are useful in finding the particular integral yp (x) are those based on Green’s functions, the variation of parameters, and a change in the dependent variable using knowledge of the complementary function. However, since these methods are also applicable to equations with variable coefficients, a discussion of them is postponed until section 15.2. Find a particular integral of the equation d2 y dy −2 + y = ex . dx2 dx From the above discussion our first guess at a trial particular integral would be yp (x) = bex . However, since the complementary function of this equation is yc (x) = (c1 + c2 x)ex (as in the previous subsection), we see that ex is already contained in it, as indeed is xex . Multiplying our first guess by the lowest integer power of x such that the result does not appear in yc (x), we therefore try yp (x) = bx2 ex . Substituting this into the ODE, we find that b = 1/2, so the particular integral is given by yp (x) = x2 ex /2. Solution method. If the RHS of an ODE contains only functions mentioned at the start of this subsection then the appropriate trial function should be substituted into it, thereby fixing the undetermined parameters. If, however, the RHS of the equation is not of this form then one of the more general methods outlined in subsections 15.2.3–15.2.5 should be used; perhaps the most straightforward of these is the variation-of-parameters method. 15.1.3 Constructing the general solution yc (x) + yp (x) As stated earlier, the full solution to the ODE (15.8) is found by adding together the complementary function and any particular integral. In order to illustrate further the material discussed in the last two subsections, let us find the general solution to a new example, starting from the beginning. 495 HIGHER-ORDER ORDINARY DIFFERENTIAL EQUATIONS Solve d2 y + 4y = x2 sin 2x. dx2 (15.16) First we set the RHS to zero and assume the trial solution y = Aeλx . Substituting this into (15.16) leads to the auxiliary equation λ2 + 4 = 0 ⇒ λ = ±2i. (15.17) Therefore the complementary function is given by yc (x) = c1 e2ix + c2 e−2ix = d1 cos 2x + d2 sin 2x. (15.18) We must now turn our attention to the particular integral yp (x). Consulting the list of standard trial functions in the previous subsection, we find that a first guess at a suitable trial function for this case should be (ax2 + bx + c) sin 2x + (dx2 + ex + f) cos 2x. (15.19) However, we see that this trial function contains terms in sin 2x and cos 2x, both of which already appear in the complementary function (15.18). We must therefore multiply (15.19) by the smallest integer power of x which ensures that none of the resulting terms appears in yc (x). Since multiplying by x will suffice, we finally assume the trial function (ax3 + bx2 + cx) sin 2x + (dx3 + ex2 + fx) cos 2x. (15.20) Substituting this into (15.16) to fix the constants appearing in (15.20), we find the particular integral to be x3 x2 x cos 2x + sin 2x + cos 2x. 12 16 32 The general solution to (15.16) then reads yp (x) = − (15.21) y(x) = yc (x) + yp (x) = d1 cos 2x + d2 sin 2x − x3 x2 x cos 2x + sin 2x + cos 2x. 12 16 32 15.1.4 Linear recurrence relations Before continuing our discussion of higher-order ODEs, we take this opportunity to introduce the discrete analogues of differential equations, which are called recurrence relations (or sometimes difference equations). Whereas a differential equation gives a prescription, in terms of current values, for the new value of a dependent variable at a point only infinitesimally far away, a recurrence relation describes how the next in a sequence of values un , defined only at (non-negative) integer values of the ‘independent variable’ n, is to be calculated. In its most general form a recurrence relation expresses the way in which un+1 is to be calculated from all the preceding values u0 , u1 , . . . , un . Just as the most general differential equations are intractable, so are the most general recurrence relations, and we will limit ourselves to analogues of the types of differential equations studied earlier in this chapter, namely those that are linear, have 496 15.1 LINEAR EQUATIONS WITH CONSTANT COEFFICIENTS constant coefficients and possess simple functions on the RHS. Such equations occur over a broad range of engineering and statistical physics as well as in the realms of finance, business planning and gambling! They form the basis of many numerical methods, particularly those concerned with the numerical solution of ordinary and partial differential equations. A general recurrence relation is exemplified by the formula un+1 = N−1 ar un−r + k, (15.22) r=0 where N and the ar are fixed and k is a constant or a simple function of n. Such an equation, involving terms of the series whose indices differ by up to N (ranging from n−N +1 to n), is called an Nth-order recurrence relation. It is clear that, given values for u0 , u1 , . . . , uN−1 , this is a definitive scheme for generating the series and therefore has a unique solution. Parallelling the nomenclature of differential equations, if the term not involving any un is absent, i.e. k = 0, then the recurrence relation is called homogeneous. The parallel continues with the form of the general solution of (15.22). If vn is the general solution of the homogeneous relation, and wn is any solution of the full relation, then un = vn + wn is the most general solution of the complete recurrence relation. This is straightforwardly verified as follows: un+1 = vn+1 + wn+1 N−1 N−1 = ar vn−r + ar wn−r + k r=0 = N−1 r=0 ar (vn−r + wn−r ) + k r=0 = N−1 ar un−r + k. r=0 Of course, if k = 0 then wn = 0 for all n is a trivial particular solution and the complementary solution, vn , is itself the most general solution. First-order recurrence relations First-order relations, for which N = 1, are exemplified by un+1 = aun + k, with u0 specified. The solution to the homogeneous relation is immediate, un = Can , 497 (15.23) HIGHER-ORDER ORDINARY DIFFERENTIAL EQUATIONS and, if k is a constant, the particular solution is equally straightforward: wn = K for all n, provided K is chosen to satisfy K = aK + k, i.e. K = k(1 − a)−1 . This will be sufficient unless a = 1, in which case un = u0 + nk is obvious by inspection. Thus the general solution of (15.23) is # Can + k/(1 − a) a = 1, (15.24) un = u0 + nk a = 1. If u0 is specified for the case of a = 1 then C must be chosen as C = u0 −k/(1−a), resulting in the equivalent form un = u0 an + k 1 − an . 1−a (15.25) We now illustrate this method with a worked example. A house-buyer borrows capital B from a bank that charges a fixed annual rate of interest R%. If the loan is to be repaid over Y years, at what value should the fixed annual payments P , made at the end of each year, be set? For a loan over 25 years at 6%, what percentage of the first year’s payment goes towards paying off the capital? Let un denote the outstanding debt at the end of year n, and write R/100 = r. Then the relevant recurrence relation is un+1 = un (1 + r) − P with u0 = B. From (15.25) we have un = B(1 + r)n − P 1 − (1 + r)n . 1 − (1 + r) As the loan is to be repaid over Y years, uY = 0 and thus P = Br(1 + r)Y . (1 + r)Y − 1 The first year’s interest is rB and so the fraction of the first year’s payment going towards capital repayment is (P − rB)/P , which, using the above expression for P , is equal to (1 + r)−Y . With the given figures, this is (only) 23%. With only small modifications, the method just described can be adapted to handle recurrence relations in which the constant k in (15.23) is replaced by kαn , i.e. the relation is un+1 = aun + kαn . (15.26) As for an inhomogeneous linear differential equation (see subsection 15.1.2), we may try as a potential particular solution a form which resembles the term that makes the equation inhomogeneous. Here, the presence of the term kαn indicates 498 15.1 LINEAR EQUATIONS WITH CONSTANT COEFFICIENTS that a particular solution of the form un = Aαn should be tried. Substituting this into (15.26) gives Aαn+1 = aAαn + kαn , from which it follows that A = k/(α − a) and that there is a particular solution having the form un = kαn /(α − a), provided α = a. For the special case α = a, the reader can readily verify that a particular solution of the form un = Anαn is appropriate. This mirrors the corresponding situation for linear differential equations when the RHS of the differential equation is contained in the complementary function of its LHS. In summary, the general solution to (15.26) is # C1 an + kαn /(α − a) α = a, (15.27) un = C2 an + knαn−1 α = a, with C1 = u0 − k/(α − a) and C2 = u0 . Second-order recurrence relations We consider next recurrence relations that involve un−1 in the prescription for un+1 and treat the general case in which the intervening term, un , is also present. A typical equation is thus un+1 = aun + bun−1 + k. (15.28) As previously, the general solution of this is un = vn + wn , where vn satisfies vn+1 = avn + bvn−1 (15.29) and wn is any particular solution of (15.28); the proof follows the same lines as that given earlier. We have already seen for a first-order recurrence relation that the solution to the homogeneous equation is given by terms forming a geometric series, and we consider a corresponding series of powers in the present case. Setting vn = Aλn in (15.29) for some λ, as yet undetermined, gives the requirement that λ should satisfy Aλn+1 = aAλn + bAλn−1 . Dividing through by Aλn−1 (assumed non-zero) shows that λ could be either of the roots, λ1 and λ2 , of λ2 − aλ − b = 0, (15.30) which is known as the characteristic equation of the recurrence relation. That there are two possible series of terms of the form Aλn is consistent with the fact that two initial values (boundary conditions) have to be provided before the series can be calculated by repeated use of (15.28). These two values are sufficient to determine the appropriate coefficient A for each of the series. Since (15.29) is 499 HIGHER-ORDER ORDINARY DIFFERENTIAL EQUATIONS both linear and homogeneous, and is satisfied by both vn = Aλn1 and vn = Bλn2 , its general solution is vn = Aλn1 + Bλn2 . If the coefficients a and b are such that (15.30) has two equal roots, i.e. a2 = −4b, then, as in the analogous case of repeated roots for differential equations (see subsection 15.1.1(iii)), the second term of the general solution is replaced by Bnλn1 to give vn = (A + Bn)λn1 . Finding a particular solution is straightforward if k is a constant: a trivial but adequate solution is wn = k(1 − a − b)−1 for all n. As with first-order equations, particular solutions can be found for other simple forms of k by trying functions similar to k itself. Thus particular solutions for the cases k = Cn and k = Dαn can be found by trying wn = E + Fn and wn = Gαn respectively. Find the value of u16 if the series un satisfies un+1 + 4un + 3un−1 = n for n ≥ 1, with u0 = 1 and u1 = −1. We first solve the characteristic equation, λ2 + 4λ + 3 = 0, to obtain the roots λ = −1 and λ = −3. Thus the complementary function is vn = A(−1)n + B(−3)n . In view of the form of the RHS of the original relation, we try wn = E + Fn as a particular solution and obtain E + F(n + 1) + 4(E + Fn) + 3[E + F(n − 1)] = n, yielding F = 1/8 and E = 1/32. Thus the complete general solution is un = A(−1)n + B(−3)n + n 1 + , 8 32 and now using the given values for u0 and u1 determines A as 7/8 and B as 3/32. Thus un = 1 [28(−1)n + 3(−3)n + 4n + 1] . 32 Finally, substituting n = 16 gives u16 = 4 035 633, a value the reader may (or may not) wish to verify by repeated application of the initial recurrence relation. 500 15.1 LINEAR EQUATIONS WITH CONSTANT COEFFICIENTS Higher-order recurrence relations It will be apparent that linear recurrence relations of order N > 2 do not present any additional difficulty in principle, though two obvious practical difficulties are (i) that the characteristic equation is of order N and in general will not have roots that can be written in closed form and (ii) that a correspondingly large number of given values is required to determine the N otherwise arbitrary constants in the solution. The algebraic labour needed to solve the set of simultaneous linear equations that determines them increases rapidly with N. We do not give specific examples here, but some are included in the exercises at the end of the chapter. 15.1.5 Laplace transform method Having briefly discussed recurrence relations, we now return to the main topic of this chapter, i.e. methods for obtaining solutions to higher-order ODEs. One such method is that of Laplace transforms, which is very useful for solving linear ODEs with constant coefficients. Taking the Laplace transform of such an equation transforms it into a purely algebraic equation in terms of the Laplace transform of the required solution. Once the algebraic equation has been solved for this Laplace transform, the general solution to the original ODE can be obtained by performing an inverse Laplace transform. One advantage of this method is that, for given boundary conditions, it provides the solution in just one step, instead of having to find the complementary function and particular integral separately. In order to apply the method we need only two results from Laplace transform theory (see section 13.2). First, the Laplace transform of a function f(x) is defined by f̄(s) ≡ ∞ e−sx f(x) dx, (15.31) 0 from which we can derive the second useful relation. This concerns the Laplace transform of the nth derivative of f(x): f (n) (s) = sn f̄(s) − sn−1 f(0) − sn−2 f (0) − · · · − sf (n−2) (0) − f (n−1) (0), (15.32) where the primes and superscripts in parentheses denote differentiation with respect to x. Using these relations, along with table 13.1, on p. 455, which gives Laplace transforms of standard functions, we are in a position to solve a linear ODE with constant coefficients by this method. 501 HIGHER-ORDER ORDINARY DIFFERENTIAL EQUATIONS Solve d2 y dy −3 + 2y = 2e−x , dx2 dx subject to the boundary conditions y(0) = 2, y (0) = 1. (15.33) Taking the Laplace transform of (15.33) and using the table of standard results we obtain s2 ȳ(s) − sy(0) − y (0) − 3 [sȳ(s) − y(0)] + 2ȳ(s) = 2 , s+1 which reduces to (s2 − 3s + 2)ȳ(s) − 2s + 5 = 2 . s+1 (15.34) Solving this algebraic equation for ȳ(s), the Laplace transform of the required solution to (15.33), we obtain ȳ(s) = 2s2 − 3s − 3 1 2 1 = + − , (s + 1)(s − 1)(s − 2) 3(s + 1) s − 1 3(s − 2) (15.35) where in the final step we have used partial fractions. Taking the inverse Laplace transform of (15.35), again using table 13.1, we find the specific solution to (15.33) to be y(x) = 13 e−x + 2ex − 13 e2x . Note that if the boundary conditions in a problem are given as symbols, rather than just numbers, then the step involving partial fractions can often involve a considerable amount of algebra. The Laplace transform method is also very convenient for solving sets of simultaneous linear ODEs with constant coefficients. Two electrical circuits, both of negligible resistance, each consist of a coil having selfinductance L and a capacitor having capacitance C. The mutual inductance of the two circuits is M. There is no source of e.m.f. in either circuit. Initially the second capacitor is given a charge CV0 , the first capacitor being uncharged, and at time t = 0 a switch in the second circuit is closed to complete the circuit. Find the subsequent current in the first circuit. Subject to the initial conditions q1 (0) = q̇1 (0) = q̇2 (0) = 0 and q2 (0) = CV0 = V0 /G, say, we have to solve Lq̈1 + Mq̈2 + Gq1 = 0, Mq̈1 + Lq̈2 + Gq2 = 0. On taking the Laplace transform of the above equations, we obtain (Ls2 + G)q̄1 + Ms2 q̄2 = sMV0 C, Ms2 q̄1 + (Ls2 + G)q̄2 = sLV0 C. Eliminating q̄2 and rewriting as an equation for q̄1 , we find MV0 s [(L + M)s2 + G ][(L − M)s2 + G ] V0 (L + M)s (L − M)s . = − 2 2 2G (L + M)s + G (L − M)s + G q̄1 (s) = 502