5.3 Exact differential equations
Remember that a function f ( x , y ) f(x,y) f ( x , y ) has the
total differential
d f = ( ∂ f ∂ x ) y d x + ( ∂ f ∂ y ) x d y \d{f}= \td{}{f}{x}{y} \d{x} + \td{}{f}{y}{x} \d{y} d f = ( ∂ x ∂ f ) y d x + ( ∂ y ∂ f ) x d y Also note that if f = c f = c f = c (a constant), then d f = 0 \d{f} = 0 d f = 0 . How does this apply
to ODEs?
Suppose we can rewrite our ODE as
P ( x , y ) d x + Q ( x , y ) d y = 0 P(x,y) \d{x} + Q(x,y) \d{y} = 0 P ( x , y ) d x + Q ( x , y ) d y = 0 If we can show that
P = ( ∂ f ∂ x ) y Q = ( ∂ f ∂ y ) x P = \td{}{f}{x}{y} \qquad Q = \td{}{f}{y}{x} P = ( ∂ x ∂ f ) y Q = ( ∂ y ∂ f ) x for some f f f , then we know that f ( x , y ) = c f(x,y) = c f ( x , y ) = c is an implicit solution of the
ODE! We call ODEs with this property exact . But, how do we know if such a
function exists and what it is?
Test for exactness ¶ For example, to test if
cos ( x + y ) d x + [ 3 y 2 + 2 y + cos ( x + y ) ] d y = 0 \cos(x+y) \d{x} + \left[3y^2 + 2y + \cos(x+y) \right]\d{y} = 0 cos ( x + y ) d x + [ 3 y 2 + 2 y + cos ( x + y ) ] d y = 0 is exact. First, identify P and Q , then differentiate:
P = cos ( x + y ) ( ∂ P ∂ y ) x = − sin ( x + y ) \begin{align}
P &= \cos(x+y) \\
\td{}{P}{y}{x} &= -\sin(x+y)
\end{align} P ( ∂ y ∂ P ) x = cos ( x + y ) = − sin ( x + y ) and
Q = 3 y 2 + 2 y + cos ( x + y ) ( ∂ Q ∂ x ) y = − sin ( x + y ) \begin{align}
Q &= 3y^2 + 2y + \cos(x+y) \\
\td{}{Q}{x}{y} &= -\sin(x+y)
\end{align} Q ( ∂ x ∂ Q ) y = 3 y 2 + 2 y + cos ( x + y ) = − sin ( x + y ) Since these partial derivatives match, the ODE is exact.
Partial integration ¶ If an ODE is exact, we can integrate P or Q to get f , then solve for the
integration constant with Q or P . For the ODE given by
Eq. (5) , first integrate P with respect to x :
f = ∫ P d x = ∫ cos ( x + y ) d x = sin ( x + y ) + k ( y ) \begin{align}
f &= \int P \d{x} \\
&= \int \cos(x+y) \d{x} \\
&= \sin(x+y) + k(y)
\end{align} f = ∫ P d x = ∫ cos ( x + y ) d x = sin ( x + y ) + k ( y ) Note that this integration adds an unknown function k of the variable that was
held constant (in this case, y ). To determine this function, differentiate and
equate with Q :
( ∂ f ∂ y ) x = Q cos ( x + y ) + k ′ = 3 y 2 + 2 y + cos ( x + y ) k ′ = 3 y 2 + 2 y \begin{align}
\td{}{f}{y}{x} &= Q \\
\cos(x+y) + k' &= 3y^2+2y+\cos(x+y) \\
k' &= 3y^2+2y
\end{align} ( ∂ y ∂ f ) x cos ( x + y ) + k ′ k ′ = Q = 3 y 2 + 2 y + cos ( x + y ) = 3 y 2 + 2 y This is a first-order ODE for k that can be solved using separation of
variables:
∫ d k = ∫ ( 3 y 2 + 2 y ) d y k = y 3 + y 2 + k 0 \begin{align}
\int \d{k} &= \int (3y^2+2y) \d{y} \\
k &= y^3 + y^2 + k_0
\end{align} ∫ d k k = ∫ ( 3 y 2 + 2 y ) d y = y 3 + y 2 + k 0 where k 0 k_0 k 0 is another unknown integration constant. Since we know that the ODE
was exact, the solution f must be equal to a constant c :
f = sin ( x + y ) + y 3 + y 2 + k 0 = c \begin{align}
f = \sin(x+y) + y^3 +y^2 + k_0 = c
\end{align} f = sin ( x + y ) + y 3 + y 2 + k 0 = c Note that the coefficient k 0 k_0 k 0 can be absorbed into c . This will be a common
pattern for these problems, so moving forward, we will neglect writing the
integration constant for k . The general, implicit solution to the ODE is:
sin ( x + y ) + y 3 + y 2 = c \sin(x+y) + y^3 + y^2 = c sin ( x + y ) + y 3 + y 2 = c Note that order of integration does not matter. We could also have integrated
with respect to y first
f = ∫ Q d y = ∫ [ 3 y 2 + 2 y + cos ( x + y ) ] d y = y 3 + y 2 + sin ( x + y ) + k ( x ) \begin{align}
f &=\int Q \d{y} \\
&= \int \left[3y^2+2y+\cos(x+y) \right] \d{y} \\
&=y^3+y^2+\sin(x+y)+k(x)
\end{align} f = ∫ Q d y = ∫ [ 3 y 2 + 2 y + cos ( x + y ) ] d y = y 3 + y 2 + sin ( x + y ) + k ( x ) Then differentiated with respect to x and equated with P :
( ∂ f ∂ x ) y = P cos ( x + y ) + k ′ = cos ( x + y ) k ′ = 0 \begin{align}
\td{}{f}{x}{y} &= P \\
\cos(x+y) + k' &= \cos(x+y) \\
k'&=0
\end{align} ( ∂ x ∂ f ) y cos ( x + y ) + k ′ k ′ = P = cos ( x + y ) = 0 giving k = k 0 k = k_0 k = k 0 . Substituting, we arrive at the same answer!
Skill builder problems ¶ Obtain general solutions to:
The ODE is already in the standard form so
P = − 2 x y sin ( x 2 ) Q = cos ( x 2 ) \begin{align}
P &= -2xy \sin(x^2) \\
Q &= \cos(x^2) \\
\end{align} P Q = − 2 x y sin ( x 2 ) = cos ( x 2 ) Check to see if the ODE is exact:
( ∂ P ∂ y ) x = − 2 x sin ( x 2 ) ( ∂ Q ∂ x ) y = − 2 x sin ( x 2 ) \begin{align}
\td{}{P}{y}{x} &= -2x \sin(x^2) \\
\td{}{Q}{x}{y} &= -2x \sin(x^2)
\end{align} ( ∂ y ∂ P ) x ( ∂ x ∂ Q ) y = − 2 x sin ( x 2 ) = − 2 x sin ( x 2 ) The two partial derivatives are equal, so the ODE is exact. You can proceed
directly to integration. First, integrate Q with respect y
f ( x , y ) = ∫ cos ( x 2 ) d y = y cos ( x 2 ) + k ( x ) f(x,y) = \int \cos(x^2) \d{y} = y \cos(x^2) + k(x) f ( x , y ) = ∫ cos ( x 2 ) d y = y cos ( x 2 ) + k ( x ) where k is an unknown function of x . Then, differentiate f with respect
to x and compare to P :
( ∂ f ∂ x ) y = − 2 x y sin ( x 2 ) + k ′ ( x ) = P = − 2 x y sin ( x 2 ) k ′ ( x ) = 0 \begin{align}
\td{}{f}{x}{y} = -2xy \sin(x^2) + k'(x) &= P = -2xy \sin(x^2) \\
k'(x) &= 0
\end{align} ( ∂ x ∂ f ) y = − 2 x y sin ( x 2 ) + k ′ ( x ) k ′ ( x ) = P = − 2 x y sin ( x 2 ) = 0 This simple ODE has k = 0 k = 0 k = 0 as a solution (neglecting the integration
constant). Putting it all together,
f = y cos ( x 2 ) = c f = y \cos(x^2) = c f = y cos ( x 2 ) = c is an implicit solution of the ODE, which we can manipulate to an explicit
solution:
y = c cos ( x 2 ) y = \frac{c}{\cos(x^2)} y = cos ( x 2 ) c