LECTURE 14: NONHOMOGENEOUS EQUATIONS MINGFENG ZHAO October 06, 2014 Theorem 1. Let y1 (x) and y2 (x) be a fundamental set of solutions to the homogeneous equation y 00 +p(x)y 0 +q(x)y = 0, and yp (x) be any particular solution to the nonhomogeneous equation y 00 +p(x)y 0 +q(x)y = f (x), then the general solution to the nonhomogeneous equation y 00 + p(x)y 0 + q(x)y = f (x) is: y(x) = C1 y1 (x) + C2 y2 (x) + yp (x). To find a particular solution to the nonhomogeneous equation y 00 + p(x)y 0 + q(x)y = f (x), we have two methods: I. Undetermined coefficients: Only work for constant coefficients equations with f (x) are polynomials, exponential, sines, cosines. II. Variation of parameters: Work for all second order differential equation with all nonhomogeneous term f (x). Undetermined Coefficients Let a, b and c be constants, consider the equation: ay 00 + by 0 + cy = f (x), The characteristic equation is: ar2 + br + c = 0. Then r1,2 = −b ± √ b2 − 4ac . 2a For special f (x), we can find a particular solution to ay 00 + by 0 + cy = f (x) by using the method of Undetermined Coefficients: I. When c 6= 0 and f (x) is a polynomial, a particular solution can be also a polynomial with the same degree as f (x). 1 2 MINGFENG ZHAO II. When f (x) = menx is an exponential function with n 6= r1 and n 6= r2 , a particular solution can be also an exponential function like yp (x) = Aenx for some constant A. III. When b2 − 4ac > 0 (that is, r1 and r2 are two different real roots), and f (x) = mer1 x is an exponential function, a particular solution can be also an exponential function like yp (x) = Axer1 x for some constant A. Example 1. Find a particular solution to y 00 − 9y = e3x . The characteristic equation of y 00 − 9y = 0 is: r2 − 9 = 0. Solve r2 − 9 = 0, we get r1 = 3, and r2 = −3. Let yp (x) = Axe3x be a particular solution to y 00 − 9y = e3x , then yp0 (x) = Ae3x + 3Axe3x yp00 (x) = 3Ae3x + 3Ae3x + 9Axe3x = 6Ae3x + 9Axe3x = 6Ae3x + 9Axe3x − 9Axe3x = 6Ae3x yp00 (x) − 9yp (x) = e3x So we have 6A = 1 That is, A = 1 . So a particular solution to y 00 − 9y = e3x is: 6 yp (x) = 1 3x xe . 6 b b ), and f (x) = me− 2a ·x is an exponential function, a particular 2a solution can be also an exponential function like yp (x) = Ax2 erx for some constant A. IV. When b2 − 4ac = 0 (that is, r1 = r2 = − Example 2. Find a particular solution to y 00 − 6y 0 + 9y = e3x . LECTURE 14: NONHOMOGENEOUS EQUATIONS 3 The characteristic equation of y 00 − 6y 0 + 9y = 0 is: r2 − 6r + 9 = 0. Solve r2 − 6r + 9 = 0, we get r1 = r2 = 3. Let yp (x) = Ax2 e3x be a particular solution to y 00 − 6y 0 + 9y = e3x , then yp0 (x) = 2Axe3x + 3Ax2 e3x yp00 (x) = 2Ae3x + 6Axe3x + 6Axe3x + 9Ax2 e3x = 2Ae3x + 12Axe3x + 9Ax2 e3x = 2Ae3x + 12Axe3x + 9Ax2 e3x − 6 2Axe3x + 3Ax2 e3x + 9Ax2 e3x = 2Ae3x = e3x . yp00 − 6yp0 + 9yp So we have 2A = 1. That is, A = 1 . So a particular solution to y 00 − 9y = e3x is: 2 yp (x) = 1 2 3x x e . 2 V. When f (x) = m sin(kx) + n cos(kx) is a combination of sines and cosines, and ki is NOT a solution to ar2 + br + c = 0, a particular solution can be also a combination of sines and cosines like yp (x) = A sin(kx) + B cos(kx) for some constants A and B. Example 3. Find a particular solution to y 00 + 2y 0 + 2y = cos(2x). Let yp (x) = A sin(2x) + B cos(2x) be a particular solution to y 00 + 2y 0 + 2y = cos(2x), then yp0 (x) = 2A cos(2x) − 2B sin(2x) yp00 (x) = −4A sin(2x) − 4B cos(2x) yp00 + 2yp0 + 3yp = −4A sin(2x) − 4B cos(2x) + 4A cos(2x) − 4B sin(2x) + 2A sin(2x) + 2B cos(2x) = cos(2x). 4 MINGFENG ZHAO That is, [−4B + 4A + 2B − 1] cos(2x) + [−4A − 4B + 2A] sin(2x) = 0. So 4A − 2B − 1 = 0, and 2A + 4B = 0. So we have A= 1 , 5 and B = − 1 . 10 So a particular solution to y 00 + 2y 0 + 2y = cos(2x) is: yp (x) = 1 1 sin(2x) − cos(2x) . 5 10 VI. When f (x) = m sin(kx) + n cos(kx) is a combination of sines and cosines, and ki is a solution to ar2 + br + c = c 0(that is, b = 0 and = k 2 ), a particular solution can be like yp (x) = Ax sin(kx)+Bx cos(kx) for some constants a A and B. Example 4. Find a particular solution to y 00 + y = cos(x). The characteristic equation to y 00 + y = 0 is: r2 + 1 = 0. Solve r2 + 1 = 0, we have r1 = i, and r2 = −i Then the general solution to y 00 + y = 0 is: y(x) = C1 cos(x) + C2 sin(x). Let yp (x) = Ax sin(x) + Bx cos(x) be a particular solution to y 00 + y = cos(x), then yp0 (x) = A sin(x) + Ax cos(x) + B cos(x) − Bx sin(x) yp00 (x) = A cos(x) + A cos(x) − Ax sin(x) − B sin(x) − B sin(x) − Bx cos(x) = 2A cos(x) − Ax sin(x) − 2B sin(x) − Bx cos(x) = 2A cos(x) − Ax sin(x) − 2B sin(x) − Bx cos(x) + Ax sin(x) + Bx cos(x) = 2A cos(x) − 2B sin(x) = cos(x). yp00 + yp LECTURE 14: NONHOMOGENEOUS EQUATIONS 5 That is, [2A − 1] cos(x) − 2B sin(x) = 0. So 2A − 1 = 0, and − 2B = 0. So we have A= 1 , 2 and B = 0. So a particular solution to y 00 + y = cos(x) is: yp (x) = x sin(x) . 2 Remark 1. In summary, if f (x) is one of polynomials, exponential, and a sin(mx) + b cos(mx), then one of g(x), xg(x) and x2 g(x) can be a special solution, where g(x) is a corresponding one of polynomials (with the same degree as f (x)), exponential (with the same exponential terms), and A sin(mx) + B cos(mx). Theorem 2. Let y1,p (x) be a special solution to y 00 + p(x)y + q(x)y = f1 (x), and y2,p (x) be a special solution to y 00 + p(x)y + q(x)y = f2 (x), then yp (x) = y1,p (x) + y2,p (x) is a special solution to y 00 + p(x)y + q(x)y = f (x), where f (x) = f1 (x) + f2 (x). Example 5. Find a special solution to y 00 + y = x + ex . A special solution to y 00 + y = x can be taken as y(x) = Ax + B, and a special solution to y 00 + y = ex can be y(x) = Cex , so let yp (x) = Ax + B + Cex be a special solution to y 00 + y = ex , then yp (x)0 = A + Cex yp00 (x) = Cex yp00 + yp = Cex + Ax + B + Cex = Ax + 2Cex + B = x + ex . So we get [2C − 1]ex + [A − 1]x + B = 0. So 2C − 1 = 0, 2A − 1 = 0, and B = 0. 6 MINGFENG ZHAO That is, A = 1, B = 0, and C = 1 . 2 Therefore, a special solution to y 00 + y = x + ex can be: yp (x) = x + ex . 2 Variation of Parameters Definition 1. Let y1 (x) and y2 (x) be two solutions, the Wronskian of y1 and y2 is defined as: y1 (x) y2 (x) = y1 (x)y20 (x) − y10 (x)y2 (x). W (y1 , y2 ) = 0 0 y1 (x) y2 (x) Let y1 (x) and y2 (x) be a fundamental set of solutions to the homogeneous equation y 00 + p(x)y 0 + q(x)y = 0, consider the nonhomogeneous equation: y 00 + p(x)y 0 + q(x)y = f (x). Now let’s find a particular solution yp (x) to the nonhomogeneous equation y 00 + p(x)y 0 + q(x)y = f (x): let yp (x) = u1 (x)y1 (x) + u2 (x)y2 (x). Then yp0 (x) = u01 (x)y1 (x) + u02 (x)y2 (x) +u1 (x)y10 (x) + u2 (x)y20 (x). Now assume that the sum involving u01 and u02 equals 0, that is, u1 and u2 satisfy u01 (x)y1 (x) + u02 (x)y2 (x) = 0 . Then yp0 (x) = u1 (x)y10 (x) + u2 (x)y20 (x) yp00 (x) = u01 (x)y10 (x) + u1 (x)y100 (x) + u02 (x)y20 (x) + u2 (x)y200 (x) yp00 (x) + p(x)yp0 (x) + q(x)yp (x) = u01 (x)y10 (x) + u1 (x)y100 (x) + u02 (x)y20 (x) + u2 (x)y200 (x) +p(x) [u1 (x)y10 (x) + u2 (x)y20 (x)] + q(x) [u1 (x)y1 (x) + u2 (x)y2 (x)] LECTURE 14: NONHOMOGENEOUS EQUATIONS 7 = u1 (x) [y100 (x) + p(x)y10 (x) + q(x)y1 (x)] +u2 (x) [y200 (x) + p(x)y20 (x) + q(x)y2 (x)] +u01 (x)y10 (x) + u02 (x)y20 (x) = u01 (x)y10 (x) + u02 (x)y20 (x) Since y1 (x) and y2 (x) are complementary solutions = f (x). So we get u01 (x)y10 (x) + u02 (x)y20 (x) = f (x). In summary, u01 and u02 satisfies u01 (x)y1 (x) + u02 (x)y2 (x) = 0 u0 (x)y 0 (x) + u0 (x)y 0 (x) = f (x). 1 1 2 2 Solve the above system, we have u01 (x) = u02 (x) = 1 y20 (x) −y2 (x) · −y10 (x) y1 (x) y2 (x) 0 y1 (x) y20 (x) −y2 (x) f (x) · W (y1 , y2 ) y1 (x) · y1 (x) 0 f (x) Then we have −y2 (x)f (x) , W (y1 , y2 ) and u02 (x) = −y2 (x)f (x) dx, W (y1 , y2 ) and u2 (x) = u01 (x) = y1 (x)f (x) . W (y1 , y2 ) Then Z u1 (x) = Z y1 (x)f (x) dx. W (y1 , y2 ) So a particular solution can be: Z yp (x) = −y1 (x) y2 (x)f (x) dx + y2 (x) W (y1 , y2 ) Example 6. Find a particular solution of y 00 + y = csc(x). The characteristic equation of y 00 + y = 0 is: r2 + 1 = 0. Z y1 (x)f (x) dx . W (y1 , y2 ) 8 MINGFENG ZHAO Solve r2 + 1 = 0, we have and r2 = −i. r1 = i, So the general solution to y 00 + y = 0 is: y(x) = C1 cos(x) + C2 sin(x). Let y(x) = u1 (x) cos(x) + u2 (x) sin(x) be particular solution to y 00 + y = csc(x), then yp0 (x) = u01 (x) cos(x) − u1 (x) sin(x) + u02 (x) sin(x) + u2 (x) cos(x). Assume that u01 (x) cos(x) + u02 (x) sin(x) = 0. Then yp0 (x) = −u1 (x) sin(x) + u2 (x) cos(x) yp00 (x) = −u01 (x) sin(x) + u1 (x) cos(x) + u02 (x) cos(x) − u2 (x) sin(x) yp00 (x) + yp (x) = −u01 (x) sin(x) + u1 (x) cos(x) + u02 (x) cos(x) − u2 (x) sin(x) + u1 (x) cos(x) + u2 (x) sin(x) = −u01 (x) sin(x) + u02 (x) cos(x) = csc(x). So u01 and u02 satify u01 (x) cos(x) + u02 (x) sin(x) = 0 −u0 (x) sin(x) + u0 (x) cos(x) = csc(x). 1 2 Solve u01 and u02 , we have u01 (x) = − sin(x) · csc(x) = −1, and u02 (x) = cos(x) · csc(x) = cot(x). Then Z u1 (x) = −x, and u2 (x) = Z cot(x) dx = cos(x) dx = ln sin(x). sin(x) Then a particular solution to y 00 + y = csc(x) can be: yp (x) = −x cos(x) + sin(x) ln sin(x) . LECTURE 14: NONHOMOGENEOUS EQUATIONS 9 Department of Mathematics, The University of British Columbia, Room 121, 1984 Mathematics Road, Vancouver, B.C. Canada V6T 1Z2 E-mail address: mingfeng@math.ubc.ca