Skip to main content
Mathematics LibreTexts

2.7: Exact Differential Equations

  • Page ID
    380
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Consider the equation

    \[ f(x,y) = C. \nonumber \]

    Taking the gradient we get

    \[ f_x(x,y)\hat{\textbf{i}} + f_y(x,y)\hat{\textbf{j}} = 0.\nonumber \]

    We can write this equation in differential form as

    \[ f_x(x,y)\, dx+ f_y(x,y)\, dy = 0.\nonumber \]

    Now divide by \( dx \) (we are not pretending to be rigorous here) to get

    \[ f_x(x,y)+ f_y(x,y) \dfrac{dy}{dx} = 0.\nonumber \]

    Which is a first order differential equation. The goal of this section is to go backward. That is if a differential equation if of the form above, we seek the original function \(f(x,y)\) (called a potential function). A differential equation with a potential function is called exact. If you have had vector calculus, this is the same as finding the potential functions and using the fundamental theorem of line integrals.

    Example \(\PageIndex{1}\)

    Solve

    \[ 4xy + 1 + (2x^2 + \cos y)y' = 0. \nonumber \]

    Solution

    We seek a function \(f(x,y)\) with

    \[ f_x(x,y) = 4xy + 1 \nonumber \]

    and

    \[ f_y(x,y) = 2x^2 + \cos y. \nonumber \]

    Integrate the first equation with respect to \(x\) to get

    \[ f(x,y) = 2x^2y + x + C(y) . \nonumber \]

    Notice since \(y\) is treated as a constant, we write \(C(y)\). Now take the partial derivative with respect to \(y\) to get

    \[ f_y(x,y) = 2x^2 + C'(y) .\nonumber \]

    We have two formulae for \( f_y(x,y) \) so we can set them equal to each other.

    \[ 2x^2 + \cos y = 2x^2 + C'(y) \nonumber \]

    That is

    \[ C'(y) = \cos\, y \nonumber \]

    or

    \[ C(y) = \sin \, y .\nonumber \]

    Hence

    \[ f(x,y) = 2x^2y + x + \sin \, y. \nonumber \]

    The solution to the differential equation is

    \[ 2x^2y + x + \sin \, y = C. \nonumber \]

    Does this method always work? The answer is no. We can tell if the method works by remembering that for a function with continuous partial derivatives, the mixed partials are order independent. That is

    \[ f_{xy} = f_{yx} .\nonumber \]

    If we have the differential equation

    \[ M(x,y) + N(x,y)y' = 0 \nonumber \]

    then we say it is an exact differential equation if

    \[ M_y(x,y) = N_x(x,y) . \nonumber \]

    Theorem (Solutions to Exact Differential Equations)

    Let \(M\), \(N\), \(M_y\), and \(N_x\) be continuous with

    \[ M_y = N_x.\nonumber \]

    Then there is a function \(f(x,y)\) with

    \( f_x = M \) and \( f_y = N \)

    such that

    \[ f(x,y) = C \nonumber \]

    is a solution to the differential equation

    \[ M(x,y) + N(x,y)y' = 0 .\nonumber \]

    Example \(\PageIndex{2}\)

    Solve the differential equation

    \[ y + (2xy - e^{-2y})y' = 0 . \nonumber \]

    Solution

    We have

    \[ M(x,y) = y\nonumber \]

    and

    \[N(x,y) = 2xy - e^{-2y}. \nonumber \]

    Now calculate

    \[ M_y = 1 \;\;\; \text{and} \;\;\; N_x = 2y. \nonumber \]

    Since they are not equal, finding a potential function \(f\) is hopeless. However there is a glimmer of hope if we remember how we solved first order linear differential equations. We multiplied both sides by an integrating factor \(m\). We do that here to get

    \[ mM + mN_y' = 0 .\nonumber \]

    For this to be exact we must have

    \[ (mM)_y = (mN)_x . \nonumber \]

    Using the product rule gives

    \[ m_yM + mM_y = m_xN + mN_x . \nonumber \]

    We now have a new differential equation that is unfortunately more difficult to solve than the original differential equation. We simplify the equation by assuming that either m is a function of only \(x\) or only \(y\). If it is a function of only \(x\), then \( m_y = 0 \) and

    \[ mM_y = m_xN + mN_x .\nonumber \]

    Solving for \(m_x\), we get

    \[ m_x = \dfrac{M_y-N_x}{N}. \nonumber \]

    If this is a function of \(y\) only, then we will be able to find an integrating factor that involves \(y\) only. If it is a function of only \(y\), then \( m_x = 0\) and

    \[ m_yM + mM_y = mN_x . \nonumber \]

    Solving for \(m_y\), we get

    \[ m_y = \dfrac{N_x-M_y}{M} m .\nonumber \]

    If this is a function of \(y\) only, then we will be able to find an integrating factor that involves \(y\) only.

    For our example

    \[ m_y = \dfrac{N_x - M_y }{M} m = \dfrac{2y-1}{y} m = (2-\frac{1}{y})m .\nonumber \]

    Separating gives

    \[ \dfrac{dm}{m} = (2-\frac{1}{y}) \,dy. \nonumber \]

    Integrating gives

    \[ ln \, m = 2y - ln\, y. \nonumber \]

    \[ m = e^{2y - ln\, y} = y ^{-1}e^{2y}. \nonumber \]

    Multiplying both sides of the original differential equation by \(m\) gives

    \[ y(y ^{-1}e^{2y}) + (y ^{-1}e^{2y})(2xy - e^{-2y})y' = 0 \nonumber \]

    \[ \implies e^{2y} + (2xe^{2y} - \frac{1}{y})y' = 0 . \nonumber \]

    Now we see that

    \[ M_y = 2e^{2y} = N_x. \nonumber \]

    Which tells us that the differential equation is exact. We therefore have

    \[ f_x (x,y) = e^{2y}. \nonumber \]

    Integrating with respect to \(x\) gives

    \[ f(x,y) = xe^{2y} + C(y). \nonumber \]

    Now taking the partial derivative with respect to \(y\) gives

    \[ f_y(x,y) = 2xe^{2y} + C'(y) = 2xe^{2y} - \frac{1}{y} .\nonumber \]

    So that

    \[ C'(y) = \frac{1}{y}. \nonumber \]

    Integrating gives

    \[ C(y) = ln\, y. \nonumber \]

    The final solution is

    \[ xe^{2y} + ln\, y = 0. \nonumber \]

    Contributors and Attributions


    This page titled 2.7: Exact Differential Equations is shared under a not declared license and was authored, remixed, and/or curated by Larry Green.