ORDINARY DIFFERENTIAL EQUATIONS POWERTOOLLesson 8 -- Exact EquationsProf. Douglas B. MeadeIndustrial Mathematics InstituteDepartment of MathematicsUniversity of South CarolinaColumbia, SC 29208
URL: http://www.math.sc.edu/~meade/E-mail: meade@math.sc.eduCopyright \251 2001 by Douglas B. MeadeAll rights reserved-------------------------------------------------------------------<Text-field layout="Heading 1" style="Heading 1">Outline of Lesson 8</Text-field>8.A Basic Theory8.A-1 Example 18.B Integrating Factors8.B-1 Example 2<Text-field layout="Heading 1" style="Heading 1">Initialization</Text-field>restart;with( DEtools ):with( plots ):<Text-field bookmark="8.A" layout="Heading 1" style="Heading 1">8.A Basic Theory</Text-field>The general form for a first-order exact differential equation isgen_exact_ode := P(x,y(x)) + Q(x,y(x))*diff(y(x),x) = 0;where the functions NiMtJSJQRzYkJSJ4RyUieUc= and NiMtJSJRRzYkJSJ4RyUieUc= satisfy the conditionsNiMvLSUiUEc2JCUieEclInlHLSUlZGlmZkc2JC0lIkZHRiZGJw==NiMvLSUiUUc2JCUieEclInlHLSUlZGlmZkc2JC0lIkZHRiZGKA==for some function NiMtJSJGRzYkJSJ4RyUieUc=. At any point NiMtJSFHNiQlInhHJSJ5Rw== where NiMwLSUlZGlmZkc2JC0lIkZHNiQlInhHJSJ5R0YrIiIh, the equation NiMvLSUiRkc2JCUieEclInlHJSJjRw==, where NiMlImNH is a constant, implicitly defines the function NiMtJSJ5RzYjJSJ4Rw==. Such curves are called level curves, and are the curves in the NiMlI3h5Rw==-plane above which the surface NiMvJSJ6Ry0lIkZHNiQlInhHJSJ5Rw== maintains the constant height NiMlImNH.If the function NiMtJSJ5RzYjJSJ4Rw== is so defined implicitly by the equation NiMvLSUiRkc2JCUieEclInlHJSJjRw==, then implicit differentiation givesNiMqJiUiZEciIiIlI2R0RyEiIg==NiMtJSJGRzYkJSJ4Ry0lInlHNiNGJg== = NiMsJiYlIkZHNiMlInhHIiIiJkYlNiMlInlHRig=NiMtJSN5J0c2IyUieEc=where subscripts denote partial derivatives. Now this equation is clearly equivalent to the differential equation, namely,NiMvLCYtJSJQRzYkJSJ4RyUieUciIiIqJi0lIlFHRidGKi0lIUc2IyomJSNkeUdGKiUjZHhHISIiRipGKiIiIQ==Thus, solving this exact differential equation amounts to finding the exact "antiderivative," the function NiMtJSJGRzYkJSJ4RyUieUc= whose exact (or total) derivative is just the ODE itself. The level curves NiMtJSJ5RzYjJSJ4Rw== defined implicitly by NiMvLSUiRkc2JCUieEclInlHJSJjRw== are the solutions of the exact differential equation.To find a condition that guarantees the equationNiMvLCYtJSJQRzYkJSJ4RyUieUciIiIqJi0lIlFHRidGKi0lIUc2IyomJSNkeUdGKiUjZHhHISIiRipGKiIiIQ==is exact, consider an arbitrary function NiMtJSJGRzYkJSJ4RyUieUc= whose level curves are defined by the equationlevel_curve := F(x,y(x)) = C;for some constant NiMlIkNH. If the function NiMtJSJGRzYkJSJ4RyUieUc= satisfies the the ODE, then the difference of the total derivative of NiMtJSJGRzYkJSJ4RyUieUc= and the ODE itself should be zero. Thus, the condition for the equation to be exact iscondition_to_be_exact := collect( diff( lhs(level_curve), x ) - lhs( gen_exact_ode ) = 0, diff(y(x),x) );Careful consideration of this equation shows that it is satisfied whencondition1 := isolate( eval( condition_to_be_exact, diff(y(x),x)=0 ), F );condition2 := isolate( coeff( lhs(condition_to_be_exact), diff(y(x),x) ) = 0, F );That is, whenNiMvLSUlRGlmZkc2JCUiRkclInhHJSJQRw== and NiMvLSUlRGlmZkc2JCUiRkclInlHJSJRRw==.For arbitrary pairs of functions P and Q, this condition will not be satisfied. However, assuming the function F has continuous second derivatives and the functions P and Q have continuous first derivatives, the equivalence of the mixed second derivatives of F, namely,equiv_of_mixed_deriv := D[1](D[2](F)(x,y(x))) = D[2](D[1](F)(x,y(x)));combines with the previous argumentq1 := D[2](condition1);q2 := D[1](condition2);to provide necessary and sufficient conditions for an exact equation. This condition iseval( equiv_of_mixed_deriv, [ D[2](condition1), D[1](condition2) ] );that is,nec_and_suff_condition := (P,Q) -> diff( Q(x,y), x ) = diff( P(x,y), y ):nec_and_suff_condition(P,Q);<Text-field bookmark="8.A-1" layout="Heading 2" style="Heading 2">8.A-1 Example 1</Text-field>Consider the differential equationode := exp(y(x)) + (x*exp(y(x))+cos(y(x))) * diff(y(x),x) = 0;To check if this ODE is exact, identify the coefficients for the general formP := unapply( eval( lhs(ode), [diff(y(x),x)=0, y(x)=y] ), (x,y) ):Q := unapply( eval( coeff(lhs(ode),diff(y(x),x)), y(x)=y ), (x,y) ):
'P'(x,y) = P(x,y);
'Q'(x,y) = Q(x,y);and check the necessary and sufficient condition for exactness:nec_and_suff_condition(P,Q);Since this is an exact equation, we construct the solution in the form NiMvLSUiRkc2JCUieEclInlHJSJDRw== whereNiMvLSUlRGlmZkc2JC0lIkZHNiQlInhHJSJ5R0YqLSUiUEdGKQ==andNiMvLSUlRGlmZkc2JC0lIkZHNiQlInhHJSJ5R0YrLSUiUUdGKQ==The first of these is satisfied whenq1 := F(x,y) = int( P(x,y), x ) + g(y);To satisfy the second condition requiresq2 := diff( rhs(q1), y ) - Q(x,y) = 0;Thus, integrating both sides and isolating NiMtJSJnRzYjJSJ5Rw== givesq3 := isolate( map( int, q2, y ), g(y) );and so the function NiMtJSJGRzYkJSJ4RyUieUc= issoln_F := eval( rhs(q1), q3 );and the implicit solution of the differential equation issoln := soln_F = C;A quick pause to check that this solution does satisfy the differential equation revealsodetest( eval(soln,y=y(x)), ode );The function F is also called a first integral of the ODE. The Maple command firint, from the DEtools package, can be used to express the solution of an exact ODE in terms of its first integral. For example,firint( ode );Note that essentially the same solution is returned with either of the following single commandsexactsol( ode, y(x) );dsolve( ode, y(x), [exact] );The even simpler commandinfolevel[dsolve] := 3:dsolve( ode, y(x) );infolevel[dsolve] := 0:returns an equivalent, but different, solution. This is because Maple is able to find several classifications for this exampleodeadvisor( ode );and uses a different solution method.<Text-field bookmark="8.B" layout="Heading 1" style="Heading 1">8.B Integrating Factors</Text-field>Most first-order ODEs are not exact. Some of these ODEs can be made exact by multiplying the ODE by an appropriate function so that the new ODE is exact. The integrating factor, NiMtJSNtdUc2JCUieEclInlH, must be chosen so that the necessary and sufficient condition is satisfied by the coefficients of the ODE after multiplication by NiMtJSNtdUc2JCUieEclInlH :Applying the necessary and sufficient condition for exactness to the ODENiMvLCYtJSJQRzYkJSJ4Ry0lInlHNiNGKCIiIiomLSUiUUdGJ0YsLSUlZGlmZkc2JEYpRihGLEYsIiIhleads to unassign('P','Q','mu');nec_and_suff_condition( mu*P, mu*Q );This is a partial differential equation, but there are numerous cases where the determination of the integrating factor can be completed under the assumption that NiMlI211Rw== is a function of either NiMlInhH or NiMlInlH, but not both. If at least one of NiMtJSVEaWZmRzYkJSJRRyUieEc= and NiMtJSVEaWZmRzYkJSJQRyUieUc= is zero, an integrating factor for the original ODE can be found by a process illustrated in the following example.<Text-field bookmark="8.B-1" layout="Heading 2" style="Heading 2">8.B-1 Example 2</Text-field>As an example, consider the following ODE,ode2 := P(x,y(x)) + Q(x,y(x)) * diff( y(x), x ) = 0;for which the coefficients NiMtJSJQRzYkJSJ4RyUieUc= and NiMtJSJRRzYkJSJ4RyUieUc= areP := (x,y) -> x*y-2:Q := (x,y) -> x^2-x*y:
'P'(x,y) = P(x,y);
'Q'(x,y) = Q(x,y);That this equation is not exact can be seen fromnec_and_suff_condition( P,Q );or fromodeadvisor( ode2, [exact] );An integrating factor, if one exists, must satisfy the partial differential equationmu_pde := nec_and_suff_condition( mu*P, mu*Q );With a little inspection, it can be seen that this PDE simplifies to a linear ODE when the integrating factor is assumed to be independent of NiMlInlH. The result of this assumption ismu_ode := eval( mu_pde, mu(x,y)=mu(x) );or better still, mu_ode2 := simplify( isolate( mu_ode, diff(mu(x),x) ) );The general solution to this separable (and linear) ODE is found to bemu_sol := dsolve( mu_ode2, mu(x) );Since any (non-trivial) solution can be used as an integrating factor, choose _C1=1 and definemu := unapply( eval( rhs(mu_sol), _C1=1 ), x );To confirm that this function is an integrating factor for the ODE, apply the necessary and sufficient condition for exactness, obtainingsimplify( nec_and_suff_condition( mu*P, mu*Q ) );or useodeadvisor( mu(x)*ode2, [exact] );The Maple command mutest, in the DEtools package, provides an alternate method for checking the validity of an integrating factor for a differential equation:mutest( mu(x), ode2 );The intfactor command, also from the DEtools package, can be used as a black box to find an integrating factor. An integrating factor for this ODE isintfactor( ode2 );The solution to the exact form of the original ODE isdsolve( mu(x)*ode2, y(x), [exact], implicit );Note that without the optional argument implicit Maple returns the pair of solutionsdsolve( mu(x)*ode2, y(x), [exact] );The specific solution obtained depends upon the specific initial condition.The same solutions are also obtained from either ofexactsol( ode2 );dsolve( ode2, y(x), [exact] );In terms of first integrals, the original ODE is not exact so does not have a first integralfirint( ode2 );But, when multiplied by the integrating factor, it has the first integralq := firint( mu(x)*ode2 );which simplifies to the implicit solution found above.simplify( q );[Back to ODE Powertool Table of Contents]