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=0M(x,y),dx + N(x,y),dy = 0 that come from differentiating a single hidden function F(x,y)F(x,y). The equation is exact exactly when ∂M∂y=∂N∂x\dfrac{\partial M}{\partial y} = \dfrac{\partial N}{\partial x}, and when it is, there is a potential FF with Fx=MF_x = M and Fy=NF_y = N, so the whole solution is the family of level curves F(x,y)=CF(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=0M(x,y),dx + N(x,y),dy = 0

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

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

If the equation matches this pattern, meaning M=∂F∂xM = \dfrac{\partial F}{\partial x} and N=∂F∂yN = \dfrac{\partial F}{\partial y} for some potential function FF, then the equation is simply dF=0dF = 0. A quantity whose differential is zero does not change, so F(x,y)=CF(x,y) = C for a constant CC. 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 dFdF. So the first job is a test that decides, before any integrating, whether a hidden FF exists at all.

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

The reason the test works is the equality of mixed partial derivatives. If FF exists, then My=FxyM_y = F_{xy} and Nx=FyxN_x = F_{yx}, and for a well-behaved FF those two mixed partials are equal. So My=NxM_y = N_x is forced. The converse (that the condition is enough to build FF) 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)M(x,y) as everything multiplying dxdx, read off N(x,y)N(x,y) as everything multiplying dydy, then compare two partial derivatives.

  • Differentiate MM with respect to yy, treating xx as a constant, to get ∂M∂y\dfrac{\partial M}{\partial y}.

  • Differentiate NN with respect to xx, treating yy as a constant, to get ∂N∂x\dfrac{\partial N}{\partial x}.

  • If the two match, the equation is exact and a potential FF 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 FF from its two partial derivatives. The reliable route integrates MM with respect to xx, then uses NN to pin down the part that integration missed.

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

  2. Differentiate that FF with respect to yy. This produces FyF_y in terms of xx, yy, and the unknown g′(y)g'(y).

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

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

The geometry keeps the algebra honest: FF is a surface sitting above the xyxy-plane, and F(x,y)=CF(x,y) = C are its contour lines. The differential form M,dx+N,dyM,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+(x2−1),dy=0(2xy + 3),dx + (x^2 - 1),dy = 0.

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

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

They agree, so the equation is exact and a potential FF exists. Integrate MM with respect to xx, holding yy fixed:

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

Differentiate this FF with respect to yy and set it equal to NN:

∂F∂y=x2+g′(y)=x2−1.\frac{\partial F}{\partial y} = x^2 + g'(y) = x^2 - 1.

The x2x^2 terms cancel, leaving g′(y)=−1g'(y) = -1, so g(y)=−yg(y) = -y. Assemble FF and set it to a constant:

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

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

Final answer: x2y+3x−y=Cx^2 y + 3x - y = C.

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

Here M=ycos⁡x+2xeyM = y\cos x + 2x e^{y} and N=sin⁡x+x2ey−1N = \sin x + x^2 e^{y} - 1. Test for exactness:

∂M∂y=cos⁡x+2xey,∂N∂x=cos⁡x+2xey.\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 MM with respect to xx:

F(x,y)=∫(ycos⁡x+2xey)dx=ysin⁡x+x2ey+g(y).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 yy and match NN:

∂F∂y=sin⁡x+x2ey+g′(y)=sin⁡x+x2ey−1.\frac{\partial F}{\partial y} = \sin x + x^2 e^{y} + g'(y) = \sin x + x^2 e^{y} - 1.

Everything in xx cancels, leaving g′(y)=−1g'(y) = -1, so g(y)=−yg(y) = -y. The solution is:

F(x,y)=ysin⁡x+x2ey−y=C.F(x,y) = y\sin x + x^2 e^{y} - y = C.

Verify: ∂F∂x=ycos⁡x+2xey=M\dfrac{\partial F}{\partial x} = y\cos x + 2x e^{y} = M and ∂F∂y=sin⁡x+x2ey−1=N\dfrac{\partial F}{\partial y} = \sin x + x^2 e^{y} - 1 = N. Both check out.

Final answer: ysin⁡x+x2ey−y=Cy\sin x + x^2 e^{y} - y = C.

What If The Equation Is Not Exact? Integrating Factors

Most differential forms fail the test. When ∂M∂y≠∂N∂x\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 μ(x,y)\mu(x,y) called an integrating factor. After multiplying, μM,dx+μN,dy=0\mu M,dx + \mu N,dy = 0 is exact, and the same potential-function method applies.

Two shortcuts cover most textbook cases:

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

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

