Exact Differential Equations: Test, Solve, Examples

#Calculus
TL;DR
Exact Differential Equations are first-order equations of the form $M(x,y),dx + N(x,y),dy = 0$ that come from differentiating a single hidden function $F(x,y)$. The equation is exact exactly when $\dfrac{\partial M}{\partial y} = \dfrac{\partial N}{\partial x}$, and when it is, there is a potential $F$ with $F_x = M$ and $F_y = N$, so the whole solution is the family of level curves $F(x,y) = C$.
BT
Bhanzu TeamLast updated on September 28, 202611 min read

What Are Exact Differential Equations?

Exact Differential Equations are first-order equations written in the differential form

$$M(x,y),dx + N(x,y),dy = 0$$

that arise as the total differential of one function $F(x,y)$. Recall that the total differential of $F$ is

$$dF = \frac{\partial F}{\partial x},dx + \frac{\partial F}{\partial y},dy.$$

If the equation matches this pattern, meaning $M = \dfrac{\partial F}{\partial x}$ and $N = \dfrac{\partial F}{\partial y}$ for some potential function $F$, then the equation is simply $dF = 0$. A quantity whose differential is zero does not change, so $F(x,y) = C$ for a constant $C$. That constant family of level curves is the general solution.

The catch is that most equations you meet are not handed to you as a tidy $dF$. So the first job is a test that decides, before any integrating, whether a hidden $F$ exists at all.

The exactness test. Assuming $M$ and $N$ have continuous first partial derivatives on a rectangle, the equation $M,dx + N,dy = 0$ is exact if and only if $$\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}.$$

The reason the test works is the equality of mixed partial derivatives. If $F$ exists, then $M_y = F_{xy}$ and $N_x = F_{yx}$, and for a well-behaved $F$ those two mixed partials are equal. So $M_y = N_x$ is forced. The converse (that the condition is enough to build $F$) holds on any simply connected region and is the practical half you will use.

How Do You Test Whether An Equation Is Exact?

Testing is mechanical and takes one line. Read off $M(x,y)$ as everything multiplying $dx$, read off $N(x,y)$ as everything multiplying $dy$, then compare two partial derivatives.

  • Differentiate $M$ with respect to $y$, treating $x$ as a constant, to get $\dfrac{\partial M}{\partial y}$.

  • Differentiate $N$ with respect to $x$, treating $y$ as a constant, to get $\dfrac{\partial N}{\partial x}$.

  • If the two match, the equation is exact and a potential $F$ exists. If they differ, it is not exact, and you either look for an integrating factor or use another method entirely.

Do this test first, every time. Skipping it is the most common way students lose the whole problem, because the potential-function method below only works once exactness is confirmed.

How Do You Solve An Exact Differential Equation?

Once the test passes, you reconstruct the hidden $F$ from its two partial derivatives. The reliable route integrates $M$ with respect to $x$, then uses $N$ to pin down the part that integration missed.

  1. Integrate $M$ with respect to $x$. Because $F_x = M$, integrate $M$ in $x$ while holding $y$ fixed. The "constant" of this integration is not a number; it is an unknown function $g(y)$, since any function of $y$ alone has zero $x$-derivative. This gives $F(x,y) = \displaystyle\int M,dx + g(y)$.

  2. Differentiate that $F$ with respect to $y$. This produces $F_y$ in terms of $x$, $y$, and the unknown $g'(y)$.

  3. Match $F_y$ to $N$. Set the expression from step 2 equal to $N(x,y)$. The $x$-terms cancel, leaving a plain equation for $g'(y)$ in $y$ only.

  4. Integrate $g'(y)$ to recover $g(y)$, then write the solution as $F(x,y) = C$.

The geometry keeps the algebra honest: $F$ is a surface sitting above the $xy$-plane, and $F(x,y) = C$ are its contour lines. The differential form $M,dx + N,dy$ is the gradient of that surface written out, so an exact equation is exactly the statement "move along a direction that keeps height constant." The solution curves are the contours, the same picture as walking a hillside without going up or down.

