FIRST-ORDER ORDINARY DIFFERENTIAL EQUATIONS III: Applications and More Analytic Methods David Levermore Department of Mathematics University of Maryland 19 February 2012 Because the presentation of this material in lecture will differ from that in the book, I felt that notes that closely follow the lecture presentation might be appreciated. Contents 8. First-Order Equations: Applications 8.1. 8.2. 8.3. 8.4. 8.5. General Guidelines Tanks and Mixtures Loans Motion Population Dynamics 2 2 5 6 9 9. Exact Differential Forms and Integrating Factors 9.1. Implicit General Solutions 9.2. Exact Differential Forms 9.3. Integrating Factors 12 13 17 10. Special First-Order Equations and Substitution 10.1. 10.2. 10.3. 10.4. Linear Argument Equations (not covered) Dilation Invariant Equations (not covered) Bernoulli Equations (not covered) Substitution (not covered) 1 21 22 23 24 2 8. First-Order Equations: Applications The subject of differential equations was invented along with calculus by Newton and Leibniz in order to solve problems in geometry and physics. It played a central role in the development of Newtonian physics by the Bernoulli family, Euler, and others. It rapidly found applications in biology, finance, and engineering. It now is applied in almost every discipline that has been quantified. You benefit from these applications every time you use your cell phone, drive your car, fly in an airplane, listen to a weather report, use the internet, take a modern medicine, or do many other daily activities. 8.1. General Guidelines. Mathematical problems that arise in applications are usually stated as word problems. The problems considered in this section will ask questions whose answers require analyzing an initial-value problem. These problems typically will not hand you an initial-value problem. Rather, you will have to contruct an initial-value problem from the information given in a word problem. In other words, you must transform a problem stated verbally into a problem that you can analyze by the methods we have been studying. Often this can be done more than one way. The more ways you see to approach a problem, the better you understand it. Here we address how to go about seeking ways to approach these problems. There is no set of magic steps by which you can approach every word problem. Rather, you should be ready to consider several possible approaches when you are faced with one. To guide your efforts, it is helpful to keep in mind the following three objectives. (1) Identify the variables in the problem and the relationships between them. An appropriately labeled picture is often helpful in this regard. You should note carefully any relations between or constraints on the variables you have introduced. You should be prepared to rethink your choice of variables to help achieve the next objective. (2) Reduce the problem analyzing a an initial-value problem. You should used relations between the various variables to reduce the number of parameters in the differential equation as much as possible. These relations may or may not be stated explicitly in the problem. Similarly, constraints may or may not be stated explicitly in the problem (like the fact that populations should not be negative). (3) Solve the resulting problem. You should pick the method to suit the problem. What method is best will depend on the question being asked. Sometimes a graphical method will be the fastest route to the solution. A numerical method might be best when analytical and graphical methods prove to be difficult. These are the so-called IRS guidelines, which apply to many kinds of word problems: Identify the problem; Reduce the problem to one you can analyze; Solve the reduced problem. The remainder of this section will illustrate how these guidelines can help you approach word problems in the context of several applications. 8.2. Tanks and Mixtures. These represent a broad class of problems in which one asks a question about the transport of some quantity into and out of a tank or some other volume. The quantity might be a fluid like water, oil, or air, or it might be something carried by a fluid like a polutant or solute. The tank might be any well-defined volume like a pond, lake, or room in a building. These problems generalize to ones involving networks of interconnected tanks, which lie at the heart of many numerical simulations of fluids. 3 In the following problems we will construct an initial-value problem for the amount Q of some quantity in the tank. The associated ordinary differential equation will have the form dQ = RATE IN − RATE OUT , dt where RATE IN is the rate the quantity enters the tank while RATE OUT is the rate the quantity exits the tank. Sometimes RATE IN and RATE OUT will be given explicitly in the problem. At other times they will be given in terms of other varibles in the problem. Example. A tank initially contains 200 liters of brine (salt solution) with a salt concentration of 5 grams per liter. At some instant brine with a salt concentration of .4 grams per liter begins to flow into the tank at a rate of 3 liters per minute, while the well-stirred mixture flows out at the same rate. How long will it take for the salt concentration in the tank to be reduced to .7 grams per liter? Solution. Let V (t) be the volume (lit) of brine in the tank at time t minutes. Let S(t) be the mass (gr) of salt in the tank at time t minutes. Because the mixture is assumed to be well-stirred, the salt concentration of the brine in the tank at time t is therefore C(t) = S(t)/V (t). In particular, this will be the concentration of the brine that flows out of the tank. We have the following picture. inflow .4 gr/lit −→ 3 lit/min brine V (t) lit salt S(t) gr outflow −→ C(t) gr/lit 3 lit/min V (0) = 200 lit, C(0) = 5 gr/lit. We want to find the time T at which C(T ) = .7. Because brine flows in and out of the tank at the same rate, we see that V (t) = V (0) = 200. Hence, C(t) = S(t)/200. Therefore S(t) satisfies dS S 3 = RATE IN − RATE OUT = .4 · 3 − · 3 = 1.2 − 200 S. dt 200 Because S(0) = 200C(0) = 200 · 5 = 1000, the initial-value problem that governs S(t) is dS = 1.2 − .015S , S(0) = 1000 . dt We want to find T such that S(T ) = 200C(T ) = 200 · .7 = 140. This is a nonhomogeneous linear differential equation with normal form dS + .015S = 1.2 . dt Its integrating factor form is d .015t e S = 1.2e.015t . dt Upon integrating this equation while using the initial condition S(0) = 1000 we obtain 1.2 e.015t − 1 = 80 e.015t − 1 , e.015t S − 1000 = .015 whereby S(t) = 920e−.015t + 80 . 4 By setting S(T ) = 140 we find that T satisfies 920e−.015T + 80 = 140 . By solving for T we obtain 1 200 920 46 T = = log log .015 60 3 3 minutes . Example. A tank with an open top has a base of 1 square meter and a height of 2 meters. The tank is initially empty when water begins to pour into it at a rate of 7 liters per√minute. The water also drains from the tank through a hole in its bottom at at rate of 5 h liters per minute where h is the height of the water in the tank in meters. Will the tank overflow? If not, how high will it fill? If so, how long does it take to happen? Solution. Let V (t) be the volume (lit) of water in the tank at time t minutes. We have the following picture. height 2 m inflow −→ 7 lit/min outflow −→ p 5 h(t) lit/min water height h(t) m water volume V (t) lit base area 1 m2 V (0) = 0 lit. It is clear that h(t) is an increasing function. We want to determine if h(T ) = 2 for some T . If not, we want to determine the value h(t) approaches as t → ∞. Because 1 m3 = 1000 lit, V (t) = 1000 · 1 · h(t). Because V (t) satisfies √ dV = RATE IN − RATE OUT = 7 − 5 h , dt the initial-value problem that governs h(t) is 1000 √ dh = 7 − 5 h, dt h(0) = 0 . We want to determine if h(T ) = 2 for some T . If not, we want to determine the value h(t) approaches as t → ∞. This equation is autonomous. It has one stationary point at h = 49 . 25 Its phase portrait is + − →→→→→→ • ←←←←←← h 49 25 49 This portrait shows that if h(0) = 0 then h(t) → 49 as t → ∞. Because 25 = 1.96 < 2, the 25 tank does not overflow. Rather, the water approaches a height of 1.96 meters as t → ∞. 5 8.3. Loans. A loan problem can be viewed as a tank problem where the loan balance is being drained away by the borrower. To keep things simple, we consider fixed-rate loans with continuously compounded interest and with continuous payments by the borrower at a constant rate. The term of the loan is the time period over which the loan is paid off. If we let B(t) be the balance of the loan at time t years then B(t) will satisfy dB = rB − P , dt where r is the per annum interest rate and P is the per annum payment rate. If the initial loan amount is known to be BI then we would imposed the initial condition B(0) = BI . However, if you are trying to find BI or P , given r and the term T of the loan in years then you would impose the initial condition B(T ) = 0. Example. A car buyer has 4000$ for a down payment and can afford to make continuous payments for a loan at a constant rate of no more than 250$ per month. If five-year fixed-rate loans are available at an interest rate of 5% per year compounded continuously, what is the price of the most expensive car that the buyer can afford? Solution. Let B(t) be the balance of the loan at time t years. Because 1 year = 12 months, we see P = 12 · 250 = 3000 $/yr. Because 1 = 100%, we see r = 5/100 = .05 1/yr. The term T = 5 yr. We have the following picture. interest 5% per yr −→ (= .05 1/yr) balance B(t) $ payments −→ 250 $/mon (= 3000 $/yr) B(5) = 0 $ . The price of the most expensive car the buyer can afford will be 4000 + B(0) dollars. The initial-value problem satisfied by B(t) is dB = .05B − 3000 , B(5) = 0 . dt We want to find 4000 + B(0). This is a nonhomogeneous linear differential equation with normal form dB − .05B = −3000 . dt Its integrating factor form is d −.05t e B = −3000e−.05t . dt Upon integrating this equation while using the initial condition B(5) = 0 we obtain Z t 1 3000 −.05t −.05·5 − 20 t −.05t − 14 −.05s e −e = 60000 e . e B(t) = −3000 −e e ds = .05 5 By setting t = 0 above we find that the car buyer can afford a car costing at most 1 dollars . 4000 + 60000 1 − e− 4 This is about 17,272$, but you should leave the answer in the exact form above. 6 Example. A student borrows 6000$ at an interest rate of 6% compounded continuously. The student wants to pay off the loan in five years by making payments continuously at a constant rate of P dollars per year. What should P be? Solution. Let B(t) be the balance of the loan at time t years. Because 1 = 100%, we see r = 6/100 = .06 1/yr. The term T = 5 yr. We have the following picture. interest 6% per yr −→ (= .06 1/yr) balance B(t) $ −→ payments P $/yr B(0) = 6000 $ , B(5) = 0 $ . One of the last two conditions will determine P . The initial-value problem satisfied by B(t) is dB = .06B − P , B(5) = 0 . dt We want to find P such that B(0) = 6000. This is a nonhomogeneous linear differential equation with normal form dB − .06B = −P . dt Its integrating factor form is d −.06t e B = −P e−.06t . dt Upon integrating this equation while using the initial condition B(5) = 0 we obtain Z t 3 3 P 50P − 3 t −.06t −.06·5 − 50 −.06t s − 10 50 e −e = −P e e e B(t) = ds = −e . .06 3 5 3 (1 − e− 10 ). Then B(0) = 6000 implies that the By setting t = 0 we see that B(0) = 50 3 student has to pay off the loan at a rate of 6000 360 P = 50 = dollars per year . 3 3 − 10 − 10 (1 − e ) 1 − e 3 This is about 1,389$ per year, but you should leave your answer in the exact form above. 8.4. Motion. A falling object with fixed mass m is governed by the Newton law of motion ma = F , where a is its acceleration and F is the net force acting on it. The net force is the sum of the gravitational force and the drag force. If the object has a downward velocity v(t) then the Newton law of motion takes the form dv m = gravitational force + drag force = Fgrav + Fdrag . dt For objects near the surface of the Earth that fall distances that are short compared to the radias of the Earth, we can approximate the gravitaional force Fgrav as the constant mg where g is the so-called gravitaional acceleration given by g = 9.8 m/sec2 . The drag force Fdrag is harder to approximate. It acts in the direction opposite to that of the velocity. If the object is going up then the drag force acts downward while if the object is going down the drag force acts upward. One simple model sets Fdrag = −ρair A|v|v where ρair is the density of the air and A is the aerodynamic cross-section, which has units of area. 7 The value of ρair varies significantly with temperature, pressure, and humidity; for dry air at 20 o C and one atmosphere pressure ρair is about 1.2 kg/m3 . The value of A depends upon the shape of the object, the air density, and the velocity v in an extremely complicated way. When the speed of the falling object is far below the speed of sound then the dominant dependence is on the shape of the object. If values for ρair and A are needed for a problem then they will be given to you. The resulting equation of motion is a first-order differential of the form dv ρair A = g − k|v|v , where k = > 0. dt m This equation is autonomus. Its right-hand side is differentiable with respect to v because ∂v (|v|v) = 2|v|, so that Theorem 4.1 applies to it. Its only stationary solution is r g (8.2) v∞ = . k (8.1) Its phase-plane portrait is + − →→→→→→ • ←←←←←← v v∞ This portrait shows that the stationary point v∞ is attracting, and that v(t) → v∞ as t → ∞ for every nonstationary solution. The velocity v∞ is called the terminal velocity because it is the velocity being approached by the falling object until it hits the ground. 1 Remark. The terminal velocity depends upon the aerodynamic cross-section A as A− 2 . Skydivers control the rate of their descent by changing their aerodynamic cross-section. They are close to terminal velocity after falling about ten seconds. They can reach speeds of 90 m/s in a bullet-like position or slow to about 50 m/s by spreading their arms and legs. With a parachute deployed they slow to 3-4 m/s, depending on the design of the parachute. Example. A skydiver of mass 60 kg jumps from an airplane and assumes a position with an aerodynamic cross-section of 0.1 m2 in air with a density of 1.2 kg/m3 . What is her terminal velocity? What fraction of her terminal velocity does she reach after 10 s? How far has she fallen after 10 s? Solution. Let v(t) be her downward velocity at t seconds. Because she is always falling during the ten seconds, we know that v(t) ≥ 0 and have the following picture. gravitational acceleration −→ = 9.8 m/s2 downward velocity v(t) drag −→ acceleration = −kv 2 We first seek v∞ and v(10)/v∞ , where v∞ is her terminal velocity. The initial-value problem satisfied by v(t) is dv = g − kv 2 , dt v(0) = 0 , where g = 9.8 m/s2 and k= ρair A 1.2 · 0.1 1 = = = .002 1/m . m 60 500 v(0) = 0 . 8 Her terminal velocity is therefore r √ g √ = 9.8 · 500 = 4900 = 70 m/s . v∞ = k The next step is to compute v(t). The inital-value problem can be expressed as dv 2 = k v∞ − v2 , v(0) = 0 , dt where k = .002 and v∞ = 70. This differntial equation is autonomous, so an implicit solution can be found by using a partial fraction decomposition as 1 1 Z Z Z 1 1 2v∞ 2v∞ kt = dv = dv = + dv 2 − v2 v∞ (v∞ + v)(v∞ − v) v∞ + v v∞ − v 1 1 v∞ + v 1 log(v∞ + v) − log(v∞ − v) + c = log +c. = 2v∞ 2v∞ 2v∞ v∞ − v Here we do not need absolute values inside the log because we know from the phase-line portrait that v(t) will increase from 0 to the terminal velocity v∞ . The initial condition v(0) = 0 implies that 1 v∞ + 0 1 +c= log log(1) + c = 0 + c , k·0= 2v∞ v∞ − 0 2v∞ whereby c = 0. By exponentiating the implicit solution we find that v∞ + v , e2v∞ kt = v∞ − v which can be solved for v to obtain the explicit solution e2v∞ kt − 1 e.28t − 1 = 70 . e2v∞ kt + 1 e.28t + 1 Therefore the fraction of her terminal velocity reached after ten seconds is v(t) = v∞ v(10) e2.8 − 1 = 2.8 . 70 e +1 This is about .88535 of her terminal velocity, but you should leave your answer in the exact form given above. If we let y(t) be distance she has fallen after t seconds then Z 10 Z 10 Z 10 2e.28t e.28t − 1 dt = 70 − 1 dt y(10) = v(t) dt = 70 .28t e +1 e.28t + 1 0 0 0 10 2.8 2 1 e +1 .28t = 70 − 10 log(e + 1) − t = 70 log .28 .14 2 0 2.8 e +1 − 700 . = 500 log 2 This is about 383 meters, but you should leave your answer in the exact form given above. 9 8.5. Population Dynamics. We now consider models of population dynamics governed by first-order equations of the form dp = R(p)p − h(t) . dt where p(t) is the size of the population as a function of time, R(p) models the growth rate of the population as a function of p, and h(t) is a harvest rate due to predators. For a population in a closed ecosystem (with h(t) = 0) the growth rate is simply the birth rate minus the mortality rate. In more complicated situations the growth rate must also account for mirgation in to and out of the ecosystem. The harvest rate can model the catch in fish populations, the hunting limit in deer populations, or the introduction of any other predator that will reduce the population at a rate that is independent of the size of the population. Obviously such a harvest model will break down if the population is reduced too much. The simplest such models take h(t) = 0 and R(p) = r for some constant r. This is the so-called exponential model because it has the solution p(t) = pI ert when p(0) = pI . This solution grows exponentially when r > 0 and decays exponentially when r < 0. Sometimes you will have to figure out the value of r from other information in the problem. For example, if you are told that a population triples every five years then you are being told that p(t + 5) = 3p(t). Then you can figure out r by setting 3= p(t + 5) pI er(t+5) = = er5 , rt p(t) pI e whereby the growth rate is r = 15 log(3) per year. Alternatively, if you are told that a 1 population triples every five years then you are being told that p(t) = pI 3 5 t . Because 1 1 3 5 t = e 5 log(3)t , you can read off that the growth rate is r = 15 log(3) per year. If a harvest h(t) > 0 is introduced into an exponential model then it takes the form dp = rp − h(t) . dt This is a nonhomogeneous linear equation that we know how to solve. Eaxmple. In the absence of predators the population of mosquitoes in a certain area would increase at a rate proportional to its current population and its population would double every three weeks. There are 250,000 mosquitoes in the area initially when a flock of birds arrives that eats 80,000 mosquitoes per week. How many mosquitoes remain after two weeks? Solution. Let M(t) be the number of mosquitoes at time t weeks. Doubling every three 1 1 weeks means the population grows like 2 3 t = e 3 log(2)t , which implies a growth rate of 31 log(2) per mosquito. The rate at which the mosquitoes reproduce is thereby 31 log(2)M(t) while the rate at which they are eaten is 80,000. The initial-value problem that M satisfies is therefore dM = 13 log(2)M − 80, 000 , M(0) = 250, 000 . dt We are asked to find M(2). This is a nonhomogeneous linear differential equation with normal form dM − 13 log(2)M = −80, 000 . dt 10 Its integrating factor form is 1 d − 1 log(2)t M = −80, 000e− 3 log(2)t . e 3 dt Upon integrating this equation while using the initial condition M(0) = 250, 000 we obtain Z t 80, 000 − 1 log(2)t − 13 log(2)t − 31 log(2)s 3 e e M(t) − 250, 000 = −80, 000 ds = 1 −1 . e log(2) 0 3 Hence, we find that 1 80, 000 80, 000 + 250, 000 − 1 e 3 log(2)t M(t) = 1 log(2) log(2) 3 3 1 240, 000 240, 000 = 23t . + 250, 000 − log(2) log(2) Therefore after two weeks there are 1 240, 000 240, 000 43 + 250, 000 − M(2) = log(2) log(2) mosquitoes . This is about 193,500 mosquitoes, but you should leave the answer in the exact form above. It would be nice if the birds stuck around for several more weeks. The ability of a individual to survive and reproduce depends upon the environment experienced by that individual. The assumption in the exponential model that R(p) is constant assumes that this environment is uneffected by the number of individuals present. However once the population grows large enough there might be competition between its individuals for resources, which should reduce the growth rate. The simplest model that captures this effect takes R(p) to be a linear function of p, R(p) = r − ap , for some positive constants a and r . When there is no harvesting then the model becomes dp = (r − ap)p . dt This is called the logistic model. The logistic model is autonomous and so can be solved analytically. However, there are many questions you can addressed with a phase-line portrait. The stationary points of the equation are p = 0 and p = ar . The phase-line portriat is as follows. − + − ←←←←←← • →→→→→→ • ←←←←←← h r 0 a This portriat shows that if p(t) is any solution with p(0) > 0 then p(t) → ar as t → ∞. In other words, the stationary point ar is attracting (asymptotically stable). This stationary point is called the carrying capacity of the ecosystem. It is the size of the population that the ecosystem naturally supports. Notice that any solution with 0 < p(0) < k has the interval of definition (−∞, ∞), while we expect that any solution with k < p(0) an interval of definition of the form (tL , ∞) for some tL < 0. 11 If we let k = r/a denote the carrying capacity of the ecosystem then the logistic model can be expressed as dp p p. =r 1− dt k Its stationary solutions are p = 0 and p = k. Its nonstationary solutions can be found by our recipe for autonomous equations. The phase-line portrait showed that solutions cannot cross the stationary point at p = 0, so solutions that are initially positive will remain positive. Such a solution is governed implicitly by Z Z Z k 1 1 1 rt = dp = + dp p dp = (k − p) p p k−p p 1− k p +c. = log(p) − log(|k − p|) + c = log |k − p| Here we do not need absolute values on p because we are considering positive solutions. If we impose the initial condition p(0) = pI > 0 then we find that pI 0 = log +c, |k − pI | so that c = − log(pI /|k − pI |). The implicit solution then becomes pI p (k − pI ) p − log = log , rt = log |k − p| |k − pI | pI (k − p) where we have dropped the absolute values because we know from the phase-line portrait that k − p and k − pI will have the same sign. This can be exponentiated to find p (k − pI ) ert = , pI (k − p) whereby pI (k − p) ert = p (k − pI ), which can be solved to obtain the explicit solution k ert pI . k + (ert − 1)pI Notice that if 0 < pI < k then the interval of definition is (−∞, ∞) while if k < pI then the interval of definition is (log(1 − k/pI )/r, ∞). This is consistent with what we expected from our earlier analysis of the phase-line portrait. Remark. The logistic model is the simplest model for which the growth rate R(p) is a decreasing function of p. However, as populations get smaller their growth rate might also decline. This can be due to the fact that a smaller herd might offer easier prey to predators, or that individuals in a more dispersed population might have a harder time finding mates. The simplest model that also captures this effect takes R(p) to be a quadratic function of p, p(t) = R(p) = r + bp − ap2 , for some constants r, b and a with a > 0 . When there is no harvesting then the model becomes dp = r + bp − ap2 p . dt Provided R(p) is positive for some p > 0 then this equation has one positive stationary point when r ≥ 0 and two positive stationary points when r < 0. 12 9. Exact Differential Forms and Integrating Factors 9.1. Implicit General Solutions. Consider a first-order ordinary equation in the form dy = f (x, y) , dx where f (x, y) is continuously differentiable over a region R of the xy-plane. Our basic existence and uniqueness theorem then insures that for every point (xI , yI ) within the interior of R there exists a unique solution y = Y (x) of the differential equation (9.1) that satisfies the initial condition Y (xI ) = yI for so long as (x, Y (x)) remains within the interior of R. Let us ask the following question. When are the solutions of the differential equation (9.1) determined by an equation of the form (9.1) (9.2) H(x, y) = c where c is some constant ? This means that we seek a function H(x, y) defined over the interior of R such that the unique solution y = Y (x) of the differential equation (9.1) that satisfies the initial condition Y (xI ) = yI is also the unique solution y = Y (x) that satisfies (9.3) H(x, y) = H(xI , yI ) , Y (xI ) = yI . Such an H(x, y) is called an integral of (9.1). Because every solution of (9.1) that lies within the interior of R can be obtained in this way, we call relation (9.2) an implicit general solution of (9.1). The question can now be recast as “When does (9.1) have an integral?” This question is easily answered if we assume that all functions involved are as differentiable as we need. Suppose that an integral H(x, y) exists, and that y = Y (x) is a solution of differential equation (9.1). Then H(x, Y (x)) = H(xI , Y (xI )) , where xI is any point in the interval of definition of Y . By differentiating this equation with respect to x we find that ∂x H(x, Y (x)) + Y ′ (x) ∂y H(x, Y (x)) = 0 . Therefore, wherever ∂y H(x, Y (x)) 6= 0 we see that Y ′ (x) = − ∂x H(x, Y (x)) . ∂y H(x, Y (x)) For this to hold for every solution of (9.1), we must have ∂x H(x, y) dy =− , dx ∂y H(x, y) or equivalently (9.4) f (x, y) = − ∂x H(x, y) , ∂y H(x, y) wherever ∂y H(x, y) 6= 0. The question then arises as to whether we can find an H(x, y) such that (9.4) holds for any given f (x, y)? It turns out that this cannot always be done. In this section we explore how to seek such an H(x, y). 13 9.2. Exact Differential Forms. The starting point is to write equation (9.1) in a so-called differential form (9.5) M(x, y) dx + N(x, y) dy = 0 , where M(x, y) . N(x, y) There is not a unique way to do this. Just pick one that looks natural. If you are lucky then there will exist a function H(x, y) such that f (x, y) = − (9.6) ∂x H(x, y) = M(x, y) , ∂y H(x, y) = N(x, y) . When this is the case the differential form (9.5) is said to be exact. It turns out that there is a simple test you can apply to find out if you are lucky. It derives from the fact that “mixed partials commute” — namely, the fact that for any twice differentiable H(x, y) one has ∂y ∂x H(x, y) = ∂x ∂y H(x, y) . This fact implies that if (9.6) holds for some twice differentiable H(x, y) then M(x, y) and N(x, y) satisfy ∂y M(x, y) = ∂y ∂x H(x, y) = ∂x ∂y H(x, y) = ∂x N(x, y) . In other words, if the differential form (9.5) is exact then M(x, y) and N(x, y) satisfy (9.7) ∂y M(x, y) = ∂x N(x, y) . The remarkable fact is that the converse holds too. Namely, if the differential form (9.5) satisfies (9.7) for every (x, y) then it is exact — i.e. there exists an H(x, y) such that (9.6) holds. Moreover, the problem of finding H(x, y) is reduced to finding two primitives. We illustrate this fact with examples. Example. Solve the initial-value problem dy ex y + 2x + = 0, dx 2y + ex y(0) = 0 . Solution. Express this equation in the differential form (ex y + 2x) dx + (2y + ex ) dy = 0 . Because ∂y (ex y + 2x) = ex = ∂x (2y + ex ) = ex , this differential form satisfies (9.7) and is thereby exact. We can therefore find H(x, y) such that (9.8) ∂x H(x, y) = ex y + 2x , ∂y H(x, y) = 2y + ex . You can now integrate either equation, and plug the result into the other equation to obtain a second equation to integrate. If we first integrate the first equation in (9.8) then we find that Z H(x, y) = (ex y + 2x) dx = ex y + x2 + h(y) . 14 Here we are integrating with respect to x while treating y as a constant. The function h(y) is the “constant of integration”. We plug this expression for H(x, y) into the second equation in (9.8) to obtain ex + h′ (y) = ∂y H(x, y) = 2y + ex . This reduces to h′ (y) = 2y. Notice that this equation for h′ (y) only depends on y. Take h(y) = y 2 , so that H(x, y) = ex y + x2 + y 2 is an integral of the differential equation. An implicit general solution is therefore H(x, y) = ex y + x2 + y 2 = c . The initial condition y(0) = 0 implies that Therefore c = e0 · 0 + 02 + 02 = 0 . y 2 + ex y + x2 = 0 . The quadratic formula then yields √ e2x − 4x2 y= , 2 where the positive square root is taken so that solution satisfies the initial condition. This is a solution wherever e2x > 4x2 . Alternative Solution. If we first integrate the second equation in (9.8) then we find that Z H(x, y) = (2y + ex ) dy = y 2 + ex y + h(x) . −ex + Here we are integrating with respect to y while treating x as a constant. The function h(x) is the “constant of integration”. We plug this expression for H(x, y) into the first equation in (9.8) to obtain ex y + h′ (x) = ∂x H(x, y) = ex y + 2x . This reduces to h′ (x) = 2x. Notice that this equation for h′ (x) only depends on x. Taking h(x) = x2 , so H(x, y) = ex y + x2 + y 2 , we see that a general solution satisfies ex y + x2 + y 2 = c . Because this is the same relation for a general solution that we had found previously, the evaluation of c is done as before. The points to be made here are the following: • In principle you can integrate either equation in (9.7) first. • If you integrate with respect to x first then the “constant of integration” h(y) will depend on y and the equation for h′ (y) should only depend on y. • If you integrate with respect to y first then the “constant of integration” h(x) will depend on x and the equation for h′ (x) should only depend on x. • In either case, if your equation for h′ involves both x and y you have made a mistake! Sometimes the differential equation will be given to you already in differential form. In that case, use that form as the starting point. Example. Give an implicit general solution to the differential equation (xy 2 + y + ex ) dx + (x2 y + x) dy = 0 . 15 Solution. Because ∂y (xy 2 + y + ex ) = 2xy + 1 = ∂x (x2 y + x) = 2xy + 1 . this differential form satisfies (9.7) and is thereby exact. Therefore you can find H(x, y) such that ∂x H(x, y) = xy 2 + y + ex , ∂y H(x, y) = x2 y + x . By integrating the second equation you obtain Z H(x, y) = (x2 y + x) dy = 21 x2 y 2 + xy + h(x) . When you plug this expression for H(x, y) into the first equation you obtain xy 2 + y + h′ (x) = ∂x H(x, y) = xy 2 + y + ex , which yields h′ (x) = ex . (Notice that this only depends on x!) Take h(x) = ex , so that H(x, y) = 21 x2 y 2 + xyex . An implicit general solution is therefore 1 2 2 xy 2 + xy + ex = c . In the last example you could just as easily have integrated the equation for ∂x H(x, y) first and plugged the resulting expression into the equation for ∂y H(x, y). The next example shows that it can be helpful to first integrate whichever equation for H(x, y) is easier to integrate. Example. Give an implicit general solution to the differential equation x2 cos(x)ey + 2x sin(x)ey + ex cos(y) dx + x2 sin(x)ey − ex sin(y) dy = 0 . Solution. Because ∂y x2 cos(x)ey + 2x sin(x)ey + ex cos(y) = x2 cos(x)ey + 2x sin(x)ey − ex sin(y) , ∂x x2 sin(x)ey − ex sin(y) = x2 cos(x)ey + 2x sin(x)ey − ex sin(y) , this differential form satisfies (9.7) and is thereby exact. Therefore you can find H(x, y) such that ∂x H(x, y) = x2 cos(x)ey + 2x sin(x)ey + ex cos(y) , ∂y H(x, y) = x2 sin(x)ey − ex sin(y) . Now notice that it is more apparent how to integrate the bottom equation in y than how to integrate the top equation in x. (Recall that integrating terms like x2 cos(x) requires two integration-by-parts.) So integrating the bottom equation you obtain Z H(x, y) = x2 sin(x)ey − ex sin(y) dy = x2 sin(x)ey + ex cos(y) + h(x) . When you plug this expression for H(x, y) into the top equation you obtain x2 cos(x)ey +2x sin(x)ey +ex cos(y)+h′(x) = ∂x H(x, y) = x2 cos(x)ey +2x sin(x)ey +ex cos(y) , which yields h′ (x) = 0. Taking h(x) = 0, so that H(x, y) = x2 sin(x)ey + ex cos(y), you see that a general solution is given by x2 sin(x)ey + ex cos(y) = c . 16 Remark. Of course, had you seen that x2 cos(x) + 2x sin(x) is the derivative of x2 sin(x) then you could have just as easily started by integrating the ∂x H(x, y) equation with respect to x in the previous example. But such insights do not always arrive when you need them. We will now derive formulas for H(x, y) in terms of definite integrals. These formulas will encode the two steps given above. They thereby show that those steps can always be carried out. To see this, consider an exact differential form (9.9) M(x, y) dx + N(x, y) dy = 0 , where ∂y M(x, y) = ∂x N(x, y) . Now seek H(x, y) such that (9.10) ∂x H(x, y) = M(x, y) , ∂y H(x, y) = N(x, y) . By integrating the first equation with respect to x you obtain Z x H(x, y) = M(r, y) dr + h(y) , where xI is an arbitrary point . xI When you plug this expression for H(x, y) into the second equation and use the fact that ∂y M(r, y) = ∂r N(r, y), you obtain Z x N(x, y) = ∂y H(x, y) = ∂y M(r, y) dr + h′ (y) x Z Ix = ∂r N(r, y) dr + h′ (y) = N(x, y) − N(xI , y) + h′ (y) . xI This yields h′ (y) = N(xI , y), which only depends on y because xI is a number. Let Z y h(y) = N(xI , s) ds , where yI is an arbitrary value . yI The general solution of (9.8) thereby satisfies Z x Z H(x, y) = M(r, y) dr + xI y N(xI , s) ds = c . yI If you had integrated the second equation in (9.10) first then you would have found that general solution of (9.9) satisfies Z x Z y H(x, y) = M(r, yI ) dr + N(x, s) ds = c . xI yI The above formulas give two expressions for the same function H(x, y). Rather than memorize these formulas, I strongly recommend that you simply learn the steps underlying them. Remark. Our recipe for separable equations can be viewed as a special case of our recipe for exact differential forms. Consider the separable first-order ordinary differential equation dy = f (x)g(y) . dx It can be put into the differential form f (x) dx − 1 dy = 0 . g(y) 17 This differential form is exact because ∂y f (x) = 0 = ∂x You can therefore find H(x, y) such that ∂x H(x, y) = f (x) , 1 g(y) ∂y H(x, y) = = 0. 1 . g(y) Indeed, you find that H(x, y) = F (x) − G(y) , where F ′ (x) = f (x) and G′ (y) = 1 . g(y) An implicit general solution is therefore F (x) − G(y) = c. This is precisely the recipe we derived earlier. 9.3. Integrating Factors. Suppose you had considered the differential form M(x, y) dx + N(x, y) dy = 0 , and found that is not exact. Just because you were unlucky the first time, do not give up! Rather, seek a nonzero function µ(x, y) such that the differential form (9.11) µ(x, y)M(x, y) dx + µ(x, y)N(x, y) dy = 0 is exact ! This means that µ(x, y) must satisfy ∂y µ(x, y)M(x, y) = ∂x µ(x, y)N(x, y) . This means that µ satisfies (9.12) M(x, y)∂y µ + [∂y M(x, y)]µ = N(x, y)∂x µ + [∂x N(x, y)]µ . This is a first-order linear partial differential equation for µ. Finding its general solution is equivalent to finding the general solution of the original ordinary differential equation. Fortunately, you do not need this general solution. All you need is one nonzero solution. Such a µ is called an integrating factor for the differential form (9.11). A trick that sometimes yields a solution of (9.12) is to assume either that µ is only a function of x, or that µ is only a function of y. When µ is only a function of x then ∂y µ = 0 and (9.12) reduces to the first-order linear ordinary differential equation dµ ∂y M(x, y) − ∂x N(x, y) = µ. dx N(x, y) This equation will be consistent with our assumption that µ is only a function of x when the fraction on its right-hand side is independent of y. In that case you can integrate the equation to find the integrating factor µ(x) = eA(x) , where A′ (x) = ∂y M(x, y) − ∂x N(x, y) . N(x, y) Similarly, when µ is only a function of y then ∂x µ = 0 and (9.12) reduces to the first-order linear ordinary differential equation ∂x N(x, y) − ∂y M(x, y) dµ = µ. dy M(x, y) 18 This equation will be consistent with our assumption that µ is only a function of y when the fraction on its right-hand side is independent of x. In that case you can integrate the equation to find the integrating factor µ(y) = eB(y) , where B ′ (y) = ∂x N(x, y) − ∂y M(x, y) . M(x, y) This will be the only method for finding integrating factors that we will use in this course. Remark. Rather than memorize the above formulas for µ(x) and µ(y) in terms of primitives, I strongly recommend that you simply follow the steps by which they were derived. Namely, you seek an integrating factor µ that satisfies ∂y [M(x, y) µ] = ∂x [N(x, y) µ] . You then expand the partial derivatives as M(x, y)∂y µ + [∂y M(x, y)] µ = N(x, y)∂x µ + [∂x N(x, y)] µ . If this equation reduces to an equation that only depends on x when you set ∂y µ = 0 then there is an integrating factor µ(x). On the other hand, if this equation reduces to an equation that only depends on y when you set ∂x µ = 0 then there is an integrating factor µ(y). We will illustrate this approach with the following examples. Example. Give an implicit general solution to the differential equation (2ex + y 3 ) dx + 3y 2 dy = 0 . Solution. This differential form is not exact because ∂y (2ex + y 3 ) = 3y 2 6= ∂x (3y 2) = 0 . You therefore seek an integrating factor µ such that ∂y [(2ex + y 3)µ] = ∂x [(3y 2)µ] . Expanding the partial derivatives gives (2ex + y 3)∂y µ + 3y 2µ = 3y 2 ∂x µ . Notice that if ∂y µ = 0 then this equation reduces to µ = ∂x µ, whereby µ(x) = ex is an integrating factor. (See how easy that was!) Because ex is an integrating factor, you know that ex (2ex + y 3) dx + 3ex y 2 dy = 0 is exact . (Of course, you should check that this is exact. If it is not then you made a mistake in finding µ!) You can therefore find H(x, y) such that ∂x H(x, y) = ex (2ex + y 3) , ∂y H(x, y) = 3y 2 ex . By intgrating the second equation you see that H(x, y) = y 3 ex + h(x). When this expression for H(x, y) is plugged into the first equation you obtain y 3ex + h′ (x) = ∂x H(x, y) = (2ex + y 3)ex , which yields h′ (x) = 2e2x . Upon taking h(x) = e2x , so that H(x, y) = y 3 ex + e2x , a general solution satisfies y 3 ex + e2x = c . 19 In this case the general solution can be given explicitly as 1 y = (ce−x − ex ) 3 , where c is an arbitrary constant. Example. Give an implicit general solution to the differential equation 2xy dx + (2x2 − ey ) dy = 0 . Solution. This differential form is not exact because ∂y (2xy) = 2x 6= ∂x (2x2 − ey ) = 4x . You therefore seek an integrating factor µ such that ∂y [(2xy)µ] = ∂x [(2x2 − ey )µ] . Expanding the partial derivatives gives 2xy∂y µ + 2xµ = (2x2 − ey )∂x µ + 4xµ . Notice that if ∂x µ = 0 then this equation reduces to y∂y µ = µ, whereby µ(y) = y is an integrating factor. (See how easy that was!) Because y is an integrating factor, you know that 2xy 2 dx + y(2x2 − ey ) dy = 0 is exact . You can therefore find H(x, y) such that ∂x H(x, y) = 2xy 2 , ∂y H(x, y) = 2x2 y − yey . By intgrating the first equation you see that H(x, y) = x2 y 2 + h(y). When this expression for H(x, y) is plugged into the second equation you obtain 2x2 y + h′ (y) = ∂y H(x, y) = 2x2 y − yey , which yields h′ (y) = −yey . Upon taking h(y) = (1 − y)ey , so that H(x, y) = x2 y 2 + (1 − y)ey , a general solution satisfies x2 y 2 + (1 − y)ey = c . In this case you cannot solve for y explicitly. Remark. Integrating factors for the linear equations can be viewed as a special case of the foregoing method. Consider the linear first-order ordinary differential equation dy + a(x)y = f (x) . dx It can be put into the differential form a(x)y − f (x) dx + dy = 0 . This differential form is generally not exact because when a(x) 6= 0 we have ∂y a(x)y − f (x) = a(x) 6= ∂x 1 = 0 . You therefore seek an integrating factor µ such that ∂y a(x)y − f (x) µ = ∂x µ . Expanding the partial derivatives by the product rule gives a(x)y − f (x) ∂y µ + a(x)µ = ∂x µ . 20 Notice that if ∂y µ = 0 then this equation reduces to ∂x µ = a(x)µ, whereby an integrating factor is µ(x) = eA(x) where A′ (x) = a(x). Because eA(x) is an integrating factor, you know that eA(x) a(x)y − f (x) dx + eA(x) dy = 0 is exact . You can therefore find H(x, y) such that ∂x H(x, y) = eA(x) a(x)y − f (x) , ∂y H(x, y) = eA(x) . By intgrating the second equation you see that H(x, y) = eA(x) y+h(x). When this expression for H(x, y) is plugged into the first equation you obtain eA(x) a(x)y + h′ (x) = ∂x H(x, y) = eA(x) a(x)y − f (x) , which yields h′ (x) = −eA(x) f (x). A general solution thereby satisfies H(x, y) = eA(x) y − B(x) = c , where A′ (x) = a(x) and B ′ (x) = eA(x) f (x) . This is equivalent to the recipe we derived previously. 21 10. Special First-Order Equations and Substitution So far we have developed analytical methods for linear equations, separable equations, and equations that can be expressed as an exact differential form. There are other first-order equations that can be solved by analytical methods. Here we present a few of them. 10.1. Linear Argument Equations. These equations can be put into the form dy = k(ax + by) , dx where k(z) is a differentiable function over an interval (zL , zR ) while a and b are constants with b 6= 0. Upon setting z = ax + by we see that (10.1) dz d dy = (ax + by) = a + b = a + b k(ax + by) = a + b k(z) . dx dx dx Therefore z satisfies the autonomous equation dz = a + b k(z) . dx If we can solve this equation for z then the solution of (10.1) is obtained by setting (10.2) y= z − ax . b Solutions of (10.2) are given implicitly by (10.3) G(z) = x + c , where G′ (z) = 1 . a + b k(z) Of course, we will not be able to find an explicit primitive G(z) for every k(z). And when we can find G(z), often we will not be able to solve (10.3) for z as an explicit function of x. Example. Solve the equation dy = (x + y)2 . dx Solution. This has the form (10.1) with k(z) = z 2 and a = b = 1. Rather than remember the form (10.2), it is easier to remember the substitution z = x + y and rederive (10.2). Indeed, we see that dz d dy = (x + y) = 1 + = 1 + (x + y)2 = 1 + z 2 . dx dx dx Solutions of this autonomous equation satisfy Z 1 x= dz = tan−1 (z) + c . 1 + z2 This equation can be solved explicitly to obtain z = tan(x − c). Because y = z − x, a family of solutions to the original equation is therefore y = tan(x − c) − x . 22 10.2. Dilation Invariant Equations. These equations can be put into the form y dy for some p 6= 0 , = xp−1 k p , (10.4) dx x where k(z) is a differentiable function over (−∞, ∞). A first-order equation in the form dy = f (x, y) , dx can be put into the form (10.4) if and only if f (x, y) satisfies the dilation symmetry (10.5) f (λx, λp y) = λp−1 f (x, y) for every λ 6= 0 . Indeed, if f (x, y) satisfies has this symmetry then by choosing λ = 1/x we see that y 1 1 1−p p p−1 p−1 f (x, y) = λ f (λx, λ y) = x f x , p y = x f 1, p , x x x whereby k(z) = f (1, z). When f (x, y) satisfies (10.5) with p = 1 then equation (10.4) is said to be homogeneous. This notion of homogeneous should not be confused with the notion of homogeneous that arises in the context of linear equations. We can transform (10.4) into a separable equation by setting z = y/xp . By using (10.4) we see that y 1 dy y 1 y dz = p − p p+1 = p xp−1 k p − p p+1 dx x dx x x x x 1 y y 1 = k p − p = k(z) − pz . x x x x Therefore z satisfies the separable equation k(z) − pz dz = . (10.6) dx x If we can solve this equation for z then the solution of (10.4) is obtained by setting y = zxp . Solutions of (10.6) are given implicitly by 1 (10.7) log(|x|) = G(z) + c , where G′ (z) = . k(z) − pz Of course, we will not be able to find an explicit primitive G(z) for every k(z). And when we can find G(z), often we will not be able to solve (10.7) for z as an explicit function of x. Example. Solve the equation p y + x2 + y 2 dy = for x > 0 . dx x Solution. This equation can be expressed as r dy y y2 = + 1+ 2 . dx x x √ It thereby has the dilation invariant form (10.4) with p = 1 and k(z) = z + 1 + z 2 . Rather than remember the form (10.6), it is easier to remember the substitution z = y/x and rederive (10.6). Indeed, we see that ! r r √ y d y 1 dy y 1 y 1 1 + z2 y2 y2 dz 1+ 2 = = = − 2 = + 1+ 2 − 2 = . dx dx x x dx x x x x x x x x 23 Solutions of this separable equation satisfy Z 1 √ log(x) = dz = sinh−1 (z) + c . 2 1+z This equation can be solved explicitly to obtain elog(x)−c − e− log(x)+c 1 x ec . = − z = sinh log(x) − c = 2 2 ec x Because y = xz, a family of solutions to the original equation is therefore x2 − e2c y= . 2ec 10.3. Bernoulli Equations. These equations can be put into the form dy = a(t)y − b(t)y 1+m , (10.8) dt where a(t) and b(t) are continous over an interval (tL , tR ) while m is a constant. If m = 0 this reduces to a homogeneous linear equation, which can be solved the method of Section 3.2. So here we will treat only the case m 6= 0. If m = −1 then equation (10.8) is a nonhomogeneous linear equation, which can be solved the method of Section 3.3. Jacob Bernoulli first wrote down such equations in 1695, and the next year Gottfried Leibniz showed that they can be transformed into a nonhomogeneous linear equation for every m 6= 0 by a simple substitution. Bernoulli then showed that they can be transformed into a separable equation by another simple substitution. We can transform (10.8) into a linear equation by setting z = y −m . We see that dz dy = −my −m−1 = −my −m−1 a(t)y − b(t)y 1+m dt dt = −m a(t)y −m + m b(t) = −m a(t)z + m b(t) . Therefore z satisfies the nonhomogeneous linear equation dz (10.9) + m a(t)z = m b(t) . dt 1 If we can solve this equation for z then a solution of (10.8) is obtained by setting y = z − m . Equation (10.9) can be solved by the method of Section 3.3. Let A(t) and B(t) satisfy A′ (t) = m a(t) , B ′ (t) = m e−A(t) b(t) . Then the general solution of (10.9) is given by (10.10) z = e−A(t) B(t) + e−A(t) c , Therefore a solution of (10.8) is given by − 1 (10.11) y = e−A(t) B(t) + e−A(t) c m , where c is an arbitrary constant . where c is an arbitrary constant . Remark. Because equation (10.9) is linear, if a(t) and b(t) are continuous over a time interval (tL , tR ) then its solution z will exist over (tL , tR ) and be given by (10.10). However, formula (10.11) for the solution y of (10.8) can breakdown for several reasons. 24 Example. Solve the logistic model for populations dp = (r − ap)p . dt Remark. Earlier we solved this using our autonomous equation recipe. Here we will treat it as a Bernoulli equation. Remark. The equation has the form dp = rp − ap2 , dt which is the Bernoulli form (10.8) with a(t) = r, b(t) = a, and m = 1. If we apply formula (10.10) with A(t) = rt and Z a B(t) = e−rt a dt = − e−rt + c , r then we obtain 10.4. Substitution. The idea behind each of the examples above is to transform the original differential equation into an equation with a form that we know how to solve. In general, let the original equation be dy (10.12) = f (t, y) . dt Upon setting z = Z(t, y) and using (10.12) we see that dy dz = ∂t Z(t, y) + ∂y Z(t, y) = ∂t Z(t, y) + ∂y Z(t, y) f (t, y) . dt dt We then assume the relation z = Z(t, y) can be inverted to obtain y = Y (t, z), and substitute this result into the above to find dz = ∂t Z t, Y (t, z) + ∂y Z t, Y (t, z) f t, Y (t, z) . dt We thereby obtain the transformed equation dz (10.13) = g(t, z) , dt where g(t, z) is given in terms of f (t, y), Z(t, y), and Y (t, z) by g(t, z) = ∂t Z t, Y (t, z) + ∂y Z t, Y (t, z) f t, Y (t, z) . This relation can be inverted to give f (t, y) in terms of g(t, z), Y (t, z), and Z(t, y) as f (t, y) = ∂t Y t, Z(t, y) + ∂z Y t, Z(t, y) g t, Z(t, y) . Therefore if you can solve equation (10.13) then you can solve equation (10.12), and vice versa.