Chapter 1 First-Order Differential Equations Shurong Sun University of Jinan Semester 1, 2010-2011 Analogous to a course in algebra and trigonometry, where a good amount of time is spent solving equations such as x 2 5 x 4 0 for the unknown variable x. In this course one of our tasks will be to solve differential equations such as y 2 y y 0 for the unknown function y=y(t). 1.1 1.1 Separable Differential Equations • Many first order differential equations can be written as: g ( y ) y f ( x) ' or dy g ( y ) f ( x) dx g ( y)dy f ( x)dx •We can solve these equations by integrating: g ( y)dy f ( x)dx c 1.2 Separable Differential Equation A first order differential equation of the form dy f ( x ) g( y ) is called a separable differential equation. dx I. g ( y ) 0. Set 1 h( y ) and multiply by dx to obtain g( y ) h( y )dy f ( x )dx . Integrating, we have h( y)dy f ( x)dx c. 1.3 II. g(0 ) 0, then y( x ) 0 dy f ( x ) g( y ). is one solution to the equation dx 1.4 Separable Equation Example dy x . Example Solve the equation dx y Solution: This is a separable equation. Separate variables and rewrite the equation in the form ydy xdx . Integrating, we have ydy xdx or y2 x2 C ,(C 0). 2 2 Solving for y , we obtain the solution in explicit form as y C1 x 2 . 1.5 Separable Equation Example • Solve the differential equation: y' 1 y 2 Solution: We first rewrite the DE in fractional form dy 1 y2 dx Separate variables and rewrite the equation in the form dy dx 2 1 y Integrating, we get arctan y x c or y tan( x c ) 1.6 Example Solve the IVP dy y 1 , y(1) 0. dx x 3 Solution: Separate variables and rewrite the equation dy dx . in the form y 1 Integrating, we have x3 1 1 dy y 1 x 3 dx or ln | y 1 | ln | x 3 | C . Solving for y , we obtain the solution in explicit form as y 1 e C ( x 3) or y 1 C1 ( x 3), where C1 e C 0. 1.7 Note that y=1 is also a solution to the equation. So the general solution to the equation is y 1 K ( x 3), where K is an arbitrary constant. Applying the initial condition directly, we have 1 or 0 1 2K K . 2 1 1 Thus y 1 ( x 3) ( x 1). 2 2 1.8 Example Solve the equation dy 6 x 5 2 x 1 . y dx cos y e Solution: Separate variables and rewrite the equation in the form (cos y e y )dy (6 x 5 2 x 1)dx . Integrating, we have y 5 (cos y e ) dy (6 x 2 x 1)dx, or sin y e y x 6 x 2 C . 1.9 Example- Newton ’ s Law of Cooling A copper sphere is heated to 100o c . At time t=0 it is then placed in water that is maintained at 30o c . After 3 minutes the sphere ’ s temperature is 70o c . Derive an equation for the temperature T of the ball as a function of time t. •Newton ’ s law of cooling implies: dT k (T 30) dt 1.10 Example- Newton ’ s Law of Cooling • Step 1 - Separate variables dT k dt T 30 • Step 2 - Integrate ln | T 30 | kt c T (t ) ce 30 kt 1.11 Example- Newton ’ s Law of Cooling • Step 3 - Determine a particular solution T (0) ce 30 100 kt T (t ) 70e 30 kt •Step 4 - Determine k T (3) 70e 30 70 3k 1 70 30 k ln 0.1865 3 70 1.12 1.2 Reduction to Separable Form • Sometimes first order differential equations can be made separable by a simple change of variable. Consider equations of the form: (1) Homogeneous Equation dy y g dx x Remark: dy f ( x, y ) is homogeneous iff f ( tx , ty ) f ( x , y ). dx 1.14 y •This suggests we set: u x • Writing the differential equation in terms of u gives: dy du y xu u x dx du dx dy g ( u) u x dx du x g ( u) u dx dx g ( u) 1.15 du x g ( u) u dx • Separating variables gives: du dx g (u ) u x 1.16 Example: Solve ( xy y 2 x 2 )dx x 2dy 0. (6) Solution: We express (6) in the derivative form dy xy y 2 x 2 y y 2 ( ) 1, 2 dx x x x then we see that the equation (6) is homogeneous. dy du y u x . Now let u and recall that dx dx x With these substitution, equation (6) becomes du x u2 1. dx 1.17 The above equation is separable, and , on separating the variables and integrating, we obtain 1 1 u2 1 dv xdx, arctan u ln | x | C . Hence, u tan(ln | x | C ). y Finally, we substitute for u and solve for y x to get y x tan(ln | x | C ). Also note that x=0 is a solution. 1.18 dy (2) Equations of the Form G(ax by ) dx Set z ax by . Then the equation is transformed into a separable one. Example: Solve dy y x 1 ( x y 2)1 . (8) dx z x y. Solution: Set Then dz dy 1 , dx dx and so dy dz 1 . dx dx 1.19 Substituting into (8) yields dz z 1 ( z 2)1 , or dx 2 dz ( z 2) 1 1 z 2 ( z 2) . dx z2 1 Solving this separable equation, we obtain z2 1 dz dx , ( z 2)2 1 ln | ( z 2)2 1 | x C , 2 2 2x from which it follows that ( z 2) Ce 1. Finally, replacing z by x-y yields ( x y 2) Ce 2 2x 1. 1.20 a1 x b1 y c1 dy (3) f dx a2 x b2 y c2 where the ai s , bi s and ci s are constants. I. a1 b1 a2 b2 0. In this case, the equations can be reduced to dy the form G(ax by ) dx 1.21 II. a1 b1 a2 b2 0. Then the system of equations a1 x b1 y c1 0 a2 x b2 y c2 0 has a unique solution ( x0 , y0 ). The above DE can be written in the form a1 ( x x0 ) b1 ( y y0 ) dy f dx a2 ( x x0 ) b2 ( x x0 ) 1.22 which yields the DE a1u b1v dy f dx a2u b2v Homogenous Equation after the translation of axes of the form u x x0 , v y y0 . 1.23 Example: Solve ( 3 x y 6)dx ( x y 2)dy 0. Solution: From 3 1 4 0. 1 1 3 x y 6 0 x y20 Hence, we let we obtain x0 1, y0 3. u x 1, v y 3. 1.24 The differential equation for v is ( 3u v )du ( u v )dv 0, or v 3 dv 3u v u. v du u v 1 u v The above equation is homogenous, so we let z . u 2 dz 3 z dz 3 2 z z Then z u du 1 z , or u . du 1 z 1.25 Separating variables gives z 1 1 z 2 2z 3dz udu, 1 ln | z 2 2 z 3 | ln | u | C , 2 from which it follows that z 2 2 z 3 Cu 2 . When we substitute back in for z, u, and v, we find v 2 v ( ) 2 3 cu2 , v 2 2uv 3u2 C , u u ( y 3)2 2( x 1)( y 3) 3( x 1)2 C 1.26 1.2 Linear First-Order DE (1) Definition Linear Equation A first-order differential equation of the form a1 ( x ) dy a0 ( x ) y h( x ) dx (1) is said to be linear equation. When h( x ) 0, the linear equation is said to be homogeneous; otherwise, it is non-homogenous or inhomogenous. 1.27 a1 ( x ) dy a0 ( x ) y h( x ) dx (2) Standard Form By dividing both sides of (1) by the lead coefficient a1 ( x ), we obtain a more useful form, the stand form, of a linear equation: dy P ( x ) y q( x ). (2) dx We seek a solution of (2) on an interval I for which both function P and f are continuous. (3) Variation of parameters 1.28 I. The Homogeneous Equation dy P ( x ) y 0. (3) dx This is a separable equation. Writing (3) as dy P ( x )dx 0 y and integrating . P ( x ) dx Solving for y gives y Ce . II. The Nonhomogeneous Equation dy P ( x ) y q( x ). dx (2) Method of variation of constants 1.29 II. The Nonhomogeneous Equation dy P ( x ) y q( x ). dx (2) Method of variation of constants The basic idea is the constant C in the general solution of the homogeneous equation (3) is replaced by a function C(x). The calculation of an appropriate choice of C(x) gives a solution of the nonhomogeneous equation (2) . Substituting y C ( x )e P ( x ) dx (C ( x ) C ( x ) P( x ))e P ( x ) dx into (2) gives P( x )C ( x )e P ( x ) dx q( x ) 1.30 so Hence and C ( x )e P ( x ) dx P ( x ) dx q( x ) or C ( x ) e q ( x) P ( x ) dx C ( x) e q ( x) C , y Ce P ( x ) dx e P ( x ) dx e P ( x ) dx P ( x ) dx e q( x )dx P ( x ) dx ( e q( x )dx C ). (4) Thus if (2) has a solution, it must be of form (4). Conversely, it is easy to verify that (4) constitutes one-parameter family of solutions of equation (2), that is a general solution of equation (2). 1.31 Example Finding the general solution to dy ( x 1) ny e x ( x 1)n1 . dx Solution: We write the differential equation in standard form dy n y e x ( x 1)n . dx x 1 The associated homogeneous equation is dy n y 0. dx x 1 Separating variable, we find 1.32 n dy dx 0, y x 1 So the general solution to the homogeneous equation is y C ( x 1)n . By the method of variation of parameter, substituting into the equation gives y C ( x )( x 1)n dc( x ) n n n 1 ( x 1) n( x 1) c( x ) c( x )( x 1)n e x ( x 1)n . dx x 1 dc( x ) x So ex , 1 dx Thus the general solution to ( x 1) dy ny e x ( x 1)n1 . dx c( x ) e c . 1.33 is y ( x 1)n (e x c1 ). 1.34 dy n P x y Q( x) y Bernoulli Equations dx (9) Remark: when n=0,1, equation (9) is also a linear equation. n For n 1, dividing equation (9) by y dy n yields y P ( x ) y1 n Q( x ). (10) dx Taking v y1 n , we find via the chain rule that dv n dy (1 n) y , dx dx 1.40 dv n dy (1 n) y , dx dx and so equation (10) becomes 1 dv Linear P ( x )v Q( x ). equation 1 n dx n dy y P ( x ) y1 n Q( x ). dy 5 3 dx Example : Solve (11) 5 y xy . dx 2 Solution: This is a Bernoulli equation with n=3, 5x P ( x ) 5, and Q( x ) . 2 1.41 We make the substitution dv 3 dy 2 y , dx dx 1 dv 5 5v x, 2 dx 2 Since 2 v y . the transformed equation is dv 10v 5 x . dx This is a linear equation, its solution is ve 10 dx 10 dx ( 5 xe C ) e 10 x ( 5 xe10 x dx C ) x 1 Ce 10 x . 2 20 1.42 ve 10 dx 10 dx ( 5 xe C ) e 10 x ( 5 xe10 x dx C ) x 1 Ce 10 x . 2 20 Substituting v y 2 give the solution x 1 y Ce 10 x . 2 20 2 Not included in the last equation is the solution y 0 that was lost in the process of dividing 3 y . (11) by 1.43 1.3 Exact Differential Equations and Integrating factors Exact Differential Equations • Recall that the total or exact differential of a function u(x,y) is: u u du dx dy x y • We will use the concept of exactness to study differential equations of the form: M ( x, y )dx N ( x, y )dy 0 1.45 • Compare the following u u dx dy du (exact differential) x y M ( x , y )dx N ( x , y )dy 0 (ODE) We say an ODE is exact if there exists a function such that u( x , y ) C 1 ( ), R2 u M ( x, y) x u and N ( x , y ) . y That is du( x , y ) Mdx Ndy Note this means that we can now write our ODE as: 1.46 Note this means that we can now write our ODE as: du( x , y ) 0 In this case, its solution (in implicit form) is given by u( x , y ) C Remember we need: u M x u and N y 1.47 Testing for Exactness • In practice we often don ’ t know about u, only about M and N and it is hard to check that u M x u and N y • We want a technique of testing for exactness based on knowing M and N, not u 1.48 • Let ’ s check the derivatives of M and N: M u 2u N u 2u and y y x yx x x y xy If M(x,y) and N(x,y) are continuous functions and have continuous first partial derivatives on some simply connected region of xy-plane, then • A necessary and sufficient condition for exactness is: M N y x 1.49 Solving Exact Equations • Once we have checked the equation is exact it can be readily solved by evaluating either: u Mdx g( y ) u from M x u Mdx g ( y )=N y y u from N y 1.50 or u Ndy h( x ) u Ndy h( x )=M x x u from N y u from M x 1.51 Exact Equations: Example 2 2 (2 xy sec x ) dx ( x 2 y )dy 0. Example Solve Solution Here M ( x, y ) 2 xy sec2 x and N ( x, y ) x 2 2 y. Since M N 2x , y x the equation given is exact. u 2 2 xy sec x, From x we have that u( x, y ) (2 xy sec2 x )dx g( y ) x 2 y tan x g( y ). 1.52 Next we take the partial derivative of u with respect 2 x 2 y for N: to y and substitute x 2 g( y ) x 2 2 y. Thus g( y ) 2 y, and g( y ) y 2 . Here we drop the constant of integration that technically should be present in g(y) since it will just get absorbed into the constant we pick up in the next step. Hence u( x, y ) x 2 y tan x y 2 So, the implicit solution to the differential equation is x 2 y tan x y 2 C . 1.53 Exact Equations: Example ( x 3 xy )dx (3 x y y )dy 0 3 2 2 M x 3 3 xy 2 and M 6 xy y 3 N 3x2 y y3 N and 6 xy x (exact ) u Ndy h( x ) (3 x 2 y y 3 )dy h( x ) 3 2 2 1 4 x y y h( x ) 2 4 1.54 Exact Equations: Example • Solve for k(x) and then u: u dk 2 3 2 M 3 xy x 3 xy x dx 4 x h c 4 1 4 2 2 4 u ( x 6x y y ) c 4 1.55 Example Find the solution for the following IVP. 3 y 3e 3 xy 1 (2 ye 3 xy 3 xy 2e 3 xy ) y 0. y(0) 1. Solution Let ’ s identify M and N and check that it ’ s exact. 3 3 xy 2 3 xy 3 3 xy M 3 y e 1, M y 9 y e 9 xy e N 2 ye 3 xy 3 xy 2 e 3 xy , N x 9 y 2e 3 xy 9 xy 3e 3 xy So, it ’ s exact. 1.56 With the proper simplification integrating the second one isn ’ t too bad. However, the first is already set up for easy integration so let ’ s do that one. u( x, y ) (3 y 3e 3 xy 1)dx h( y ) ye 2 3 xy x h( y ) Differentiate with respect to y and compare to N. uy ( x, y ) 2 ye 3 xy e h( y ) N So, we get h( y ) 0 h( y ) 0 3 xy 3 xy 2 3 xy N 2 ye 3 xy 2e 3 xy Recall that actually h(y) = k, but we drop the k because it will get absorbed in the next step. That gives us h(y) = 0. 1.57 Therefore, we get u( x , y ) y e 2 3 xy x. The implicit solution is then 2 3 xy ye xC Applying the initial condition gives 1 = C The implicit solution is then y 2e 3 xy x 1. 1.58 Remember Exact Equations • We can check whether an equation in this form is exact by checking if M N y x (Necessary and sufficient) • Alternate method: we can often rearrange linear first order ODEs into the form: u u M ( x , y )dx N ( x , y )dy dx dy x y du 0 1.59 Solve the following DE ( x 3 3 xy 2 )dx (3 x 2 y y 3 )dy 0 Solution: Here M x 3 xy 3 2 and N 3x y y 2 3 We first check to see if we have an exact equation. Since M 6 xy y N and 6 xy x it ’ s exact. 1.60 Note that ( x 3 3 xy 2 )dx (3 x 2 y y 3 )dy x dx (3 xy dx 3 x y )dy y dy 3 2 2 3 2 2 3 x dx ( y dx x dy ) y 3dy 2 2 1 4 3 2 2 1 4 d( x x y y ) 4 2 4 3 2 2 3 So the general solution is 1 4 2 2 4 ( x 6x y y ) C 4 1.61 dx dy d ( x y ) xdy ydx d ( xy ) 1 xdx ydy d ( x 2 y 2 ) 2 xdx ydy xdy ydx d ln (xy) xy xdy ydx y d( ) 2 x x xdy ydx y d [ln ( )] xy x xdy ydx 1 y d [ tan ( )] 2 2 x y x x2 y2 d ( x2 y2 ) 1.62 Example. Solve the homogeneous DE dy x y dx x y Solution: This equation can be written in the form ( y x )dx ( x y )dy 0. which is an exact equation. In this case, the solution in implicit form is 1 2 1 2 xy x y C . 2 2 i.e. , 2 xy x 2 y 2 C . 1.65 Integrating Factors • If the equation is not exact we can consider multiplying it by a function ( x , y ) 0 such that the new equation is exact: M ( x , y )dx N ( x , y )dy 0 ( x, y) Mdx Ndy 0 1.66 Finding Integrating Factors • For exactness we require: M N ( M ) ( N ) M N y y x x y x N M M N ( ) y x x y This equation can be simplified in special cases, two. of which we treat next 1.67 • If we choose ( x) d M N N dx y x where Let M N y x N M N d y x dx N is just a function of x. 1 M N ( x) N y x N M M N ( ) y x x y 1.68 Now solve for 1 d 1 M N 1 d ( x) dx N y x dx 1 d ( x )dx 1 d ( x )dx ln ( x )dx e ( x ) dx 1.69 Conversely, if Let Then M N y x N is just a function of x. 1 M N ( x) N y x e ( x ) dx is an integrating factor for Equation. 1.70 In a similar fashion, if equation has an integrating factor that depends only y, then M N is just a function of y. y x M N M y x is just a function of y. Conversely, if M M N Let ( y ) y x . Then e ( y ) dy M is an integrating factor for Equation. 1.71 Integrating Factors: Example 2 2 (2 x y ) dx ( x y x )dy 0 Example: Solve Solution: M 2 x 2 y , N x 2 y x , M N 1 2 xy 1 . y x The equation is not exact. We compute M N 2(1 xy ) 2 y x 1 (2 xy 1) . 2 N x y x x(1 xy ) x 1.72 So an integrating factor for the equation is given by e 2 dx x 2 x . When we multiplying by x we get the exact equation (2 yx 2 )dx ( y x 1 )dy 0. 2 , Solving this equation, we obtain the implicit solution 2 y 2 x yx 1 C. 2 1.73 Note that the solution x=0 is lost in multiplying by x . 2 2 y Hence, 2 x yx 1 and C 2 are solutions to the given equation. x0 1.74 Linear Differential Equations • Recall a differential equation is linear if it can be written: y ' p( x ) y q( x ) • If q(x)=0 the equation is homogeneous, otherwise the equation is nonhomogeneous. 1.75 Homogeneous Linear Case • Separating variables and integrating: y ' p( x) y 0 dy p ( x)dx y ~ ln | y | p ( x)dx c y ( x) ce p ( x ) dx 1.76 Nonhomogeneous Linear Case • Nonhomogeneous linear equations can be solved using the integrating factor method. First rewrite the differential equation as: i.e. ( py q )dx dy 0 M py q, N 1 1.77 Finding the integrating factor • To find the integrating factor we first compute 1 N M N ( M py q , x y N 1) 1 ( py q ) (1) 1 y x p, where p is a function of x 1.78 Nonhomogeneous Linear Case • We can now find an integrating factor pdx ( x) e • Now multiply the differential equation by the integrating factor: ' p dx p dx p dx e ( y ' py ) e y e q 1.79 Nonhomogeneous Linear Case pdx pdx (e y ) e q (Integrate both sides w.r.t. x ) pdx pdx e y e q dx c ye pdx pdx ( e qdx c ) or y 1 ( x )( ( x )qdx c ), pdx where ( x ) e . 1.80 Integrating Factors: Example Example: Solve ydx (2 x ye y )dy 0 Solution: Here M y, N 2 x ye y , M N 1 2 . y x The equation is not exact. We compute M N y x 1 2 1 . M y y 1.81 So an integrating factor for is given by e 1 dy y y. When we multiplying by y , we get the exact equation y 2dx (2 xy y 2e y )dy 0 Solving this equation, we obtain 2 2 y xy ( y 2 y 2)e C as the solution in implicit form. 1.82 In general, integrating factors are difficult to uncover. If a differential equation does not have one of the forms given above, then a search for an integrating factor likely will not be successful, and other methods of solution are recommended. 1.83 Example : Solve dy x x 2 1 ( ) ( y 0). dx y y Solution: Rewriting this equation in differential form, we have ( x x 2 y 2 )dx ydy 0. This differential equation is not exact, and no integrating factor is immediately apparent. Note however, that if terms are strategically regrouped, the DE can be rewritten as ( xdx ydy ) x 2 y 2 dx 0. 1.84 ( xdx ydy ) x 2 y 2 dx 0. (1) The first group of terms has many integrating factors (see Table 2). One of these factors, namely 1 ( x, y) , 2 2 x y is an integrating factor for the entire equation. 1 Multiplying (1) by ( x, y ) , x2 y2 we find ( xdx ydy ) dx 0. (2) 2 2 x y 1.85 Since (2) is exact, it can be solved using the steps described previously. Alternatively, we note from Table 1, ( xdx ydy ) x2 y2 d x2 y2 so that (2) can be rewrite as d x 2 y 2 dx 0. Integrating both sides of this last equation, we find 1.86 x 2 y 2 x c. or equivalently, y 2 c(c 2 x ). 1.87 Solve ydx ( y x )dy 0. Solution: Here M y , N y x and, since M N 1, 1, y x The differential equation is not exact. M N Since 2 is a function of y alone. y x M y we have an integrating factor 1.88 ( x, y) e 2 y 1 2. y 1 Multiplying the given DE by ( x , y ) 2 , y we obtain the exact equation 1 ( y x) dx dy 0, 2 y y or equivalently, ydx xdy 1 dy 0, 2 y y 1.89 Integrating both sides of this last equation, we find x ln | y | c . y (ii) Note that the differential equation can be rewritten as ( ydx xdy ) ydy 0. The first group of terms has many integrating factors (see Table 1). One of these factors, namely 1.90 1 ( x, y) 2 , y is an integrating factor for the entire equation. 1 Multiplying (1) by ( x , y ) 2 , y we find ( ydx xdy ) 1 dy 0. y2 y Integrating both sides of this last equation, we find x ln | y | c . y 1.91 (iii) Rewriting this equation in the derivative form, dy y . dx x y (3) then we see that the equation (3) is homogeneous. dy dv y v x . Now let v and recall that dx dx x With these substitution, equation (3) becomes dv v 1 v dx x v or x 2 dv dx 1 v v x 1.92 The above equation is separable, and , by separating the variables and integrating, we obtain 1 ln | v | ln | x | C . v y Finally , we substitute for v to get x x ln | y | C 0 y 1.93 (iv) We rewrite the differential equation in the form dx x y dx x or 1, dy y dy y which is linear equation. Its solution is xe 1 dy y ( e 1 dy y dy c ) y(ln | y | c ). Also note that x=0 is a solution. 1.94 Table 1 1.95 Table 2 1.96 1.97 Exercise Solve ( x y 2 )dx y(1 x )dy 0. 1.98 1.99 1.100 1.101 1.102 1.103