What Is A Worked Example Of An Exact Differential Equation?

Example 1: Solve $(2xy + 3),dx + (x^2 - 1),dy = 0$.

Read off $M = 2xy + 3$ and $N = x^2 - 1$. Test for exactness:

$$\frac{\partial M}{\partial y} = 2x, \qquad \frac{\partial N}{\partial x} = 2x.$$

They agree, so the equation is exact and a potential $F$ exists. Integrate $M$ with respect to $x$, holding $y$ fixed:

$$F(x,y) = \int (2xy + 3),dx = x^2 y + 3x + g(y).$$

Differentiate this $F$ with respect to $y$ and set it equal to $N$:

$$\frac{\partial F}{\partial y} = x^2 + g'(y) = x^2 - 1.$$

The $x^2$ terms cancel, leaving $g'(y) = -1$, so $g(y) = -y$. Assemble $F$ and set it to a constant:

$$F(x,y) = x^2 y + 3x - y = C.$$

Verify by back-substitution: $\dfrac{\partial F}{\partial x} = 2xy + 3 = M$ and $\dfrac{\partial F}{\partial y} = x^2 - 1 = N$. Both partials return the original coefficients, so the potential is correct.

Final answer: $x^2 y + 3x - y = C$.

Example 2: Solve $\left(y\cos x + 2x e^{y}\right)dx + \left(\sin x + x^2 e^{y} - 1\right)dy = 0$.

Here $M = y\cos x + 2x e^{y}$ and $N = \sin x + x^2 e^{y} - 1$. Test for exactness:

$$\frac{\partial M}{\partial y} = \cos x + 2x e^{y}, \qquad \frac{\partial N}{\partial x} = \cos x + 2x e^{y}.$$

They match, so the equation is exact. Integrate $M$ with respect to $x$:

$$F(x,y) = \int \left(y\cos x + 2x e^{y}\right)dx = y\sin x + x^2 e^{y} + g(y).$$

Differentiate with respect to $y$ and match $N$:

$$\frac{\partial F}{\partial y} = \sin x + x^2 e^{y} + g'(y) = \sin x + x^2 e^{y} - 1.$$

Everything in $x$ cancels, leaving $g'(y) = -1$, so $g(y) = -y$. The solution is:

$$F(x,y) = y\sin x + x^2 e^{y} - y = C.$$

Verify: $\dfrac{\partial F}{\partial x} = y\cos x + 2x e^{y} = M$ and $\dfrac{\partial F}{\partial y} = \sin x + x^2 e^{y} - 1 = N$. Both check out.

Final answer: $y\sin x + x^2 e^{y} - y = C$.

What If The Equation Is Not Exact? Integrating Factors

Most differential forms fail the test. When $\dfrac{\partial M}{\partial y} \neq \dfrac{\partial N}{\partial x}$, the equation is not exact as written, but it can often be made exact by multiplying through by a well-chosen function $\mu(x,y)$ called an integrating factor. After multiplying, $\mu M,dx + \mu N,dy = 0$ is exact, and the same potential-function method applies.

Two shortcuts cover most textbook cases:

  • If $\dfrac{M_y - N_x}{N}$ is a function of $x$ alone, then $\mu$ depends only on $x$, and $\mu(x) = \exp\left(\displaystyle\int \frac{M_y - N_x}{N},dx\right)$.

  • If $\dfrac{N_x - M_y}{M}$ is a function of $y$ alone, then $\mu$ depends only on $y$, found by the matching integral in $y$.

The integrating-factor method is also the engine behind solving a first-order linear differential equation, where the factor $\mu(x) = e^{\int P(x),dx}$ turns the equation into an exact one you can integrate directly.

Why Do Exact Differential Equations Work?

