Solving First Order Linear Equations Today we will discuss how to solve a first order linear equation. Our technique will require close familiarity with the product and chain rules for derivatives, so we will begin with a brief review of these techniques. we will also continue with modeling several other situations using differential equations. 1. Existence and Uniqueness 2. Brief Review of the Product and Chain Rules 3. Integrating factors: First Order Linear Equations 4. Modeling 1 Theory of First Order Linear Equations We now turn to the two theoretical questions: 1. Under what conditions must there be a solution to a given initial value problem? 2. Under what conditions is there only one such solution? We note first that these are important questions. If we have a model given by a differential equation, we would like for there to be a function which satisfies the equation. We would also like to know once we have found a solution that we do not have to look for other possibilities. We note further that existence and uniqueness are not trivial questions, as the following example shows: Example: √ Consider the IVP y ′ = y and y(0) = 0. It is easy to confirm that both y(t) = t2 /4 and y(t) = 0 are solutions to this initial value problem, although they are different functions. However, first order linear equations are not challenging: 1 Theorem 2.1: (p. 17) Let p(t) and g(t) be continuous functions on the open interval (a, b) and let t0 be a point in (a, b). Then the initial value problem y ′ + p(t)y = g(t), y(t0) = y0 has a unique solution on the entire interval (a, b). When we study how to solve first order linear equations we will see why this theorem is true. (We will have a fixed method for solving equations of these type, which will give us a formula for the general solution. Then solving the IVP becomes a matter of solving algebraically for a constant C.) Note that the theorem is useful in determining where the solution exists: Example: Determine the largest interval on which theorem 2.1 guarantees ln(t)y ′ + y = cot(t), y(2) = 3 to have a unique solution. We note that this is equivalent to the equation y′ + 1 cos(t) y= . ln(t) sin(t) ln(t) Then by inspection it is easy to see that the function p(t) (the coefficient on y) is discontinuous at t = 1, and undefined for t ≤ 0. We also see that g(t) is additionally discontinuous at all points of the form nπ. So the largest interval on which we have a guaranteed solution is the interval (1, π), which contains the initial value t = 2. Note: Based on what we know at this point, we cannot say for certain that there is not a solution on a larger interval, only that this is the largest interval on which the theorem guarantees a solution. Example: Determine the largest interval on which theorem 2.1 guarantees t y = 0, y(4) = 2 y′ + 2 t −4 to have a unique solution. What if we had initial condition y(0) = 0 instead? 2 2 Brief Review of the Product and Chain Rules Our primary technique for handling first order linear equations will be integrating factors, which will make sense if you have a thorough understanding of the product and chain rules for derivatives. Recall that the product rule for two functions u(t) and v(t) is d (u · v) = u′ v + uv ′ . dt Example: d [t cos(t)] = cos(t) − t sin(t) dt and d t [e y(t)] = et y(t) + et y ′ (t) dt (Recall of course that (d/dt)(et ) = et .) The chain rule states that d u(v(t)) = u′ (v(t)) · v ′ (t). dt Example: d cos(t2 ) = (− sin(t2 ))(2t) = −2t sin(t2 ) dt and d 5t e y(t) = e5t 5y(t) + e5t y ′(t) dt In fact, this last example will be essential for developing the idea of integrating factors. 3 Integrating factors: First Order Linear Equations We attempt to solve the differential equation of the form y ′ + p(t)y = g(t). recall: Let p(t) and g(t) be continuous functions on the open interval (a, b) and let t0 be a point in (a, b). Then the initial value problem y ′ + p(t)y = g(t), 3 y(t0) = y0 has a unique solution on the entire interval (a, b). Our goal is to be able to integrate both sides, and thereby eliminate the derivative. We note that y ′ + p(t)y looks a little bit like a product rule, if the derivative of one term produces an extra p(t). So we multiply through the entire equation by ef (t) R where f ′ (t) = p(t), so f (t) = p(t) dt. This exponential function is what we call an integrating factor. (Since after all it is a factor which helps us integrate the left hand side of the equation.) Thus, we start by multiplying both sides by our integrating factor: R R R exp ( p(t) dt) y ′ + exp ( p(t) dt) p(t)y = exp ( p(t) dt) g(t) (Recall that exp(x) is an alternate way of writing ex .) Then we have as before R R [exp ( p(t) dt) y]′ = g(t) exp ( p(t) dt), which (upon integrating) gives Z exp ( p(t) dt) y = R g(t) exp ( p(t) dt) dt. R Solving for y then results in the solution: y = exp(− p(t) dt) R Z exp ( p(t) dt) g(t) dt R This of course involves two different integrations! Note that the integral will of course include some arbitrary constant (“C”), so the final solution will probably involve some sort of exponential added to another term. Example: We find the solution of the initial value problem y ′ = ty + t, y(0) = 1. First we move the differential equation into standard form: y ′ − ty = t. Then we see that in this R R case, p(t) = −t, so p(t) dt = − t dt = − 12 t2 + C. For convenience, we choose C = 0. 2 Thus our integrating factor is e−t /2 . This gives us: 2 /2 y ′ e−t which can now become 2 /2 − yte−t 2 /2 ye−t ′ 2 /2 = te−t 2 /2 = te−t . Integrating both sides gives us −t2 /2 ye and finally solving for y yields = Z 2 /2 e−t 2 /2 t dt = −e−t 2 /2 y = Cet 4 −1 +C Finally, to satisfy y(0) = 1, we must choose C = 2. Thus the solution to our initial value problem is 2 y = 2et /2 − 1 Note that in fact this technique works for a more general equation of the form q(t)y ′ + p(t)y = g(t) by simply dividing through by q(t)—so long as q(t) is never zero. Thus, to solve a first order linear ordinary differential equation, do the following: 1. Put the equation in the form y ′ + p(t)y = g(t). 2. Multiply through on both sides by your integrating factor ef (t) , f (t) = p(t) dt. (Remember, you want to get an extra p(t) out from the chain rule so that the left hand side turns into a product.) R R 3. Rewrite the left hand side as (ye p(t) dt ′ ) and integrate both sides. 4. Finally, solve for y by dividing through by ef (t) (multiply by e−f (t) ). Example: We solve the equation −3y + y ′ − et = 0 using the steps above: 1. Put it in the form y ′ + p(t)y = g(t): y ′ − 3y = et R 2. Multiply by the integrating factor (e e−3t y ′ − 3e−3t y = e−2t 3. Rewrite and integrate: (ye−3t )′ = e−2t R R (ye−3t )′ dt = e−2t dt 4. Solve for y: ye−3t = − 21 e−2t + C y = − 21 e−2t e3t + Ce3t y = − 21 et + Ce3t 5 −3 dt=−3t ): R R R R Note that your solution should be y = e− p(t) dt e p(t) dt g(t) dt + Ce− p(t) dt when your equation is in the standard form y ′ + p(t)y = g(t). In this case, we get y = − 21 et + Ce3t . Example: We can solve y ′ + 3y = cos(t) by first using the integrating factor e3t : y ′e3t + 3ye3t = e3t cos(t) or (ye3t )′ = e3t cos(t). Integrating both sides yields ye3t = Z e3t cos(t) dt Knowing that there will be a constant of integration C after the antiderivative, we could write this as Z 3t ye = e3t cos(t) dt + C which allows us to solve for y as follows: y = e−3t Z e3t cos(t) dt + Ce−3t and be left with the problem of solving the integral. The integration I = e3t cos(t) dt requires integration by parts twice. recall: Z Z u dv = uv − v du R Let u = e3t and dv = cos(t)dt so: du = 3e3t dtv = sin(t) Using the formula we get: I = e3t sin(t) − 3 Z sin(t)e3t dt Using the same procedure to evaluate I2 = sin(t)e3t dt (u = e3t and dv = sin(t)dt) , we get: Z 3t I2 = −e cos(t) + 3 cos(t)e3t dt R Now substituting I2 into I, we have: 3t 3t I = e sin(t) + 3e cos(t) − 9 6 Z cos(t)e3t dt which can be rewritten as: I = e3t sin(t) + 3e3t cos(t) − 9I or I= 1 3t (e sin(t) + 3e3t cos(t)) 10 We finally obtain 1 3 sin(t) + cos(t) + Ce−3t 10 10 In general, it is not hard to see by using the above procedure that the solution to y ′ + ay = g(t) is given by y= y = e−at Z eat g(t) dt + Ce−at where C is an arbitrary constant. Example: Find a general solution of (1 + t2 )y ′ + 3ty − 6t = 0: Put into standard form: 3t 6t y′ + y = 1 + t2 1 + t2 Find the integrating factor: Z 3t I= dt 1 + t2 Using U-Substitution, u = 1 + t2 and du = 2tdt, we get: 3 I= 2 The integrating factor is: Z 3 3 du dt = ln |1 + t2 | u 2 2 e 2 ln(1+t ) = (1 + t2 )3/2 Multiply by the integrating factor: (1 + t2 )3/2 y ′ + (1 + t2 )3/2 3t 6t y= (1 + t2 )3/2 2 1+t 1 + t2 Rewrite and integrate: ((1 + t2 )3/2 y)′ = 2 3/2 ((1 + t ) y) = Z 6t (1 + t2 )3/2 1 + t2 6t (1 + t2 )3/2 dt 2 1+t 7 Solve for y: (1 + t2 )3/2 y = Z 6t(1 + t2 )1/2 dt + C Let u = t2 + 1, du = 2tdt Then Z 2 1/2 6t(1 + t ) dt = Z 3u1/2 dt = 2u3/2 = 2(1 + t2 )3/2 (1 + t2 )3/2 y = 2(1 + t2 )3/2 + C y =2+ 4 C (1 + t2 )3/2 Mathematical Modeling Overview 1. Mathematical Modeling Overview 2. Radioactive Decay 3. Mixing Problems When we model a situation mathematically using differential equations, we will need to consider a number of issues: • identifying variables • determining the relationship between the variables • writing down and solving a differential equation In the example of the thrown ball we considered in Lesson 1, we identified variable t for time and s for position above the earth, described a relationship using the fact that s′′ (the acceleration) was a constant 32 ft/sec, and wrote down a differential equation involving acceleration at time t. We were also able to confirm that the ball behaved as expected, moving first up and then down again. 5 Radioactive Decay It has been determined that the rate of decay of a radioactive substance is directly proportional to the amount of the radioactive material present. Thus, if we let t be time and y(t) be the amount of the substance present at time t, we have the differential equation y ′ = −ky 8 where k is the constant of proportionality. This equation is a first order linear equation, so we may solve by integrating factor: y ′ + ky = 0 h yekt i′ = 0 yekt = C y = Ce−kt Does this solution make sense? The solution above tends to zero as t → ∞, as we would expect, although it does not decrease to zero at any time. Also note that one feature of radioactive decay is the existence of a half-life, or a fixed period of time in which the amount of the substance is reduced by half. Our model does exhibit this property. Example: Suppose we start with 200 mg of a radioactive material, which has a decay constant k = −.02828, when t is in days. Suppose additional amounts are being added at the rate of 3 mg per day. We will attempt to find: 1. y(t), the amount left after t days; 2. limt→∞ y(t), which represents the eventual equilibrium point; and 3. the time t at which y(t) = 150 mg. The total rate of change comes from the amount lost due to decay and from the amount added: Then we can solve this by using the integrating factor Now we need only use our initial condition: y(0) = 200 mg 9 : so y(t) = We see that as t → ∞, y(t) → . Finally, to find where y(t) = 150, we need only solve: 150 = 6 so Mixing Problems We now consider the problem of well-mixed containers, in which some chemical or other additive has a certain concentration in fluid entering the tank and the tank as a whole may have a different concentration. We assume that the tank is well-mixed; i.e., that all of the additive becomes immediately spread throughout the tank on entering. Example: Suppose a storage tank in an oil refinery holds 2000 gallons of gasoline that initially has 100 lbs of an additive mixed in. Gasoline containing 2 lb of additive per gallon is pumped into the tank at the rate of 40 gallons per minute, and the well-mixed liquid is drained from the tank at 40 gallons per minute as well. Find the amount and the concentration of the additive in the tank after 35 minutes. Let us set our variable y(t) to be the amount of additive in the tank after t minutes. (Thus, y is in pounds.) Then the rate of change of y(t) is given by dy = (change in the amount of additive) dt = (rate at which additive enters) − (rate at which additive leaves) In this case, we have the following: 10 rate at which additive enters = (rate at which mixture enters)*(concentration coming in) rate at which additive leaves = (rate at which mixture leaves)*(concentration going out) Note: at time t, the concentration is: (total amount of additive (t))/(total amount of liquid (t)) The total amount of liquid a time t, V(t), is related to inflow and outflow rates by: dV (t)/dt = inflow rate − outflow rate In this example, the rate at which the flow enters is equal to the rate at which the flow exits the tank, therefore, V(t) is constant and equal to 2000 gallons. Later, we will discuss a case where the volume of liquid changes. Rate at which additive enters: 2(lb/gal)*40(gal/min)=80 lb/min Rate at which additive leaves: (y/2000)(lb/gal)*40(gal/min) = y/50 lb/min So our differential equation is y ′ = 80 − y/50 y ′ + 0.02y = 80 OR Then by solving with integrating factor e.02t , we get: y ′ + .02y = 80 h ye.02t i′ = 80e.02t ye.02t = Z 80e.02t dt y = 4000 + Ce−.02t Then set up an initial condition to find C. We know that at time t = 0, y(0) = 100, so solving 4000 + C = 100 gives C = −3900. Thus our solution is y(t) = 4000 − 3900e−.02t (Note that over time (i.e. t → ∞), the solution approaches containing 4000 pounds of additive.) We wished to know the amount and concentration after 35 minutes. We have y(35) = 4000 − 3900e−.02·35 ≈ 2, 063.31 lbs. To find the concentration, we must divide by the total volume of the tank: 2, 063.31 gal/2000lb ≈ 1.03 lb/gal. 11 Now consider a case where the volume of liquid changes: Let the flow enters with 40 gal/min and exits with 10 gal/min. Rate at which additive enters: 2(lb/gal)*40(gal/min)=80 lb/min Rate at which additive leaves: (y/V(t))(lb/gal)*10(gal/min) dV/dt = 40 - 10 = 30 (gal/min) V = 30t + C V(0) = 2000 gal V = 2000 + 30t So our differential equation is Then by solving with integrating factor we get: 12