Non-Homogeneous Equations We now turn to finding solutions of a non-homogeneous second order linear equation. 1. Non-Homogeneous Equations 2. The Method of Undetermined Coefficients 3. The Method of Variation of Parameters 1 Non-Homogeneous Equations Consider the following non-homogeneous, second order linear differential equation: y + p(t)y + q(t)y = g(t) Associated with each non-homogeneous equation there is a corresponding homogeneous equation: y + p(t)y + q(t)y = 0 Let us suppose that y 1 (t) and y 2 (t) are both solutions to the non-homogeneous equation. Then we note that y 1 (t) y 2 (t) is a solution to the homogeneous equation: (y 1 y 2 ) + p(t)(y 1 y 2 ) + q(t)(y 1 y 2 ) = y 1 y 2 + p(t)y 1 p(t)y 2 + q(t)y 1 q(t)y 2 = (y 1 + p(t)y 1 + q(t)y 1) (y 2 + p(t)y 2 + q(t)y 2) = g(t) g(t) = 0 In other words, the difference between any two solutions to a non-homogeneous equation is a solution to the homogeneous equation. This gives us a useful approach to solving non-homogeneous equations: 1. Solve the corresponding homogeneous equation. This solution is sometimes referred to as the complementary solution, and denoted y c. 2. Find (any) particular solution to the non-homogeneous equation. We will denote this particular solution y p (t). 1
Then any solution to the non-homogeneous equation is of the form Find the general solution to y(t) = y c (t) + y p (t). y 2y 3y = e 2t, given that y p (t) = 1 3 e2t is a particular solution to the equation. First we find the complementary solution to the corresponding homogeneous equation: y 2y 3y = 0. The characteristic equation is r 2 2r 3 = 0, which has roots r = 1 and r = 3. So the complementary solution is Therefore the general solution is y c (t) = c 1 e t + c 2 e 3t. y(t) = y c (t) + y p (t) = c 1 e t + c 2 e 3t 1 3 e2t. The difficulty is in attempting to find one solution to the non-homogeneous equation. We will be discussing two methods to do this. The technique we will discuss today is called the method of undetermined coefficients. 2 The Method of Undetermined Coefficients The method of undetermined coefficients requires us to guess the general form for a specific solution, but with undetermined coefficients. We then try to solve for the required coefficients by plugging our proposed solution into the differential equation. 1. Multiples and Sums 2. Duplicated Solutions Let us attempt to solve y + 3y + 2y = 5e 2t. We first note that the homogeneous equation y + 3y + 2y = 0 has characteristic equation r 2 + 3r + 2 = 0, which has roots r = 2 and r = 1, so the complementary solution is y c (t) = c 1 e t + c 2 e 2t. 2
Now we attempt to guess a particular solution to the non-homogeneous equation. Since the exponential function does not change much under differentiation, we will guess a solution of the form y p (t) = Ae 2t where A is our undetermined coefficient. Now y p (t) = 2Ae2t and y p (t) = 4Ae2t, so when we plug y p into the non-homogeneous equation, we get y p + 3y p + 2y p = 5e 2t which becomes 4Ae 2t + 6Ae 2t + 2Ae 2t = 5e 2t or e 2t (4A + 6A + 2A) = 5e 2t This equation will be true if we have (4A+6A+2A) = 12A = 5, so A = 5/12. Thus, we have found a particular solution y p (t) = 5 12 e2t, so the general solution is y(t) = y c (t) + y p (t) = c 1 e t + c 2 e 2t + 5 12 e2t. The method of undetermined coefficients will only work with a small selection of non-homogeneous terms. If we have y + p(t)y + q(t)y = g(t) then we can use the method in the following cases, if we choose the given form for y p (t): If g(t) is Try y p (t) = c e kt (an exponential function) c n t n +c n 1 t n 1 + +c 0 (a polynomial of degree n) Ae kt (another exponential function) A n t n + A n 1 t n 1 + + A 0 (another polynomial of degree n) either c cos(bt) or c sin(bt) A cos(bt)+b sin(bt) (a linear combination of both sine and cosine) A potential problem: If any term in our proposed solution y p (t) happens to be a term in the complementary solution, then parts will vanish when plugged into the left side of the differential equation. We will discuss this situation later. If our non-homogeneous term is g(t) = t 4 +t, our particular solution should be of the form y p (t) = At 4 + Bt 3 + Ct 2 + Dt + E. There are a lot of constants to solve for here. Note that in general an order n polynomial will generate another order n polynomial as the particular solution. So 3
if our g(t) is quadratic, we will have three constants to solve for, and if g(t) is cubic, there will be four. Solve 3y + y 2y = 2 cos(t). The complementary solution is y c (t) = c 1 e 2t 3 + c2 e t. Our particular solution should be y p (t) = A cos(t) + B sin(t), so y p (t) = A sin(t) + B cos(t) and y p (t) = A cos(t) B sin(t). Plugging these in to the equation gives us 3y p + y p 2y p = 3( A cos(t) B sin(t)) + ( A sin(t) + B cos(t)) 2(A cos(t) + B sin(t)) = ( 3A + B 2A) cos(t) + ( 3B A 2B) sin(t) = ( 5A + B) cos(t) + ( 5B A) sin(t) = 2 cos(t) Thus we must have 5A + B = 2 and 5B A = 0. Solving the second for A gives A = 5B. Plugging back into 5A + B = 2 reveals that 26B = 2, or B = 1/13. Then we have A = 5B = 5/13, so we have found a specific solution and the general solution is y p (t) = 5 13 cos(t) + 1 13 sin(t) y(t) = y c (t) + y p (t) = c 1 e 2t 3 + c2 e t + 5 13 cos(t) + 1 13 sin(t). 3 Multiples and Sums If we have a product of two of the types of functions listed above for our nonhomogeneous term (such as a polynomial times an exponential function, or an exponential times a sine), simply use the product of our proposed particular solutions: 4
If g(t) is Use y p (t) = (c n t n + c n 1 t n 1 + + c 0 )e kt (a polynomial times an exponential function) c sin(bt)e at or c cos(bt)e at (sines or cosines times exponential functions) (c n t n + c n 1 t n 1 + + c 0 ) sin(bt) or (c n t n + c n 1 t n 1 + + c 0 ) cos(bt) (a polynomial times sine or cosine) (c n t n + c n 1 t n 1 + + c 0 )e at sin(bt) or (c n t n + c n 1 t n 1 + + c 0 )e at cos(bt) (All three together whoopee!) (A n t n + A n 1 t n 1 + + A 0 )e kt (another polynomial times an exponential function) e at (A cos(bt) + B sin(bt)) (a product of an exponential function times a linear combination of sine and cosine) (A n t n + A n 1 t n 1 + + A 0 ) cos(bt) + (B n t n + B n 1 t n 1 + + B 0 ) sin(bt) (a polynomial times sine and another times cosine) (A n t n + A n 1 t n 1 + + A 0 )e at cos(bt) + (B n t n + B n 1 t n 1 + + B 0 )e at sin(bt) (what you would expect) (See 3.8 on p. 163 of the text for a complete summary of which terms to use. Also note that again, there will be a special case if part of your complementary solution shows up in your proposed y p.) If the non-homogeneous term is g(t) = t 3 e 5t, we should try for a particular solution of the form y p (t) = (At 3 + Bt 2 + Ct + D)e 5t. What if we have a sum of non-homogeneous terms of the types already mentioned? So assume g(t) = g 1 (t) + g 2 (t). Then if y p1 is a solution to y + py + qy = g 1 and y p2 is a solution to y + py + qy = g 2, it is clear that (y p1 + y p2 ) + p(t)(y p1 + y p2 ) + q(t)(y p1 + y p2 ) = g 1 (t) + g 2 (t) = g(t). So we can either solve each problem separately, or we can string a sequence of forms for y p (t) together into one long solution and attempt to solve for all the constants at once. If the non-homogeneous term is g(t) = te 2t cos(3t) + e t sin(2t), then our particular solution is of the form y p (t) = (At + B)e 2t cos(3t) + (Ct + D)e 2t sin(3t) + Ee t sin(2t) + Fe t cos(2t). Alternatively, we could first find out what constants A, B, C, and D would make y p1 (t) = (At + B)e 2t cos(3t) + (Ct + D)e 2t sin(3t) a solution to our differential equation, then solve for E and F separately to make y p2 (t) = Ee t sin(2t) + Fe t cos(2t) 5
a solution. Then our specific solution would be y p (t) = y p1 (t) + y p2 (t). To solve y + by + cy = 7t 2 e 2t + 3 + 18 sin(5t), we would use the general form y p (t) = (At 2 + Bt + C)e 2t + D cos(5t) + E sin(5t) + F 4 Duplicated Solutions The method of undetermined coefficients will fail to give us a solution if our proposed particular solution contains elements of the complementary solution. We will attempt to solve y + 3y + 2y = 5e 2t using undetermined coefficients. Note that the complementary solution is c 1 e t + c 2 e 2t. Our proposed non-homogeneous solution is of the form y p (t) = Ae 2t, but this will fail, as it contains a homogeneous solution: y p + 3y p + 2y p = 4Ae 2t 6Ae 2t + 2Ae 2t = 0 Since 5e 2t 0, we cannot solve this. Whenever the proposed specific solution to the non-homogeneous equation duplicates the homogeneous solution (or t n times one of those solutions), we will have to alter our technique. Specifically, if we were to guess a specific solution y p (t), alter this to ty p (t). (If y p (t) still duplicates part of the complementary solution, multiply by t 2 instead.) Solve y +3y +2y = 5e 2t using undetermined coefficients. The homogeneous solution is again c 1 e t + c 2 e 2t. Since Ae 2t is one of the homogeneous solutions, we adjust our guess for the specific solution to y p (t) = Ate 2t. Then we have y p (t) = Ae 2t 2Ate 2t = Ae 2t (1 2t) y p (t) = 4Ae 2t + 4Ate 2t = 4Ae 2t (t 1) Plugging these in to the differential equation yields y p + 3y p + 2y p = 4Ae 2t (t 1) + 3Ae 2t (1 2t) + 2Ate 2t = Ae 2t (4t 4 + 3 6t + 2t) = Ae 2t 6
Setting this equal to 5e 2t, we finally get A = 5, and we have the specific solution which gives us the general solution y p (t) = 5te 2t y(t) = y c (t) + y p (t) = c 1 e t + c 2 e 2t 5te 2t. Solve y + 4y = t 2 + te 4t. First solve the homogeneous equation: y + 4y = 0 gives us characteristic equation r 2 + 4r = 0, so r = 0 or r = 4. Thus the complementary solution is y c (t) = c 1 + c 2 e 4t. We can look at each term of the non-homogeneous term separately. For the term g 1 (t) = t 2, we get a specific solution of the form y p1 (t) = A 2 t 2 + A 1 t + A 0. Does this duplicate our complementary solution? Yes! It duplicates the constant term. So we adjust our first guess to y p1 (t) = t(a 2 t 2 + A 1 t + A 0 ) = A 2 t 3 + A 1 t 2 + A 0 t and try plugging in and solving for A 0, A 1, and A 2 : y p1 + 4y p = t 2 which becomes 6A 2 t + 2A 1 + 4(3A 2 t 2 + 2A 1 t + A 0 ) = t 2 or 12A 2 t 2 + (8A 1 + 6A 2 )t + (4A 0 + 2A 1 ) = t 2 which means that we have the equations 12A 2 = 1 8A 1 + 6A 2 = 0 4A 0 + 2A 1 = 0 The solution is A 2 = 1/12, A 1 = 1/16, and A 0 = 1/32, so y p1 (t) = 1 12 t3 1 16 t2 + 1 32 t Then we can move on to the second part: g 2 (t) = te 4t. Our proposed solution would be (At+B)e 4t. But this duplicates the e 4t. So instead we try y p2 (t) = (At 2 +Bt)e 4t. Then after taking derivatives and simplifying we have y p2 (t) = e 4t (B + (2A 4B)t 4At 2 ) y p2 (t) = 2e 4t (A 4B + 8(B A)t + 8At 2 ) 7
and plugging this into y + 4y = te 4t gives us (2A 4B)e 4t 8Ate 4t = te 4t which means that 8A = 1, so A = 1/8, and 2A 4B = 0, so B = 1/16. Thus y p2 (t) = ( 1 8 t2 1 ) 16 t e 4t Thus, we have a general solution y(t) = y c (t) + y p1 (t) + y p2 (t) = c 1 + c 2 e 4t + 1 12 t3 1 16 t2 + 1 32 t + ( 1 8 t2 1 16 t ) e 4t 5 The method of Variation of Parameters We revisit non-homogeneous equations and develop a technique to find a non-homogeneous solution in terms of the homogeneous solution: 1. Cramer s Rule 2. Variation of Parameters 3. Using Variation of Parameters 6 Cramer s Rule We start with a brief review of Cramer s rule, which tells us how to solve a system in terms of matrices. Cramer s rule will be helpful in remembering how to carry out variation of parameters. In order to solve the system ax + by = m cx + dy = n for x and y, we can do the following: m b n d x = a b, y = c d a m c n a b c d In other words, to solve for x, we take the coefficient matrix and replace the x column with the result (the right hand side of the equations.) Then we take the determinant and divide by the determinant of the coefficient matrix. 8
To solve for y, we do the same thing, except we replace the y column with the result column. Solve 2x + 3y = 7 4x 8y = 3 Here we have x = 7 3 3 8 2 3 4 8 = 56 9 16 12 = 65 28 and y = 2 7 4 3 2 3 4 8 = 6 28 28 = 22 28 = 11 14 7 Variation of Parameters Suppose we have found a set of fundamental solutions y 1 and y 2 for the homogeneous equation y + p(t)y + q(t)y = 0, so that the solutions look like y(t) = c 1 y 1 (t) + c 2 y 2 (t). How can we find a solution to the non-homogeneous equation y + p(t)y + q(t)y = g(t)? Last time, we discussed the method of undetermined coefficients which worked if we actually had constant coefficients, and if g(t) was a combination of exponential functions, polynomials, or sines and cosines. Now we attempt to find a more general approach. Let us consider what happens if we allow the parameters c 1 and c 2 in the complementary solution to vary; in other words, we replace the constants with functions u 1 and u 2 : y(t) = u 1 (t)y 1 (t) + u 2 (t)y 2 (t) 9
We no longer have a solution to the homogeneous equation, but we may be able to find functions u 1 and u 2 for which this y will be a solution to the non-homogeneous equation. We calculate y (t), and begin to run into trouble: y (t) = u 1 (t)y 1 (t) + u 1 (t)y 1(t) + u 2 (t)y 2(t) + u 2 (t)y 2 (t) This is a mess and the second derivative will be much worse. Let us introduce the following additional condition on u 1 and u 2: u 1(t)y 1 (t) + u 2(t)y 2 (t) = 0 (1) We emphasize the following: We have chosen to add the above condition because it simplifies the equation. It is not added because of any feature of the original equation. Now we continue: y (t) = u 1 (t)y 1 (t) + u 2(t)y 2 (t) y (t) = u 1 (t)y 1 (t) + u 1(t)y 1 (t) + u 2 (t)y 2 (t) + u 2(t)y 2 (t) Plugging these into the non-homogeneous equation yields the following: y + p(t)y + q(t)y = [u 1 (t)y 1 (t) + u 1(t)y 1 (t) + u 2 (t)y 2 (t) + u 2(t)y 2 (t)] + p(t) [u 1 (t)y 1 (t) + u 2(t)y 2 (t)] + q(t) [u 1 (t)y 1 (t) + u 2 (t)y 2 (t)] If we collect like terms on u 1 and u 2, we get the following: y + p(t)y + q(t)y = u 1 (t) [y 1 (t) + p(t)y 1 (t) + q(t)y 1(t)] + u 2 (t) [y 2 (t) + p(t)y 2 (t) + q(t)y 2(t)] + u 1(t)y 1(t) + u 2(t)y 2(t) But since y 1 and y 2 are solutions to the homogeneous equation, the coefficients on u 1 and u 2 are zero, and in fact we have that if y(t) = u 1 (t)y 1 (t) + u 2 (t)y 2 (t), then Thus we must have y + p(t)y + q(t)y = u 1(t)y 1(t) + u 2(t)y 2(t). u 1 (t)y 1 (t) + u 2 (t)y 2 (t) = g(t) (2) Now equation (??) and equation (??) above form a set of two equations in the two unknowns u 1 (t) and u 2 (t), which we can then attempt to solve. Cramer s rule says that the system u 1(t)y 1 (t) + u 2(t)y 2 (t) = 0 u 1 (t)y 1 (t) + u 2 (t)y 2 (t) = g(t) 10
can be solved for u 1 and u 2 as follows: u 1(t) = 0 y 2 (t) g(t) y 2 (t) y 1 (t) y 2 (t) y 1 (t) y 2 (t) = y 2(t)g(t) W(y 1, y 2 ) and u 2(t) = y 1 (t) 0 y 1(t) g(t) y 1 (t) y 2 (t) y 1 (t) y 2 (t) = y 1(t)g(t) W(y 1, y 2 ) This is ok, because the Wronskian is non-zero. (Why? Because y 2 and y 2 are a fundamental set of solutions.) So we finally have a specific solution, after performing some integrations: Y (t) = y 1 (t) How wonderful! Sort of... y2 (t)g(t) W(y 1, y 2 ) dt + y y1 (t)g(t) 2(t) W(y 1, y 2 ) dt. 8 Using Variation of Parameters Let s use variation of parameters to solve some non-homogeneous equations. Solve y 3y 1 + 2y = 1 + e t. Note that this could not have been done by the method of undetermined coefficients. First, we solve the homogeneous equation to find the complementary solution: y 3y + 2y = 0 So we get characteristic equation r 2 3r + 2 = (r 2)(r 1) = 0, so r = 2 or r = 1. Thus the complementary solution is y c (t) = c 1 e t + c 2 e 2t That is, we have y 1 (t) = e t and y 2 (t) = e 2t. Second, we set up our equations for variation of parameters. We have u 1 y 1 + u 2 y 2 = 0 or u 1 et + u 2 e2t = 0 11
and u 1y 1 + u 2y 2 1 = or u 1 + e 1e t + u 22e 2t = t Thus, solving for u 1 and u 2 using Cramer s rule, we get 0 e 2t ( ) u 1 = 1 2e 2t 1+e e 2t t 1+e e t e 2t = t (e 3t ) and So now we integrate: which gives us e t e t 0 u 2 = e t u 1 (t) = 2e 2t e t 1 1+e t e 2t e t 1 1 + e t = e t 1 + e t ( ) e t = e 3t = e 2t 1 + e t 1 + e t 2e 2t e t 1 + e t dt, so we let u = 1 + e t du = e t dt 1 u 1 (t) = u du = ln(1 + e t ) + C 1 Now note: We do not need the C 1! When we take u 1 (t)y 1 (t), we will get a Cy 1 (t) term, which is a homogeneous solution, and thus will give zero when we plug this into the differential equation. Therefore, we take u 1 (t) = ln(1 + e t ). Similarly, e 2t u 2 (t) = 1 + e dt, so we so set u = e t t du = e t dt Here we get e t ( e t dt) u 2 (t) = = 1 + e t We can reduce this by division to u 1 + u du = u 1 + u du 1 1 1 + u du = u + ln 1 + u + C = e t + ln(1 + e t ) + C 2 We discard the constant C 2 for the same reason we discarded the C 1, and we get So finally, we have the particular solution u 2 (t) = ln(1 + e t ) e t. Y (t) = u 1 (t)y 1 (t) + u 2 (t)y 2 (t) = ln(1 + e t )e t + [ ln(1 + e t ) e t] e 2t. 12
So the general solution must be y(t) = y c (t) + Y (t) = c 1 e t + c 2 e 2t + ln(1 + e t )e t + [ ln(1 + e t ) e t] e 2t Notice by the way that if we had chosen to leave constants C 1 and C 2 after integrating u 1 and u 2, we would in fact have the general solution when we computed y(t) = (u 1 (t) + C 1 )y 1 (t) + (u 2 (t) + C 2 )y 2 (t). We could also simplify our answer algebraically to be much shorter, since several terms will cancel or can be grouped together: y(t) = c 1 e t + c 2 e 2t + ln(1 + e t )e t + [ ln(1 + e t ) e t] e 2t = c 1 e t + c 2 e 2t + ln(1 + e t )e t + ln(1 + e t )e 2t e t = [ c 1 + ln(1 + e t ) ] e t + [ c 2 + ln(1 + e t ) ] e 2t (In the last step, we also renamed c 1 as c 1 1.) Solve y + y = sec(t) tan(t). First, we solve the homogeneous equation: The characteristic equation is r 2 + 1 = 0, so we get r =. Thus, our fundamental solutions are y 1 (t) = cos(t) and y 2 (t) = sin(t). Second, we calculate our specific solution from variation of parameters. We need to solve u 1 y 1 + u 2 y 2 = 0 or u 1 cos(t) + u 2 sin(t) = 0 and u 1y 1 + u 2y 2 = sec(t) tan(t) or u 1 sin(t) + u 2 cos(t) = sec(t) tan(t). Thus, using Cramer s rule we get u 1 (t) = and u 2 (t) = So we get u 1 (t) = 13
and u 2 (t) = Finally, we have a particular solution Y (t) = and the general solution y(t) = 14