The method can feel like a lucky trick the first time. It is not; it is vector calculus in disguise.

  • The pair $(M, N)$ is a gradient. Saying $M = F_x$ and $N = F_y$ is saying that the vector field $(M, N)$ is the gradient $\nabla F$ of some scalar $F$. A field that is a gradient is called conservative, and the exactness test $M_y = N_x$ is precisely the condition for a field to be conservative on a simply connected region.

  • The solution rides the level curves. Along any solution, $dF = M,dx + N,dy = 0$, so $F$ never changes. Curves of constant $F$ are its level curves, which is why the answer always takes the shape $F(x,y) = C$ rather than an isolated formula for $y$.

  • The $g(y)$ term is not optional. Integrating $M$ in $x$ recovers every $x$-dependence of $F$ but is blind to any part of $F$ that depends on $y$ alone. That missing piece is $g(y)$, and step 3 is the only place it gets restored. Drop it and the potential is wrong.

Seen this way, an exact equation and a conservative field are the same object. Physics students meet the identical idea as potential energy: a force is conservative when it is the gradient of a potential, and the exactness condition is the mathematical fingerprint of that fact.

Who Discovered Exact Differential Equations?

The exactness condition arrived in the same decade from two of the eighteenth century's most productive mathematicians, working the young subject of differential equations into a system of rules.

Two named figures anchor the story:

  • Alexis Claude Clairaut (1713–1765, France) stated the exactness condition while integrating the differential equations of celestial mechanics and geodesy.

  • Leonhard Euler (1707–1783, Switzerland) arrived at the same criterion independently and made integrating factors a general tool, extending the reach of the method to equations that are not exact on sight.

Where Are Exact Differential Equations Used In The Real World?

Because an exact equation is a conservative field with a potential, it appears wherever a system is governed by a quantity that depends only on state, not on the path taken to reach it.

  • Thermodynamics: state functions such as internal energy and entropy have exact differentials, and the test $M_y = N_x$ is how engineers decide whether a proposed quantity is a genuine state function or a path-dependent one like heat.

  • Mechanics and potential energy: a conservative force is the gradient of a potential, so the work it does is path-independent, and the exactness condition is the check that a force field has a potential at all.

  • Fluid flow and electrostatics: velocity potentials and electric potentials are the $F$ of an exact form, and the field lines are the gradients crossing the level curves at right angles.

  • Economics: when a marginal-cost or utility relationship is path-independent, it is modelled by an exact form whose potential recovers the underlying cost or utility surface.

One test decides whether a two-variable rate law hides a single governing quantity, which is why the same criterion turns up across heat, force, flow, and price.

What Are The Most Common Mistakes With Exact Differential Equations?

These three errors account for most lost marks, and each matches a question real students ask on r/learnmath and in course common-error handouts from Purdue, Johns Hopkins, and Michigan State.

Not checking exactness before solving.

Where it slips in:

A student jumps straight to integrating $M$ and building $F$ without first comparing $\partial M / \partial y$ and $\partial N / \partial x$.

Don't do this:

Do not assume the equation is exact. If $M_y \neq N_x$, no potential $F$ exists, and the whole method produces a contradiction at step 3.

The correct way:

Compute $\partial M / \partial y$ and $\partial N / \partial x$ first and confirm they are equal. Only then reconstruct $F$; if they differ, reach for an integrating factor instead.

Forgetting the $y$-only function $g(y)$.

Where it slips in:

After integrating $M$ with respect to $x$, a student adds a numerical constant $+C$ instead of the unknown function $g(y)$, so the $y$-only part of $F$ is lost.

Don't do this:

Do not treat the constant of a partial integration as a number. Any function of $y$ alone vanishes under $\partial / \partial x$, so the "constant" can be a full function $g(y)$.

The correct way:

Write $F = \int M,dx + g(y)$, then recover $g(y)$ by matching $\partial F / \partial y$ to $N$. In Example 1 this step is what produced the $-y$ term.

Mixing up which variable to integrate.

Where it slips in:

A student integrates $M$ with respect to $y$, or integrates $N$ with respect to $x$, crossing the two roles.