The integrating-factor method is also the engine behind solving a first-order linear differential equation, where the factor μ(x)=e∫P(x),dx\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)(M, N) is a gradient. Saying M=FxM = F_x and N=FyN = F_y is saying that the vector field (M,N)(M, N) is the gradient ∇F\nabla F of some scalar FF. A field that is a gradient is called conservative, and the exactness test My=NxM_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=0dF = M,dx + N,dy = 0, so FF never changes. Curves of constant FF are its level curves, which is why the answer always takes the shape F(x,y)=CF(x,y) = C rather than an isolated formula for yy.

  • The g(y)g(y) term is not optional. Integrating MM in xx recovers every xx-dependence of FF but is blind to any part of FF that depends on yy alone. That missing piece is g(y)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 My=NxM_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 FF 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 MM and building FF without first comparing ∂M/∂y\partial M / \partial y and ∂N/∂x\partial N / \partial x.

Don't do this:

Do not assume the equation is exact. If My≠NxM_y \neq N_x, no potential FF exists, and the whole method produces a contradiction at step 3.

The correct way:

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

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

Where it slips in:

After integrating MM with respect to xx, a student adds a numerical constant +C+C instead of the unknown function g(y)g(y), so the yy-only part of FF is lost.

Don't do this:

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

The correct way:

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

Mixing up which variable to integrate.

Where it slips in:

A student integrates MM with respect to yy, or integrates NN with respect to xx, crossing the two roles.

Don't do this:

Do not integrate against the wrong variable. Since Fx=MF_x = M, the term MM is integrated in xx; since Fy=NF_y = N, the matching partial is taken in yy.

The correct way:

Keep the pairing fixed: integrate MM with respect to xx to build FF, then differentiate that FF with respect to yy and set it equal to NN. Starting from NN instead is valid too, but then you integrate NN in yy and match MM; 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 (3x2+4xy),dx+(2x2+2y),dy=0(3x^2 + 4xy),dx + (2x^2 + 2y),dy = 0.
    (Answer: My=4x=NxM_y = 4x = N_x, exact; x3+2x2y+y2=Cx^3 + 2x^2 y + y^2 = C.)

  2. Solve (2x+y),dx+(x−3y2),dy=0(2x + y),dx + (x - 3y^2),dy = 0.
    (Answer: My=1=NxM_y = 1 = N_x, exact; x2+xy−y3=Cx^2 + xy - y^3 = C.)

  3. Solve (y2+1),dx+2xy,dy=0(y^2 + 1),dx + 2xy,dy = 0.
    (Answer: My=2y=NxM_y = 2y = N_x, exact; xy2+x=Cxy^2 + x = C.)

  4. Solve cos⁡y,dx−xsin⁡y,dy=0\cos y,dx - x\sin y,dy = 0.
    (Answer: My=−sin⁡y=NxM_y = -\sin y = N_x, exact; xcos⁡y=Cx\cos y = C.)

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

  6. Solve ey,dx+(xey+2y),dy=0e^{y},dx + (x e^{y} + 2y),dy = 0.
    (Answer: My=ey=NxM_y = e^{y} = N_x, exact; xey+y2=Cx 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.

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=0M(x,y),dx + N(x,y),dy = 0 that equal the total differential dFdF of a single function F(x,y)F(x,y). Because dF=0dF = 0 along any solution, the answer is the family of level curves F(x,y)=CF(x,y) = C.
How do you know if a differential equation is exact?
Compare two partial derivatives. Write MM as the coefficient of dxdx and NN as the coefficient of dydy; the equation is exact if and only if ∂M/∂y=∂N/∂x\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)F(x,y) whose partial derivatives are Fx=MF_x = M and Fy=NF_y = N. Reconstructing FF and setting F(x,y)=CF(x,y) = C gives the general solution, so finding the potential is the entire task.
Why is the constant of integration a function of yy?
Because you integrate MM with respect to xx while holding yy fixed. Any term depending on yy alone has zero derivative with respect to xx, so the integration cannot see it; that hidden term is the function g(y)g(y), recovered later by matching NN.
What is the difference between exact and separable differential equations?
A separable differential equation splits into a pure xx part and a pure yy part that you integrate separately. An exact equation need not separate; it is solved by reconstructing one potential FF from the mixed coefficients MM and NN.
Can a non-exact equation be made exact?
Yes. Multiplying by an integrating factor μ(x,y)\mu(x,y) can restore exactness. When (My−Nx)/N(M_y - N_x)/N depends on xx alone, an xx-only factor exists; when (Nx−My)/M(N_x - M_y)/M depends on yy alone, a yy-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 →