PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS MINGFENG ZHAO Undetermined Coefficients: Let a, b and c be constants, consider the equation: ay 00 + by 0 + cy = f (x). Let pn (x) and p̃n (x) be polynomials with degree n, a particular solution yp (x) to ay 00 + by 0 + cy = f (x) can be taken as: f (x) yp (x) pn (x)emx cos(kx) + p̃n (x)emx sin(kx) xα [qn (x)emx cos(kx) + q̃n (x)emx sin(kx)] where • α is one of 0, 1 and 2 (α is the multiplicity of m + ki as the solutions to ar2 + br + c = 0): – If m + ki is not a root of ar2 + br + c = 0, then α = 0. – If m + ki is a root of ar2 + br + c = 0 and b2 − 4ac 6= 0, then α = 1. – If m + ki is a root of ar2 + br + c = 0 and b2 − 4ac = 0, then α = 2. • qn (x) and q̃n (x) are undetermined polynomials with degree n. Variation of Parameters: To find a particular solution to the nonhomogeneous equation y 00 + p(x)y 0 + q(x)y = f (x): I. Find a fundamental set of solutions y1 (x) and y2 (x) to the homogeneous equation y 00 + p(x)y 0 + q(x)y = 0. II. Let yp (x) = u1 (x)y1 (x) + u2 (x)y2 (x) be a particular solution to y 00 + p(x)y 0 + q(x)y = f (x) III. Compute yp0 (x), we get yp0 (x) = u01 (x)y1 (x) + u02 (x)y2 (x) +u1 (x)y10 (x) + u2 (x)y20 (x) Take u01 (x)y1 (x) + u2 (x)y2 (x) = 0. Then yp0 (x) = u1 (x)y10 (x) + u2 (x)y20 (x) 1 2 MINGFENG ZHAO yp00 (x) = u01 (x)y10 (x) + u1 (x)y100 (x) + u02 (x)y20 (x) + u2 (x)y200 (x). IV. Plug yp (x), yp0 (x) and yp00 (x) into y 00 + p(x)y 0 + q(x)y = f (x), we get u01 (x)y10 (x) + u02 (x)y20 (x) = f (x). V. Solve u01 (x) and u02 (x) from the system: 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 Then −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 ) VI. Solve u1 (x) and u2 (x), then Z u1 (x) = Z y1 (x)f (x) dx. W (y1 , y2 ) VII. Write down the solution: Z yp (x) = −y1 (x) where y2 (x)f (x) dx + y2 (x) W (y1 , y2 ) y1 (x) y2 (x) W (y1 , y2 ) = y10 (x) y20 (x) Z y1 (x)f (x) dx . W (y1 , y2 ) = y1 (x)y20 (x) − y10 (x)y2 (x). PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 3 Practice Exercises Exercise 1. Let α be a real constant. a) Find a fundamental set of solutions to y 00 − 4y 0 + α(4 − α)y = 0. (Hint: You need to consider two cases which depend on α) Answer: The characteristic equation of y 00 − 4y 0 + α(4 − α) = 0 is: r2 − 4t + α(4 − α) = 0. Solve r2 − 4t + α(4 − α) = 0, we get r1 = α, and r2 = 4 − α. We have the following two cases: I. If r1 = r2 , that is, α = 4 − α, then α = 2. Then y1 (x) = e2x and y2 (x) = xe2x form a fundamental set of solutions to y 00 − 4y 0 + 4y = 0. II. If r1 6= r2 , that is, α 6= 4 − α, then α 6= 2. Then y1 (x) = eαx and y2 (x) = e(4−α)x form a fundamental set of solutions to y 00 − 4y 0 + α(4 − α) = 0. b) Compute the Wronskian of those two solutions. (Hint: You need to consider two cases which depend on α) Answer: I. When α = 2, since y1 (x) = e2x and y2 (x) = xe2x , then 2x e xe2x W (y1 , y2 ) = 2e2x e2x + 2xe2x = e2x · e2x + 2xe2x − 2e2x · xe2x = e4x + 2xe4x − 2xe4x = e4x . II. When α 6= 2, since y1 (x) = eαx and y2 (x) = e(4−α)x , then αx e e(4−α)x W (y1 , y2 ) = αeαx (4 − α)e(4−α)x = eαx · (4 − α)e(4−α)x − αeαx · e(4−α)x = (4 − α)e4x − αe4x = (4 − 2α)e4x 4 MINGFENG ZHAO Exercise 2. a) Find a fundamental set of solutions to y 00 + 10y 0 + 25y = 0. Answer: The characteristic equation of y 00 + 10y 0 + 25y = 0 is: r2 + 10r + 25 = 0. Solve r2 + 10r + 25 = 0, we have r1 = r2 = −5. Then y1 (x) = e−5x and y2 (x) = xe−5x form a fundamental set of solutions to y 00 + 10y 0 + 25y = 0. b) Compute the Wronskian of those two solutions. Answer: Since y1 (x) = e−5x and y2 (x) = xe−5x , then e−5x W (y1 , y2 ) = −5e−5x xe−5x e−5x − 5xe−5x = e−5x · e−5x − 5xe−5x + 5e−5x · xe−5x = e−10x − 5xe−10x + 5xe−10x = e−10x . PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 5 Exercise 3. a) Find a fundamental set of solutions to 2y 00 + 4y 0 + 9y = 0. Answer: The characteristic equation of 2y 00 + 4y 0 + 9y = 0 is: 2r2 + 4r + 9 = 0. Solve 2r2 + 4r + 9 = 0, we have √ 14 14 r1 = = −1 + i, and r2 = −1 − i. 4 2 2 ! ! √ √ 14 14 −x x and y2 (x) = e sin x form a fundamental set of solutions to 2y 00 +4y 0 +9y = 0. 2 2 −4 + Then y1 (x) = e−x cos √ −56 √ b) Compute the Wronskian of those two ! solutions. ! √ √ 14 14 −x −x Answer: Since y1 (x) = e cos x and y2 (x) = e sin x , then 2 2 √ √ e−x cos 214 x e−x sin 214 x √ √ √ √ √ √ W (y1 , y2 ) = −e−x cos 214 x − 214 e−x sin 214 x −e−x sin 214 x + 214 e−x cos 214 x ! " ! √ !# √ √ √ 14 14 14 −x 14 −x −x = e cos x · −e sin x + e cos x 2 2 2 2 " ! √ !# ! √ √ √ 14 14 −x 14 14 −x −x + e cos x + e sin x · e sin x 2 2 2 2 ! ! √ ! √ √ √ 14 14 14 −2x 14 2 −2x x cos x + e cos x = −e sin 2 2 2 2 ! ! √ ! √ √ √ 14 14 14 −2x 2 14 −2x +e sin x cos x + e sin x 2 2 2 2 √ 14 −2x e . = 2 6 MINGFENG ZHAO Exercise 4. Find the general solution to 2y 00 + 3y 0 + y = −x + 4x2 . Answer: The characteristic equation of 2y 00 + 3y 0 + y = 0 is: 2r2 + 3r + 1 = 0. Solve 2r2 + 3r + 1 = 0, then r1 = −1, 1 and r2 = − . 2 Then the general solution to 2y 00 + 3y 0 + y = 0 is: x y(x) = C1 e−x + C2 e− 2 . Since 0 is not a solution to 2r2 + 3r + 1 = 0, then we can let yp (x) = Ax2 + Bx + C be a particular solution to 2y 00 + 3y 0 + y = −x + 4x2 , then yp0 (x) = 2Ax + B yp00 (x) = 2A. Plug yp , yp0 and yp00 into 2y 00 + 3y 0 + y = −x + 4x2 , then 2yp00 + 3yp0 + yp = 2 · 2A + 3 · (2Ax + B) + Ax2 + Bx + C = Ax2 + (6A + B)x + 4A + 3B + C = −x + 4x2 . Then we have A = 4, 6A + B = −1, and 4A + 3B + C = 0. So we get A = 4, B = −25, and C = 59. Then yp (x) = 4x2 − 25x + 59. Therefore, the general solution to 2y 00 + 3y 0 + y = −x + 4x2 is: x y(x) = C1 e−x + C2 e− 2 + 4x2 − 25x + 59. PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 7 Exercise 5. Find the general solution to 2y 00 + y 0 + 2y = 3x2 . Answer: The characteristic equation of 2y 00 + y 0 + 2y = 0 is: 2r2 + r + 2 = 0. Solve 2r2 + r + 2 = 0, then r1 = −1 + √ 12 − 4 · 2 · 2 1 =− + 4 4 √ 15 i, 4 1 and r2 = − − 4 √ 15 i. 4 Then the general solution to 2y 00 + y 0 + 2y = 0 is: √ −x 4 y(x) = C1 e cos ! x 15 x + C2 e− 4 sin 4 √ ! 15 x . 4 Since 0 is not a solution to 2r2 + r + 2 = 0, then we can let yp (x) = Ax2 + Bx + C be a particular solution to 2y 00 + y 0 + 2y = 3x2 , then yp0 (x) = 2Ax + B yp00 (x) = 2A. Plug yp , yp0 and yp00 into 2y 00 + y 0 + 2y = 3x2 , then 2yp00 + yp0 + 2yp = 2 · 2A + (2Ax + B) + 2(Ax2 + Bx + C) = 4Ax2 + (2A + 2B)x + 4A + B + 2C = 3x2 . Then we have 2A = 3, 2A + 2B = 0, and 4A + B + 2C = 0. So we get A= 3 , 2 3 B=− , 2 9 and C = − . 4 Then 3 2 3 9 x − x− . 2 2 4 Therefore, the general solution to 2y 00 + 3y 0 + y = −x + 4x2 is: ! ! √ √ x 15 15 3 3 9 −x − y(x) = C1 e 4 cos x + C2 e 4 sin x + x2 − x − . 4 4 2 2 4 yp (x) = 8 MINGFENG ZHAO Exercise 6. Find the general solution to y 00 − 4y 0 + 4y = x. Answer: The characteristic equation of y 00 − 4y 0 + 4y = 0 is: r2 − 4r + 4 = 0. Solve r2 − 4r + 4 = 0, then r1 = r2 = 2. Then the general solution to y 00 − 4y 0 + 4y = 0 is: y(x) = C1 e2x + C2 xe2x . Since 0 is not a solution to r2 −4r +4 = 0, then we can let yp (x) = Ax+B be a particular solution to y 00 −4y 0 +4y = x, then yp0 (x) = A yp00 (x) = 0. Plug yp , yp0 and yp00 into y 00 − 4y 0 + 4y = x, then yp00 − 4yp0 + 4yp = 0 − 4 · A + 4(Ax + B) = 4Ax − 4A + 4B = x Then we have 4A = 1, − 4A + 4B = 0. and So we get A= 1 , 4 and B = 1 . 4 Then yp (x) = x 1 + . 4 4 Therefore, the general solution to y 00 − 4y 0 + 4y = x is: y(x) = C1 e2x + C2 xe2x + x 1 + . 4 4 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 9 Exercise 7. Find the general solution to y 00 − 3y 0 = 2x + 4. Answer: The characteristic equation of y 00 − 3y 0 = 0 is: r2 − 3r = 0. Solve r2 − 3r = 0, then r1 = 0, and r2 = 3. Then the general solution to y 00 − 3y 0 = 0 is: y(x) = C1 + C2 e3x . Since 0 is a solution to r2 − 3r = 0, then we can let yp (x) = x(Ax + B) = Ax2 + Bx be a particular solution to y 00 − 3y 0 = 2x + 4, then yp0 (x) = 2Ax + B yp00 (x) = 2A. Plug yp , yp0 and yp00 into y 00 − 3y 0 = 2x + 4, then yp00 − 3yp0 = 2A − 3 · (2Ax + B) = −6Ax + 2A − 3B = 2x + 4 Then we have −6A = 2, and 2A − 3B = 4. So we get 1 A=− , 3 and B = − 14 . 9 Then yp (x) = − x2 14 − x. 3 9 Therefore, the general solution to y 00 − 3y 0 = 2x + 4 is: y(x) = C1 + C2 e3x − x2 14 − x. 3 9 10 MINGFENG ZHAO Exercise 8. Find the general solution to 2y 00 = 5x2 + 3. Answer: The characteristic equation of 2y 00 = 0 is: 2r2 = 0. Solve 2r2 = 0, then r1 = r2 = 0. Then the general solution to 2y 00 = 0 is: y(x) = C1 + C2 x. Since 0 is a double solution to 2r2 = 0, then we can let yp (x) = x2 (Ax2 + Bx + C) = Ax4 + Bx3 + Cx2 be a particular solution to 2y 00 = 5x2 + 3, then yp0 (x) = 4Ax3 + 3Bx2 + 2Cx yp00 (x) = 12Ax2 + 6Bx + 2C Plug yp , yp0 and yp00 into 2y 00 = 5x2 + 3, then 2yp00 = 2(12Ax2 + 6Bx + 2C) = 24Ax2 + 12Bx + 4C = 5x2 + 3 Then we have 24A = 5, 12B = 0, and 4C = 3. So we get A= 5 , 24 B = 0, and C = 3 . 4 Then yp (x) = 5 4 3 2 x + x . 24 4 Therefore, the general solution to 2y 00 = 5x2 + 3 is: y(x) = C1 + C2 x + 5 4 3 2 x + x . 24 4 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 11 Exercise 9. Find the general solution to y 00 + 2y 0 + 4y = 3e2x . Answer: The characteristic equation of y 00 + 2y 0 + 4y = 0 is: r2 + 2r + 4 = 0. Solve r2 + 2r + 4 = 0, then r1 = −2 + √ √ 22 − 4 · 4 = −1 + 3i, 2 and r2 = −1 − √ 3i. Then the general solution to y 00 + 2y 0 + 4y = 0 is: √ √ y(x) = C1 e−x cos( 3x) + C2 e−x sin( 3x). Since 2 is not a solution to r2 +2r+4 = 0, then we can let yp (x) = Ae2x be a particular solution to y 00 +2y 0 +4y = 3e2x , then yp0 (x) = 2Ae2x yp00 (x) = 4Ae2x Plug yp , yp0 and yp00 into y 00 + 2y 0 + 4y = 3e2x , then yp00 + 2yp0 + 4yp = 4Ae2x + 2 · 2Ae2x + 4Ae2x = 12Ae2x = 3e2x . Then we have 12A = 3. So we get A= 1 . 4 Then yp (x) = 1 2x e . 4 Therefore, the general solution to y 00 + 2y 0 + 4y = 3e2x is: √ √ 1 y(x) = C1 e−x cos( 3x) + C2 e−x sin( 3x) + e2x . 4 12 MINGFENG ZHAO Exercise 10. Find the general solution to 2y 00 + 4y 0 − 6y = 7ex . Answer: The characteristic equation of 2y 00 + 4y 0 − 6y = 0 is: 2r2 + 4r − 6 = 0. Solve 2r2 + 4r − 6 = 0, then r1 = −3, and r2 = 1. Then the general solution to 2y 00 + 4y 0 − 6y = 0 is: y(x) = C1 e−3x + C2 ex . Since 1 is a solution to 2r2 + 4r + 6 = 0, then we can let yp (x) = Axex be a particular solution to 2y 00 + 4y 0 − 6y = 7ex , then yp0 (x) = Aex + Axex yp00 (x) = Aex + Aex + Axex = 2Aex + Axex Plug yp , yp0 and yp00 into 2y 00 + 4y 0 − 6y = 7ex , then 2yp00 + 4yp0 − 6yp = 2(2Aex + Axex ) + 4(Aex + Axex ) − 6Axex = 8Aex = 7ex . Then we have 8A = 7. So we get A= 7 . 8 Then yp (x) = 7 x xe . 8 Therefore, the general solution to 2y 00 + 4y 0 − 6y = 7ex is: 7 y(x) = C1 e−3x + C2 ex + xex . 8 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 13 Exercise 11. Find the general solution to y 00 − 6y 0 + 9y = 5e3x . Answer: The characteristic equation of y 00 − 6y 0 + 9y = 0 is: r2 − 6r + 9 = 0 = 0. Solve r2 − 6r + 9 = 0, then r1 = r2 = 3. Then the general solution to y 00 − 6y 0 + 9y = 0 is: y(x) = C1 e3x + C2 xe3x . Since 3 is a double solution to r2 − 6r + 9 = 0, then we can let yp (x) = Ax2 e3x be a particular solution to y 00 − 6y 0 + 9y = 5e3x , then yp0 (x) = 2Axe3x + 3Ax2 e3x yp00 (x) = 2Ae3x + 6Axe3x + 6Axe3x + 9Ax2 e3x = 2Ae3x + 12Axe3x + 9Ax2 e3x Plug yp , yp0 and yp00 into y 00 − 6y 0 + 9y = 5e3x , then yp00 − 6yp0 + 9yp = 2Ae3x + 12Axe3x + 9Ax2 e3x − 6(2Axe3x + 3Ax2 e3x ) + 9Ax2 e3x = 2Ae3x = 5e3x Then we have 2A = 5. So we get A= 5 . 2 Then 5 2 3x x e . 2 is: yp (x) = Therefore, the general solution to y 00 − 6y 0 + 9y = 5e3x 5 y(x) = C1 e3x + C2 xe3x + x2 e3x . 2 14 MINGFENG ZHAO Exercise 12. Find the general solution to y 00 + 2y 0 − 5y = 3 sin(2x). Answer: The characteristic equation of y 00 + 2y 0 − 5y = 0 is: r2 + 2r − 5 = 0. Solve r2 + 2r − 5 = 0, then r1 = −2 + √ √ 22 + 4 · 5 = −1 + 6, 2 and r2 = −1 − √ 6. Then the general solution to y 00 + 2y 0 − 5y = 0 is: y(x) = C1 e(−1+ √ 6)x + C2 e(−1− √ 6)x . Since 2i is not a solution to r2 + 2r − 5 = 0, then we can let yp (x) = A cos(2x) + B sin(2x) be a particular solution to y 00 + 2y 0 − 5y = 3 sin(2x), then yp0 (x) = −2A sin(2x) + 2B cos(2x) yp00 (x) = −4A cos(2x) − 4B sin(2x). Plug yp , yp0 and yp00 into y 00 + 2y 0 − 5y = 3 sin(2x), then yp00 + 2yp0 − 5yp = −4A cos(2x) − 4B sin(2x) + 2[−2A sin(2x) + 2B cos(2x)] − 5[A cos(2x) + B sin(2x)] = [−9A + 4B] cos(2x) + [−4A − 9B] sin(2x) = 3 sin(2x). Then we have −9A + 4B = 0, and − 4A − 9B = 3. So we get A=− 12 , 97 and B = − 27 . 97 Then 12 27 cos(2x) − sin(2x). 97 97 Therefore, the general solution to y 00 + 2y 0 − 5y = 3 sin(2x) is: yp (x) = − y(x) = C1 e(−1+ √ 6)x + C2 e(−1− √ 6)x − 12 27 cos(2x) − sin(2x). 97 97 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 15 Exercise 13. Find the general solution to 2y 00 + 3y 0 + 10y = sin(4x). Answer: The characteristic equation of 2y 00 + 3y 0 + 10y = 0 is: 2r2 + 3r + 10 = 0. Solve 2r2 + 3r + 10 = 0, then r1 = −3 + √ 32 − 4 · 2 · 10 3 =− + 4 4 √ 71 i, 4 3 and r2 = − − 4 Then the general solution to 2y 00 + 3y 0 + 10y = 0 is: √ y(x) = C1 e − 43 x cos ! 3 71 x + C2 e− 4 x sin 4 √ 71 i. 4 √ ! 71 x . 4 Since 4i is not a solution to 2r2 + 3r + 10 = 0, then we can let yp (x) = A cos(4x) + B sin(4x) be a particular solution to 2y 00 + 3y 0 + 10y = sin(4x), then yp0 (x) = −4A sin(4x) + 4B cos(4x) yp00 (x) = −16A cos(4x) − 16B sin(4x). Plug yp , yp0 and yp00 into 2y 00 + 3y 0 + 10y = sin(4x), then 2yp00 + 3yp0 + 10yp = 2[−16A cos(4x) − 16B sin(4x)] + 3[−4A sin(4x) + 4B cos(4x)] + 10[A cos(4x) + B sin(4x)] = [−22A + 12B] cos(4x) + [−12A − 22B] sin(4x) = sin(4x). Then we have −22A + 12B = 0, and − 12A − 22B = 1. So we get A=− 3 , 157 and B = − 11 . 314 Then 3 11 cos(4x) − sin(4x). 157 314 Therefore, the general solution to 2y 00 + 3y 0 + 10y = sin(4x) is: ! ! √ √ 71 71 3 11 − 34 x − 34 x y(x) = C1 e cos x + C2 e sin x − cos(4x) − sin(4x). 4 4 157 314 yp (x) = − 16 MINGFENG ZHAO Exercise 14. Find the general solution to y 00 + 9y = 2 sin(3x) + cos(3x). Answer: The characteristic equation of y 00 + 9y = 0 is: r2 + 9 = 0. Solve r2 + 9 = 0, then r1 = 3i, and r2 = −3i. Then the general solution to y 00 + 9y = 0 is: y(x) = C1 cos(3x) + C2 sin(3x). Since 3i is a solution to r2 + 9 = 0, then we can let yp (x) = Ax cos(3x) + Bx sin(3x) be a particular solution to y 00 + 9y = 2 sin(3x) + cos(3x), then yp0 (x) = A cos(3x) − 3Ax sin(3x) + B sin(3x) + 3Bx cos(3x) yp00 (x) = −3A sin(3x) − 3A sin(3x) − 9Ax cos(3x) + 3B cos(3x) + 3B cos(3x) − 9Bx sin(3x) = −6A sin(3x) − 9Ax cos(3x) + 6B cos(3x) − 9Bx sin(3x). Plug yp , yp0 and yp00 into y 00 + 9y = 2 sin(3x) + cos(3x), then yp00 + 9yp = −6A sin(3x) − 9Ax cos(3x) + 6B cos(3x) − 9Bx sin(3x) + 9[Ax cos(3x) + Bx sin(3x)] = −6A sin(3x) + 6B cos(3x) = 2 sin(3x) + cos(3x) Then we have −6A = 2, and 1 A=− , 3 and B = 6B = 1. So we get 1 . 6 Then 1 1 yp (x) = − x cos(3x) + x sin(3x). 3 6 00 Therefore, the general solution to y + 9y = 2 sin(3x) + cos(3x) is: 1 1 y(x) = C1 cos(3x) + C2 sin(3x) − x cos(3x) + x sin(3x). 3 6 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 17 Exercise 15. Find the general solution to y 00 + 3y = 2x2 + xe−3x + sin(3x). Answer: The characteristic equation of y 00 + 3y = 0 is: r2 + 3 = 0. Solve r2 + 3 = 0, then r1 = √ 3i, √ and r2 = − 3i. Then the general solution to y 00 + 3y = 0 is: √ √ y(x) = C1 cos( 3x) + C2 sin( 3x). Then all of 0, −3 and 3i are not solutions to r2 +3r = 0, let yp (x) = Ax2 +Bx+C+(Dx+E)e−3x +F sin(3x)+G cos(3x) be a particular solution to y 00 + 3y = 2x2 + xe−3x + sin(3x), then yp0 (x) = 2Ax + B + De−3x − 3(Dx + E)e−3x + 3F cos(3x) − 3G sin(3x) yp00 (x) = 2A − 3D−3x − 3De−3x + 9(Dx + E)e−3x − 9F sin(3x) − 9G cos(3x) = 2A − 6De−3x + 9(Dx + E)e−3x − 9F sin(3x) − 9G cos(3x). Plug yp , yp0 and yp00 into y 00 + 3y = 2x2 + xe−3x + sin(3x), then yp00 + 3yp = 2A − 6De−3x + 9(Dx + E)e−3x − 9F sin(3x) − 9G cos(3x) +3[Ax2 + Bx + C + (Dx + E)e−3x + F sin(3x) + G cos(3x)] = 3Ax2 + 3Bx + (2A + 3C) + [12Dx − 6D + 12E]e−3x − 6F sin(3x) − 6G cos(3x) = 2x2 + xe−3x + sin(3x) Then we have 3A = 2, 3B = 0, 2A + 3C = 0, 12D = 1, −6D + 12E = 0, −6F = 1, and − 6G = 0. So we get A= 2 , 3 B = 0, 4 C=− , 9 D= 1 , 12 E= 1 , 24 1 F =− , 6 and G = 0. Then 2 2 4 1 1 1 x − + xe−3x + e−3x − sin(3x). 3 9 12 24 6 Therefore, the general solution to y 00 + 3y = 2x2 + xe−3x + sin(3x) is: yp (x) = √ √ 2 4 1 1 1 y(x) = C1 cos( 3x) + C2 sin( 3x) + x2 − + xe−3x + e−3x − sin(3x). 3 9 12 24 6 18 MINGFENG ZHAO Exercise 16. Find the general solution to y 00 + 4y = 4 sin(2x) + 3. Answer: The characteristic equation of y 00 + 4y = 0 is: r2 + 4 = 0. Solve r2 + 4 = 0, then r1 = 2i, and r2 = −2i. Then the general solution to y 00 + 4y = 0 is: y(x) = C1 cos(2x) + C2 sin(2x). Then 2i is a solution to r2 + 4 = 0, but 0 is not a solution to r2 + 4 = 0. Let yp (x) = Ax cos(2x) + Bx sin(2x) + C be a particular solution to y 00 + 4y = 4 sin(2x) + 3, then yp0 (x) = A cos(2x) − 2Ax sin(2x) + B sin(2x) + 2Bx cos(2x) yp00 (x) = −2A sin(2x) − 2A sin(2x) − 4Ax cos(2x) + 2B cos(2x) + 2B cos(2x) − 4Bx sin(2x) = −4A sin(2x) − 4Ax cos(2x) + 4B cos(2x) − 4Bx sin(2x). Plug yp , yp0 and yp00 into y 00 + 4y = 4 sin(2x) + 3, then yp00 + 4yp = −4A sin(2x) − 4Ax cos(2x) + 4B cos(2x) − 4Bx sin(2x) + 4[Ax cos(2x) + Bx sin(2x) + C] = −4A sin(2x) + 4B cos(2x) + 4C = 4 sin(2x) + 3 Then we have −4A = 4, 4B = 0, and A = −1, B = 0, and C = 4C = 3. So we get 3 4 Then 3 yp (x) = −x cos(2x) + . 4 00 Therefore, the general solution to y + 4y = 4 sin(2x) + 3 is: 3 y(x) = C1 cos(2x) + C2 sin(2x) − x cos(2x) + . 4 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS Exercise 17. Solve the following problem: y 00 + y = f (x), y(0) = 0, y 0 (0) = 1, where x, if 0 ≤ x ≤ π, f (x) = πeπ−x , if x > π. Answer: The characteristic equation of y 00 + y = 0 is: r2 + 1 = 0. Solve r2 + 1 = 0, then and r2 = −i. r1 = i, Then the general solution to y 00 + y = 0 is: y(x) = C1 cos(x) + C2 sin(x). Then 0 is a not solution to r2 + 1 = 0. Let yp (x) = Ax + B be a particular solution to y 00 + y = x, then yp0 (x) = A yp00 (x) = 0. Plug yp , yp0 and yp00 into y 00 + y = x, then yp00 + yp = Ax + B = x. So A = 1, and B = 0. Then yp (x) = x. So the general solution to y 00 + y = x is: y(x) = C1 cos(x) + C2 sin(x) + x. For 0 ≤ x ≤ π, then y 0 (x) = −C1 sin(x) + C2 cos(x) + 1. Since y(0) = 0 and y 0 (0) = 1, then C1 = 0, and C2 + 1 = 1. 19 20 MINGFENG ZHAO Then C1 = 0 and C2 = 0, that is, ∀0 ≤ x ≤ π. y(x) = x, So y 0 (x) = 1, which implies that y(π) = π, and y 0 (π) = 1. Since −1 is not a solution to r2 + 1 = 0, then let yp (x) = Ae−x be a particular solution to y 00 + y = πeπ−x . So we get yp0 (x) = −Ae−x yp00 (x) = Ae−x . Plug yp , yp0 and yp00 into y 00 + y = πeπ−x , then yp00 + yp = Ae−x + Ae−x = 2Ae−x = πeπ−x . Then A= πeπ . 2 So yp (x) = πeπ −x e . 2 Then the general solution to y 00 + y = πeπ−x is: y(x) = C1 cos(x) + C2 sin(x) + πeπ −x e . 2 So for x ≥ π, we have y 0 (x) = −C1 sin(x) + C2 cos(x) − πeπ −x e . 2 Since y(π) = π and y 0 (π) = 1, then −C1 + π = π, 2 and − C2 − π = 1. 2 So we get π C1 = − , 2 and C2 = −1 − π . 2 That is, π 2+π πeπ −x cos(x) − sin(x) + e , ∀x ≥ π. 2 2 2 In summary, the solution to y 00 + y = f (x), y(0) = 0 and y 0 (0) = 1 is: x, if 0 ≤ x ≤ π, π y(x) = π 2 + π πe −x − cos(x) − sin(x) + e , if x > π. 2 2 2 y(x) = − PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 21 Exercise 18. Find the general solution to y 00 + 4y = (6x + 7) cos(2x). Answer: The characteristic equation of y 00 + 4y = 0 is: r2 + 4 = 0. Solve r2 + 4 = 0, then r1 = 2i, and r2 = −2i. Then the general solution to y 00 + 4y = 0 is: y(x) = C1 cos(2x) + C2 sin(2x). Since 2i is a solution to r2 + 4 = 0, then we can let yp (x) = x(Ax + B) cos(2x) + x(Cx + D) sin(2x) = (Ax2 + Bx) cos(2x) + (Cx2 + Dx) sin(2x) be a particular solution to y 00 + 4y = (6x + 7) cos(2x), then yp0 (x) = (2Ax + B) cos(2x) − 2(Ax2 + Bx) sin(2x) + (2Cx + D) sin(2x) + 2(Cx2 + Dx) cos(2x) yp00 (x) = 2A cos(2x) − 2(2Ax + B) sin(2x) − 2(2Ax + B) sin(2x) − 4(Ax2 + Bx) cos(2x) +2C sin(2x) + 2(2Cx + D) cos(2x) + 2(2Cx + D) cos(2x) − 4(Cx2 + Dx) sin(2x) [−4Ax2 + (−4B + 8C)x + 2A + 4D] cos(2x) + [−4Cx2 + (−8A − 4D)x − 4B + 2C] sin(2x). = Plug yp , yp0 and yp00 into y 00 + 4y = (6x + 7) cos(2x), then yp00 + 4yp = [−4Ax2 + (−4B + 8C)x + 2A + 4D] cos(2x) + [−4Cx2 + (−8A − 4D)x − 4B + 2C] sin(2x) +4[(Ax2 + Bx) cos(2x) + (Cx2 + Dx) sin(2x)] = [8Cx + 2A + 4D] cos(2x) + [−8Ax − 4B + 2C] sin(2x) = (6x + 7) cos(2x). Then we have 8C = 6, −8A = 0, 2A + 4D = 7, and − 4B + 2C = 0. So we get A = 0, B= 3 , 8 C= 3 4 and D = 7 . 4 Then 3 3 7 x cos(2x) + x2 sin(2x) + x sin(2x). 8 4 4 Therefore, the general solution to y 00 + 4y = (6x + 7) cos(2x) is: yp (x) = 3 3 7 y(x) = C1 cos(2x) + C2 sin(2x) + x cos(2x) + x2 sin(2x) + x sin(2x). 8 4 4 22 MINGFENG ZHAO Exercise 19. Find the general solution to y 00 + 2y 0 + 5y = 3xe−x cos(2x). Answer: The characteristic equation of y 00 + 2y 0 + 5y = 0 is: r2 + 2r + 5 = 0. Solve r2 + 2r + 5 = 0, then r1 = −2 + √ 22 − 4 · 5 = −1 + 2i, 2 and r2 = −1 − 2i. Then the general solution to y 00 + 2y 0 + 5y = 0 is: y(x) = C1 e−x cos(2x) + C2 e−x sin(2x). Since −1 + 2i is a solution to r2 + 2r + 5 = 0, then we can let yp (x) = x(Ax + B)e−x cos(2x) + x(Cx + D)e−x sin(2x) = (Ax2 + Bx)e−x cos(2x) + (Cx2 + Dx)e−x sin(2x) be a particular solution to y 00 + 2y 0 + 5y = 3xe−x cos(2x), then yp0 (x) = (2Ax + B)e−x cos(2x) − (Ax2 + Bx)e−x cos(2x) − 2(Ax2 + Bx)e−x sin(2x) +(2Cx + D)e−x sin(2x) − (Cx2 + Dx)e−x sin(2x) + 2(Cx2 + Dx)e−x cos(2x) = [(−A + 2C)x2 + (2A − B + 2D)x + B]e−x cos(2x) +[(−2A − C)x2 + (−2B + 2C − D)x + D]e−x sin(2x) yp00 (x) = [2(−A + 2C)x + (2A − B + 2D)]e−x cos(2x) − [(−A + 2C)x2 + (2A − B + 2D)x + B]e−x cos(2x) −2[(−A + 2C)x2 + (2A − B + 2D)x + B]e−x sin(2x) + [2(−2A − C)x + (−2B + 2C − D)]e−x sin(2x) −[(−2A − C)x2 + (−2B + 2C − D)x + D]e−x sin(2x) + 2[(−2A − C)x2 + (−2B + 2C − D)x + D]e−x cos(2x) = [(−3A − 4C)x2 + (−4A − 3B + 8C − 4D)x + 2A − 2B + 4D]e−x cos(2x) +[(4A − 3C)x2 + (−8A + 4B − 4C + 5D)x − 4B + 2C − 2D]e−x sin(2x). Plug yp , yp0 and yp00 into y 00 + 2y 0 + 5y = 3xe−x cos(2x), then yp00 + 2yp0 + 5yp = [(−3A − 4C)x2 + (−4A − 3B + 8C − 4D)x + 2A − 2B + 4D]e−x cos(2x) +[(4A − 3C)x2 + (−8A + 4B − 4C + 5D)x − 4B + 2C − 2D]e−x sin(2x) +2[(−A + 2C)x2 + (2A − B + 2D)x + B]e−x cos(2x) +2[(−2A − C)x2 + (−2B + 2C − D)x + D]e−x sin(2x) +5(Ax2 + Bx)e−x cos(2x) + 5(Cx2 + Dx)e−x sin(2x) = [8Cx + 2A + 4D]e−x cos(2x) + [(−8A + 8D)x − 4B + 2C]e−x sin(2x) PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS Then we have 8C = 3, 2A + 4D = 0, −8A + 8D = 0, and − 4B + 2C = 0. So we get A = 0, B= 3 , 16 C= 3 8 and D = 0. Then 3 −x 3 xe cos(2x) + x2 sin(2x). 16 8 00 0 −x Therefore, the general solution to y + 2y + 5y = 3xe cos(2x) is: yp (x) = y(x) = C1 e−x cos(2x) + C2 e−x sin(2x) + 3 −x 3 xe cos(2x) + x2 sin(2x). 16 8 23 24 MINGFENG ZHAO Exercise 20. Find the general solution to y 00 + 4y 0 + 4y = x−2 e−2x . Answer: The characteristic equation of y 00 + 4y 0 + 4y = 0 is: r2 + 4r + 4 = 0. Solve r2 + 4r + 4 = 0, then r1 = r2 = −2. Then the general solution to y 00 + 4y 0 + 4y = 0 is: y(x) = C1 e−2x + C2 xe−2x . Then y1 (x) = e−2x and y20 (x) = xe−2x form a fundamental set of solutions to y 00 + 4y 0 + 4y = 0. Let yp (x) = u1 (x)y1 (x) + u2 (x)y2 (x) = u1 (x)e−2x + u2 (x)xe−2x be a particular solution to y 00 + 4y 0 + 4y = x−2 e−2x such that u01 (x)y1 (x) + u02 (x)y2 (x) = u01 (x)e−2x + u02 (x)xe−2x = 0. Then u01 (x)y10 (x) + u02 (x)y20 (x) = u01 (x) · (−2e−2x ) + u02 (x) · (e−2x − 2xe−2x ) = x−2 e−2x . So we get u0 (x) + xu0 (x) = 0 1 2 −2u0 (x) + (1 − 2x)u0 (x) = x−2 . 1 2 Solve u01 (x) and u02 (x), we get u01 (x) = −x−1 , and u02 (x) = x−2 . x−1 dx = − ln |x|, and u02 (x) = Then Z u1 (x) = − Z 1 x−2 dx = − . x So yp (x) = −e−2x ln |x| − e−2x . Therefore, the general solution to y 00 + 4y 0 + 4y = x−2 e−2x is: y(x) = C1 e−2x + C2 xe−2x − e−2x ln |x|. PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS Exercise 21. Find the general solution to y 00 − 2y 0 + y = 25 ex . 1 + x2 Answer: The characteristic equation of y 00 − 2y 0 + y = 0 is: r2 − 2r + 1 = 0. Solve r2 − 2r + 1 = 0, then r1 = r2 = 1. Then the general solution to y 00 − 2y 0 + y = 0 is: y(x) = C1 ex + C2 xex . Then y1 (x) = ex and y20 (x) = xex form a fundamental set of solutions to y 00 − 2y 0 + y = 0. Let yp (x) = u1 (x)y1 (x) + ex u2 (x)y2 (x) = u1 (x)ex + u2 (x)xex be a particular solution to y 00 − 2y 0 + y = such that 1 + x2 u01 (x)y1 (x) + u02 (x)y2 (x) = u01 (x)ex + u02 (x)xex = 0. Then u01 (x)y10 (x) + u02 (x)y20 (x) = u01 (x) · (ex ) + u02 (x) · (ex + xex ) = ex . 1 + x2 So we get u01 (x) + xu02 (x) = 0 u0 (x) + (1 + x)u0 (x) = 1 2 1 . 1 + x2 Solve u01 (x) and u02 (x), we get u01 (x) = − x2 x , +1 and u02 (x) = x2 1 . +1 Then Z u1 (x) = − 1 x dx = ln(x2 + 1), x2 + 1 2 and u02 (x) Z = 1 dx = arctan(x). x2 + 1 So ex ln(x2 + 1) + xex arctan(x). 2 ex Therefore, the general solution to y 00 − 2y 0 + y = is: 1 + x2 ex y(x) = C1 ex + C2 xex + ln(x2 + 1) + xex arctan(x). 2 yp (x) = 26 MINGFENG ZHAO Exercise 22. Find the general solution to y 00 + 4y = 3 csc(2x). Answer: The characteristic equation of y 00 + 4y = 0 is: r2 + 4 = 0. Solve r2 + 4 = 0, then and r2 = −2i. r1 = 2i, Then the general solution to y 00 + 4y = 0 is: y(x) = C1 cos(2x) + C2 sin(2x). Then y1 (x) = cos(2x) and y20 (x) = sin(2x) form a fundamental set of solutions to y 00 + 4y = 0. Let yp (x) = u1 (x)y1 (x) + u2 (x)y2 (x) = u1 (x) cos(2x) + u2 (x) sin(2x) be a particular solution to y 00 + 4y = 3 csc(2x) such that u01 (x)y1 (x) + u02 (x)y2 (x) = u01 (x) cos(2x) + u02 (x) sin(2x) = 0. Then u01 (x)y10 (x) + u02 (x)y20 (x) = u01 (x) · (−2 sin(2x)) + u02 (x) · (2 cos(2x)) = 3 csc(2x). So we get u0 (x) cos(2x) + u0 (x) sin(2x) = 0 1 2 −2 sin(2x)u0 (x) + 2 cos(2x)u0 (x) = 3 csc(2x). 1 2 Solve u01 (x) and u02 (x), we get u01 (x) = −3 cos(2x) and u02 (x) = 3 cos2 (2x) . sin(2x) Then Z u1 (x) = − 3 3 cos(2x) dx = − sin(2x), 2 and u02 (x) = Z 3 cos2 (2x) dx = 3 sin(2x) Z cos2 (2x) dx. sin(2x) So 3 yp (x) = − sin(2x) cos(2x) + 3 sin(2x) 2 Z cos2 (2x) dx. sin(2x) Therefore, the general solution to y 00 + 4y = 3 csc(2x) is: y(x) = C1 cos(2x) + C2 sin(2x) − 3 sin(2x) cos(2x) + 3 sin(2x) 2 Z cos2 (2x) dx. sin(2x) PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 27 Exercise 23. Find the general solution to y 00 + y = tan(x). Answer: The characteristic equation of y 00 + y = 0 is: r2 + 1 = 0. Solve r2 + 1 = 0, then r1 = i, and r2 = −i. Then the general solution to y 00 + y = 0 is: y(x) = C1 cos(x) + C2 sin(x). Then y1 (x) = cos(x) and y20 (x) = sin(x) form a fundamental set of solutions to y 00 + y = 0. Let yp (x) = u1 (x)y1 (x) + u2 (x)y2 (x) = u1 (x) cos(x) + u2 (x) sin(x) be a particular solution to y 00 + y = tan(x) such that u01 (x)y1 (x) + u02 (x)y2 (x) = u01 (x) cos(x) + u02 (x) sin(x) = 0. Then u01 (x)y10 (x) + u02 (x)y20 (x) = u01 (x) · (− sin(x)) + u02 (x) · (cos(x)) = tan(x). So we get u0 (x) cos(x) + u0 (x) sin(x) = 0 1 2 − sin(x)u0 (x) + cos(x)u0 (x) = tan(x). 1 Solve u01 (x) and u02 (x), we get u01 (x) = − 2 sin2 (x) cos(x) and u02 (x) = sin(x). Then Z u1 (x) = − sin2 (x) dx, cos(x) and u02 (x) = Z sin(x) dx = − cos(x). So Z yp (x) = − cos(x) sin2 (x) dx − sin(x) cos(x). cos(x) Therefore, the general solution to y 00 + y = tan(x) is: Z y(x) = C1 cos(x) + C2 sin(x) − cos(x) sin2 (x) dx − sin(x) cos(x). cos(x) 28 MINGFENG ZHAO Exercise 24. Solve the following problem: y 00 − 2y 0 + y = f (x), where y(0) = 0, y 0 (0) = 0, xex , if 0 ≤ x ≤ 1, f (x) = esin( πx ) 2 , if x > 1. Answer: The characteristic equation of y 00 − 2y 0 + y = 0 is: r2 − 2r + 1 = 0. Solve r2 − 2r + 1 = 0, then r1 = r2 = 1. Then the general solution to y 00 − 2y 0 + y = 0 is: y(x) = C1 ex + C2 xex . Then y1 (x) = ex and y20 (x) = xex form a fundamental set of solutions to y 00 − 2y 0 + y = 0. Since 1 is a double zero of r2 − 2r + 1 = 0, let yp (x) = x2 (Ax + B)ex = (Ax3 + Bx2 )ex be a particular solution to y 00 − 2y 0 + y = xex , then yp0 (x) yp00 (x) = (3Ax2 + 2Bx)ex + (Ax3 + Bx2 )ex = [Ax3 + (3A + B)x2 + 2Bx]ex = (6Ax + 2B)ex + (3Ax2 + 2Bx)ex + (3Ax2 + 2Bx)ex + (Ax3 + Bx2 )ex = [Ax3 + (6A + B)x2 + (6A + 4B)x + 2B]ex . Plug yp , yp0 and yp00 into y 00 − 2y 0 + y = xex , then yp00 − 2yp0 + yp = [Ax3 + (6A + B)x2 + (6A + 4B)x + 2B]ex − 2[Ax3 + (3A + B)x2 + 2Bx]ex + (Ax3 + Bx2 )ex = [6Ax + 2B]ex = xex . Then we have 6A = 1, and 2B = 0. So we get A= 1 , 6 and B = 0. Then yp (x) = 1 3 x x e . 6 PRACTICE EXERCISES FOR NONHOMOGENEOUS EQUATIONS 29 So the general solution to y 00 − 2y 0 + y = xex is: 1 y(x) = C1 ex + C2 xex + x3 ex . 6 Then 1 1 y 0 (x) = C1 ex + C2 ex + C2 xex + x2 ex + x3 ex . 2 6 Since y(0) = 0 and y 0 (0) = 0, then C1 = 0, and C1 + C2 = 0. That is, C1 = C2 = 0, which implies that y(x) = 1 3 x x e , 6 y(1) = e , 6 ∀0 ≤ x ≤ 1. So we get and y 0 (1) = 2e . 3 Since y1 (x) = ex and y20 (x) = xex form a fundamental set of solutions to y 00 − 2y 0 + y = 0, let yp (x) = u1 (x)y1 (x) + πx u2 (x)y2 (x) = u1 (x)ex + u2 (x)xex be a particular solution to y 00 − 2y 0 + y = esin( 2 ) such that u01 (x)y1 (x) + u02 (x)y2 (x) = u01 (x)ex + u02 (x)xex = 0. Then u01 (x)y10 (x) + u02 (x)y20 (x) = u01 (x) · (ex ) + u02 (x) · (ex + xex ) = esin( πx 2 ). So we get u0 (x) + xu0 (x) = 0 1 2 u0 (x) + (1 + x)u0 (x) = esin( πx 2 )−x . 1 2 Solve u01 (x) and u02 (x), we get u01 (x) = −xesin( πx 2 )−x , and u02 (x) = esin( πx 2 )−x . Then Z u1 (x) = − xesin( πx 2 )−x dx, and u02 (x) = Z esin( πx 2 )−x dx. So yp (x) = −ex Z x πt tesin( 2 )−t dt + xex 1 Z x πt esin( 2 )−t dt. 1 Therefore, the general solution to y 00 − 2y 0 + y = esin( 2 ) is: Z x Z sin( πt −t x x x x ) 2 y(x) = C1 e + C2 xe − e te dt + xe πx 1 1 x πt esin( 2 )−t dt. 30 MINGFENG ZHAO Then 0 y (x) x x x = C1 e + C2 e + C2 xe − e x x Z πt πx tesin( 2 )−t dt − ex xesin( 2 )−x 1 +ex Z x esin( )−t dt + xex πt 2 1 Since y(1) = Z x πt πx esin( 2 )−t dt + xex esin( 2 )−x 1 2e e and y 0 (1) = , then 6 3 e , 6 C1 e + C2 e = and C1 e + C2 e + C2 e = 2e . 3 So we have 1 C1 = − , 3 and C2 = 1 2 That is, we have 1 1 y(x) = − ex + xex − ex 3 2 Z 1 x πt tesin( 2 )−t dt + xex Z x πt esin( 2 )−t dt, ∀x ≥ 1. 1 In summary, the solution to y 00 − 2y 0 + y = f (x), y(0) = 0 and y 0 (0) = 0 is: 1 x3 ex , if 0 ≤ x ≤ 1, 6 Z x Z x y(x) = πt πt 1 1 − ex + xex − ex esin( 2 )−t dt, if x ≥ 1. tesin( 2 )−t dt + xex 3 2 1 1 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