LECTURE 5: LINEAR EQUATIONS AND THE INTEGRATING FACTOR MINGFENG ZHAO September 12, 2014 2 2 Example 1. Solve y 0 = x2 ex − y 2 ex + 1, y(1) = 1. Rewrite the equations: 2 y 0 = (x2 − y 2 )ex + 1, 2 y(1) = 1. 2 2 2 It’s easy to see that y(x) = x is a solution to y 0 = x2 ex − y 2 ex + 1, y(1) = 1. Let f (x, y) = x2 ex − y 2 ex + 1, then • f is continuous near (1, 1). 2 ∂f (x, y) = −2yex is also continuous near (1, 1). • ∂y 2 2 By Picard’s Theorem on Existence and Uniqueness, then the only solution to y 0 = x2 ex − y 2 ex + 1, y(1) = 1 is: y(x) = x . Recall that 1) y(x) ≡ a for some constant a such that g(a) = 0 0 Z Z y = f (x)g(y) =⇒ . 1 dy = f (x) dx. 2) g(y) Example 2 (Newton’s Law of Cooling). Bob made a cup of coffee, and Bob likes to drink coffee only once it will not burn him at 60 degrees. Initially at time t = 0 minutes, Bob measured the temperature and the coffee was 89 degrees Celsius. One minute later, Bob measured the coffee again and it had 85 degrees. The temperature of the room (the ambient temperature) is 22 degrees. When should Bob start drinking? Newton’s Law of Cooling: The rate of changing of the temperature of the object is proportional to the difference between the ambient temperature and the temperature of the object. That is, The rate of changing of the temperature of the object = constant. The ambient temperature − The temperature of the object 1 2 MINGFENG ZHAO Let T (t) be the temperature, A(t) be the ambient temperature, where t is time in minute, then T 0 (t) = k[A(t) − T (t)], for some constant k. By the assumption, A = 22, then we have T 0 = k(22 − T ), T (0) = 89 and T (1) = 85. Since the temperatures are changing, then k 6= 0. First, let’s find the general solution to T 0 = k(22 − T ): 1) T (t) ≡ 22 is a solution. (In our initial value problem, we can ignore this case, because the temperature T (t) is changing.) 2) If T 6= 22, then Z t= 1 1 dT = − k(22 − T ) k Z 1 1 dT = − ln |T − 22| + C. T − 22 k So |T − 22| = −k(t − C) =⇒ T = 22 ± ekC · e−kt . In summary, the general solution of T 0 = k(22 − T ) is T (t) = 22 + Ce−kt . Since T (0) = 89 and T (1) = 85, that is, T (0) = 22 + C = 89 So C = 89 − 22 = 67 and e−k = and T (1) = 22 + Ce−k = 85. 85 − 22 63 63 63 = = , then k = − ln > 0. Hence C 67 67 67 63 T (t) = 22 + 67et ln 67 . 63 63 Let’s solve 60 = T (t) = 22 + 67et ln 67 , we get et ln 67 = t= 60 − 22 38 = . Hence 67 67 ln 38 67 ≈ 9.212 . ln 63 67 Remark 1. In general, the ambient temperature A(t) is a function of t, in the following, we will study how to solve T 0 (t) = k[A(t) − T (t)]. LECTURE 5: LINEAR EQUATIONS AND THE INTEGRATING FACTOR Figure 1. Temperature decreases in 90 minutes INTEGRATING FACTOR METHOD Let’s consider y 0 + p(x)y = f (x). Both sides multiply some function r(x) , we get r(x)y 0 (x) + r(x)p(x)y(x) = r(x)f (x). For the right hand side, if we can find some r(x) (which is called an integrating factor) such that r(x)y 0 (x) + r(x)p(x)y(x) = d [r(x)y(x)]. dx If we can find such r(x), let v(x) = r(x)y(x), then v 0 = r(x)f (x). So Z r(x)y(x) = v = r(x)f (x) dx. Hence 1 y(x) = · r(x) Z r(x)f (x) dx. Question 1. Can we find a r(x) such that r(x)y 0 (x) + r(x)p(x)y(x) = d [r(x)y(x)]? dx 3 4 MINGFENG ZHAO By the product rule, we get r(x)y 0 (x) + r(x)p(x)y(x) = r0 (x)y(x) + r(x)y 0 (x). So r(x)p(x)y(x) = r0 y(x), that is, r0 (x) = p(x)r(x). Then Z So ln |r| = R p(x) dx, that is, r(x) = e R p(x) dx 1 dr = r Z p(x) dx. R p(x) dx . Hence, r(x) = e r(x)y 0 (x) + r(x)p(x)y(x) = satisfies our need, that is, d [r(x)y(x)]. dx Therefore, 0 y + p(x)y = f (x) =⇒ y = e − R p(x) dx Z e R p(x) dx f (x) dx. For the initial value problem: y 0 + p(x)y = f (x), Rx We can take r(x) = e x0 p(t) dt y(x0 ) = y0 . , then y=e − Rx x0 p(t) dt Z x e − Rt x0 p(s) ds f (t) dt + y0 . x0 In summary, I. y 0 + p(x)y = f (x) =⇒ r(x) = e R p(x) dx , y = e− y 0 + p(x)y = f (x) Rx p(t) II. =⇒ r(x) = e x0 y(x ) = y 0 dt R p(x) dx , y=e − Rx x0 Z R e p(t) dt R p(x) dx Z f (x) dx x Rt e x0 p(s) ds f (t) dt + y0 x0 0 Remark 2. In the formula I, r(x) = e p(x) dx . But in the formula II, we must take r(x) = e Rx x0 Example 3. Recall that the Newton’s law of cooling gives the following differential equation: T 0 = k[A(t) − T ]. That is, T 0 + kT = kA(t). Take p(t) = k and f (t) = kA(t), then r(t) = e R p(t) dt = ekt . p(t) dt in order to use it. LECTURE 5: LINEAR EQUATIONS AND THE INTEGRATING FACTOR 5 So T (t) = ke −kt Z A(t)ekt dt . 2 Example 4. Solve y 0 + 2xy = ex−x , y(0) = −1. 2 Take p(x) = 2x and f (x) = ex−x , then Rx r(x) = e p(t) dt 0 =e Rx 0 2t dt 2 = ex . So 2 = e−x y Z x 2 2 et · et−t dt − 1 0 = e −x2 Z x t e dt − 1 0 2 = e−x [ex − 2] 2 2 = ex−x − 2e−x . So 2 2 2 y = ex−x − 2e−x is the solution to y 0 + 2xy = ex−x , y(0) = −1 . Example 5 (Mixing Model). A 100 liter tank contains 10 kilograms of salt dissolved in 60 liters of water. Solution of water and salt with concentration of 0.1 kg/L is flowing in at rate of 5 L/min. The solution in the tank is well stirred and flows out at a rate of 3 L/min. How much salt is in the tank when the tank if full? Let y(t) be the amount of the salt in the tank at time t minutes (starting t = 0), then y(0) = 10. For any very tiny ∆t, then 6 MINGFENG ZHAO • there are 60 + (5 − 3)t = 60 + 2t liter water in the tank y(t) • the concentration of salt at time t is 60 + 2t • the rate of change of salt in the tank at time t is y 0 (t) • the rate of salt flowing into the tank at time t is 0.1 × 5 = 0.5 y(t) 3y • the rate salt flowing out the tank at time t is ×3= . 60 + 2t 60 + 2t At time t, we know that Rate of change of salt in the tank = Rate of salt flowing into the tank − Rate of salt flowing out the tank. Take ∆t & 0, we get y 0 = 0.5 − 3y . 60 + 2t So we have the following initial value problem: y0 + 3y = 0.5 60 + 2t y(0) = 10. Take p(t) = 3 and f (t) = 0.5, then 60 + 2t r(t) = e Rt 0 p(x) dx =e Rt 3 0 60+2x dx t = e 2 ln(x+30)|0 = e 2 ln(t+30)− 2 ln 30 = 30− 2 · (t + 30) 2 . 3 3 3 3 3 Then y(t) = 3 3 30− 2 · (t + 30)− 2 Z t 3 3 0.5 · 30− 2 · (x + 30) 2 dx + 10 0 " = = − 23 30 · (t + 30) 3 − 32 3 30− 2 · (t + 30)− 2 1 0.5 · 1+ 3 2 − 23 · 30 t · (x + 30) 5 2 # + 10 t=0 3 5 5 1 1 · 30− 2 · (t + 30) 2 − · 30 2 + 10 . 5 5 At time t, there are 60 + 2t liter water in the tank, since the volume of the tank is 1000, then after 20 minutes, the tank will be full. So 3 3 y(20) = 30− 2 · (20 + 30)− 2 3 5 3 5 1 1 · 30− 2 · (20 + 30) 2 − · 30− 2 · 30 2 + 10 ≈ 11.86. 5 5 Therefore, There are 11.86 liter salt in the tank when the tank is full. LECTURE 5: LINEAR EQUATIONS AND THE INTEGRATING FACTOR 7 Remark 3. Another way to get the differential equation in Example 5: Let y(t) be the amount of the salt in the tank at time t minutes (starting t = 0), then y(0) = 10 and • y(t + ∆t) be the amount of the salt in the tank at time t + ∆t • there are 60 + (5 − 3)t = 60 + 2t liter water in the tank y(t) • the concentration of salt at time t is 60 + 2t • during the period from time t to time t + ∆t, we know that – there are new 5∆t liter water coming to the tank – there are new 5∆t × 0.1 kilograms salt coming to the tank – there are 3∆t liter water going out of the tank y(t) – there are 3∆t × going out of the tank 60 + 2t So we have y(t + ∆t) = y(t) + 5∆t × 0.1 − 3∆t × 3y(t) y(t) = y(t) + 0.5∆t − · ∆t. 60 + 2t 60 + 2t That is, y(t + ∆t) − y(t) 3y(t) = 0.5 − ∆t 60 + 2t Take ∆t & 0, we get y 0 = 0.5 − 3y . 60 + 2t 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