Don't do this:

Do not integrate against the wrong variable. Since $F_x = M$, the term $M$ is integrated in $x$; since $F_y = N$, the matching partial is taken in $y$.

The correct way:

Keep the pairing fixed: integrate $M$ with respect to $x$ to build $F$, then differentiate that $F$ with respect to $y$ and set it equal to $N$. Starting from $N$ instead is valid too, but then you integrate $N$ in $y$ and match $M$; never split the pairing.

Practice Problems On Exact Differential Equations

Test each for exactness first, then solve. Answers are verified by back-substitution.

  1. Solve $(3x^2 + 4xy),dx + (2x^2 + 2y),dy = 0$.
    (Answer: $M_y = 4x = N_x$, exact; $x^3 + 2x^2 y + y^2 = C$.)

  2. Solve $(2x + y),dx + (x - 3y^2),dy = 0$.
    (Answer: $M_y = 1 = N_x$, exact; $x^2 + xy - y^3 = C$.)

  3. Solve $(y^2 + 1),dx + 2xy,dy = 0$.
    (Answer: $M_y = 2y = N_x$, exact; $xy^2 + x = C$.)

  4. Solve $\cos y,dx - x\sin y,dy = 0$.
    (Answer: $M_y = -\sin y = N_x$, exact; $x\cos y = C$.)

  5. Is $y,dx + x^2,dy = 0$ exact?
    (Answer: $M_y = 1$ but $N_x = 2x$, so not exact; it needs an integrating factor.)

  6. Solve $e^{y},dx + (x e^{y} + 2y),dy = 0$.
    (Answer: $M_y = e^{y} = N_x$, exact; $x e^{y} + y^2 = C$.)

Where Should You Go Next After Exact Differential Equations?

Exact equations sit in the middle of the first-order toolkit, and several natural doors open from here.

  1. Integrating-factor method. The direct sequel: how to rescue an equation that fails the exactness test by multiplying it into an exact one.

  2. Separable differential equations. The simplest first-order type, and the one exact methods generalise.

  3. Ordinary differential equations. Step back to see where exact equations fit among first-order and higher-order ODEs.

If your child is meeting Exact Differential Equations for the first time, a live Bhanzu trainer teaches the exactness test and the potential-function method from the conservative-field picture up, in the Bhanzu math program.

Book a Free Demo

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What are Exact Differential Equations?
They are first-order equations of the form $M(x,y),dx + N(x,y),dy = 0$ that equal the total differential $dF$ of a single function $F(x,y)$. Because $dF = 0$ along any solution, the answer is the family of level curves $F(x,y) = C$.
How do you know if a differential equation is exact?
Compare two partial derivatives. Write $M$ as the coefficient of $dx$ and $N$ as the coefficient of $dy$; the equation is exact if and only if $\partial M / \partial y = \partial N / \partial x$, assuming both have continuous first partials on a rectangle.
What is the potential function in Exact Differential Equations?
It is the function $F(x,y)$ whose partial derivatives are $F_x = M$ and $F_y = N$. Reconstructing $F$ and setting $F(x,y) = C$ gives the general solution, so finding the potential is the entire task.
Why is the constant of integration a function of $y$?
Because you integrate $M$ with respect to $x$ while holding $y$ fixed. Any term depending on $y$ alone has zero derivative with respect to $x$, so the integration cannot see it; that hidden term is the function $g(y)$, recovered later by matching $N$.
What is the difference between exact and separable differential equations?
A separable differential equation splits into a pure $x$ part and a pure $y$ part that you integrate separately. An exact equation need not separate; it is solved by reconstructing one potential $F$ from the mixed coefficients $M$ and $N$.
Can a non-exact equation be made exact?
Yes. Multiplying by an integrating factor $\mu(x,y)$ can restore exactness. When $(M_y - N_x)/N$ depends on $x$ alone, an $x$-only factor exists; when $(N_x - M_y)/M$ depends on $y$ alone, a $y$-only factor works.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →