Lecture 2 - Solving differential equations dy = ay − b dt In this lecture, we learn to obtain an exact solution for the problems we analyzed in the last lecture using direction fields. Remember the three main problems we were working on: 2 Problem 1: (Ball dropped off the cliff.) dv = 9.8 − v(t)/5 m/s dt dp = 0.5p(t) − 450 mice/month Problem 2: (Mice and owls.) dt Problem 3: (Amount of chemical in the pond.) dc = 3 − 3/10, 000c(t) g/gal dt Notice that all three differential equations have the same general form. dy General form: = ay − b (a and b constant) dt The key to solving differential equations of this form will be the substitution rule of integration. The substitution rule allows us to transform a function to be integrated into a simpler function through the use of an appropriate substitution. It is a very common mathematical technique to use some kind of substitution to transform a mathematical expression into a simpler one. We will encounter it several times in this course. Let us briefly review the substitution rule. R 2x + 2 dx. Example: Find x2 + 2x + 2 is that the numerator is precisely the derivative of the The key feature of the expression 2x x2 + 2x denominator. Vaguely speaking when an expression can be “split” into two parts where one is the derivative of the other (modulo a constant), it is a candidate for the substitution rule. Using this feature, we make a substitution as follows: We let u(x) = x2 + 2x. Therefore du = 2x + 2. dx du R 2x + 2 R dx We substitute: dx = u dx. x2 + 2x du R dx R du 1 R 1 We simplify: u dx = dx u dx = u du. R (Notice that the simplification step is NOT a legal mathematical operation! In the expression f (x) dx, the part f (x)dx is NOT a product of f (x) and dx. In fact, dx is not even a quantity! The expression is simply a fancy mathematical shorthand for saying “the antiderivative of f (x)”. Similarly du is NOT a dx fraction, it is a shorthand for saying “the derivative of u(x)”. The substitution rule states precisely that this FAKE simplification is allowed because miraculously the results turn out to be equal. The “miracle” is due to the cleverness of the 17th German mathematician Gottfried Leibniz who chose the notation so well that it allows for these kinds of cool tricks to be performed with it!) R 2x + 2 R 1 We started out with the integral du. dx and after the substitution ended up with the integral u 2 x + 2x What have we achieved? A much simpler integral! R 1 u du = ln |u| + C We substitute back u(x) = x2 + 2x: ln |x2 + 2x| + C R cos(x) Example: Find dx. 2 sin(x) + 3 cos(x) In the expression , the numerator is the derivative of the denominator modulo a constant. 2 sin(x) + 3 We let u(x) = 2 sin(x) + 3. Therefore du = 2 cos(x). dx The denominator will be replaced by u. To replace the numerator, we need to solve for cos(x): cos(x) = 21 du dx 1 du R R 2 dx cos(x) We substitute: dx = u dx 2 sin(x) + 3 1 2 1 du R 2 dx 1R 1 1 We simplify: u dx = 2 u du = 2 ln |u| + C We substitute back u(x) = 2 sin(x) + 3: 1 2 ln |2 sin(x) + 3| + C We are now ready to solve the differential equations we encountered in the previous lecture. 2 Problem 1: The acceleration of a ball dropped off a cliff is given by a(t) = 9.8 − v(t)/5 m/s . Find v(t). Solution: a(t) = dv = 9.8 − v(t)/5 dt Is there an initial condition hidden in the statement of the problem? Yes! To drop an object means to hold it and then let it go. No initial velocity is given to the object by the process of “dropping” (as opposed to pushing it down forcefully!). Therefore v(0) = 0. Step 1: Rewrite the equation in the form y 0 = ay − b. dv = −v(t)/5 + 9.8 dt Step 2: Factor out a. dv = −1/5(v(t) − 49) dt Step 3: Divide both sides by contents of the parenthesis (v(t) − 49). dv dt = −1 5 v(t) − 49 Note that this step is only legal as long as v(t) 6= 49. Otherwise you are performing a division by 0! Now comes the key step! Step 4: Integrate both sides! dv R R dt dt = − 15 dt v(t) − 49 The right side is easy: R 1 − 5 dt = − 1 5t + C The left side looks very hard because we do not know what v(t) is. But we do not need to know! We simply use the substitution rule. We let u(t) = v(t) − 49. Therefore du = dv . dt dt dv du R R dt dt We substitute: dt = u dt v(t) − 49 du R 1 R dt We simplify: u dt = u du = ln |u| + D We substitute back u(t) = v(t) − 49: ln |v(t) − 49| + D Notice that we used D instead of C for the constant because C is already taken for the right side and the two constants should be different. So ln |v(t) − 49| + D = − 51 t + C. 1 ln |v(t) − 49| = − t + E 5 (E = C − D is just another constant!) Step 5: Solve for v(t) by applying the fact that ex and ln(x) are inverse functions: 1 eln |v(t)−49| = e− 5 t+E 1 1 1 e− 5 t+E = e− 5 t eE = eE e− 5 t . We call F = eE since this is just another constant. 1 |v(t) − 49| = F e− 5 t 3 − 15 t v(t) − 49 = ±F e Either F or −F is just a constant as well, so can replace ±F by G. 1 v(t) − 49 = Ge− 5 t The final expression is: 1 v(t) = Ge− 5 t + 49 m/s The expression above represents a family of solutions (infinitely many solutions all given by the same expression modulo an unknown constant) for the differential equation! The different values of G correspond to different solutions and can be determined once the initial condition is specified. Remember that we had to exclude the possibility that v(t) = 49 in order not to be dividing by 0. But we know from the previous lecture that v(t) = 49 is a solution to the differential equation. In fact, this is a very important solution: the equilibrium solution. Should this solution be added to the family of solutions we just found? No, it gets included automatically! If G = 0, v(t) = 49. Whenever we think we have found a solution to a differential equation, we can always check whether our answer is correct by finding the derivative and matching it with the derivative expression we started with. Check: 1 v(t) = Ge− 5 t + 49 ? dv = 9.8 − v(t)/5 dt 1 Left side: dv = − 15 Ge− 5 t dt 1 1 51 t 1 15 t 5t Right side: 9.8 − v(t)/5 = 9.8 − 1 5 (Ge + 49) = 9.8 − 5 Ge − 9.8 = − 5 Ge The check confirms that our solution is correct! Finally, we use the initial condition v(0) = 0 to find G! v(0) = Ge0 + 49 = 0 G = −49 1 v(t) = −49e− 5 t + 49 Problem 2: In the absence of predators, the mouse population increases at the rate proportional to the current population p(t). dp = rp(t) mice/month dt Experimentally it is determined that r is 0.5 1/month. dp = 0.5p(t) mice/month dt Several owls live in the neighborhood and they eat on average 15 mice a day. dp = 0.5p(t) − 450 dt Determine how the initial population p(0) = p0 affects the mouse population in the long run. Solution: dp = 0.5p(t) − 450 dt Step 1: Rewrite the equation in the form y 0 = ay − b. Done! Step 2: Factor out a. dp = 0.5(p(t) − 900) dt Step 3: Divide both sides by contents of the parenthesis (p(t) − 900). dp dt = 0.5 p(t) − 900 As before, this step is only legal as long as p(t) 6= 900. Step 4: Integrate both sides! 4 dp R dt dt = 0.5 dt p(t) − 900R Right side: 0.5 dt = 0.5t + C dp R dt Left side: dt = ln |p(t) − 900| + D p(t) − 900 (The steps are exactly the same as in the previous problem.) So ln |p(t) − 900| + D = 0.5t + C. ln |p(t) − 900| = 0.5t + E R Step 5: Solve for p(t). eln |p(t)−900| = e0.5t+E p(t) = Ge0.5t + 900 mice (The steps are exactly the same as in the previous problem.) As in the previous problem, we had to exclude the equilibrium solution p(t) = 900, but we recovered in the end (G = 0). Check: p(t) = Ge0.5t + 900 dp ? = 0.5p(t) − 450 dt dp = 0.5Ge0.5t Left side: dt Right side: 0.5p(t) − 450 = 0.5(Ge0.5t + 900) − 450 = 0.5Ge0.5t + 450 − 450 = Ge0.5t The check confirms that our solution is correct! Finally, we use the initial condition p(0) = p0 to find G! p(0) = Ge0 + 900 = p0 G = p0 − 900 p(t) = (p0 − 900)e0.5t + 900 We can use this equation to determine how different values of p0 affect the population of mice in the long run (t → ∞). limt→∞ (p0 − 900)e0.5t + 900 =? The limit depends on the value of p0 − 900: p0 − 900 > 0: the limit is ∞. p0 − 900 < 0: the limit is −∞. p0 − 900 = 0: the limit is 900. Therefore: p0 > 900: the mouse population grows out of control! p0 < 900: the mouse population dies out! p0 = 900: the mouse population stays constant! This matches exactly the information we obtained from the direction field. Problem 3: A pond initially contains 1,000,000 gal of water and some amount of an undesirable chemical. Water containing 0.01 g of this chemical per gallon flows into the pond at a rate of 300 gal/h. The mixture flows out at the same rate, so the amount of water in the pond remains constant. Assume that the chemical is uniformly distributed throughout the pond. a) Write a differential equation for the amount of chemical in the pond at any time. b) How much of the chemical will be in the pond after a very long time? Solution: a) If c(t) is amount (in grams) of the chemical in the pond at time t, then the differential equation for c(t) is: dc = 3 − 3/10, 000c(t). dt b) Step 1: Rewrite the equation in the form y 0 = ay − b. 5 dc = −3/10, 000c(t) + 3 dt Step 2: Factor out a. dc = −3/10, 000(c(t) − 10, 000) dt Step 3: Divide both sides by contents of the parenthesis (c(t) − 10, 000). dc dt = −3/10, 000 c(t) − 10, 000 As before, this step is only legal as long as c(t) 6= 10, 000. Step 4: Integrate both sides! dc R R dt dt = −3/10, 000 dt c(t) − 10, R000 Right side: −3/10, 000 dt = −3/10, 000t + C dc R dt Left side: dt = ln |c(t) − 10, 000| + D c(t) − 10, 000 (The steps are exactly the same as in the previous problem.) So ln |c(t) − 10, 000| + D = −3/10, 000t + C. ln |c(t) − 10, 000| = −3/10, 000t + E Step 5: Solve for c(t). eln |c(t)−10,000| = e−3/10,000t+E c(t) = Ge−3/10,000t + 10, 000 grams (The steps are exactly the same as in the previous problem.) As in the previous problem, we had to exclude the equilibrium solution c(t) = 10, 000, but we recovered in the end (G = 0). There is no initial condition given in this problem, so we cannot solve for G. limt→∞ Ge−3/10,000t + 10, 000 = 10, 000 Notice that unlike the problem with mice and owls the long term behavior does not depend on the initial condition! General formula: dy Problem: = ay − b dt Solution: dy = a(y − b/a) dt dy dt =a y − b/a dy R dt dt = R a dt y − b/a R Left side: a dt = at + C dy R dt dt = ln |y − b/a| + D Right side: y − b/a So ln |y − b/a| + D = at + C. ln |y − b/a| = at + E eln |y−b/a| = eat+E y = Geat + b/a