Exact Differential Equations

April 13, 2026

Problem

Verify that (2xy + 3) dx + (x^2 + 4y) dy = 0 is exact, then find the potential function F(x, y) so that dF = 0 along every solution.

Explanation

What does "exact" mean?

Write a first-order ODE in differential form: M(x,y)dx+N(x,y)dy=0M(x, y) \, dx + N(x, y) \, dy = 0

It is exact if its left side is the total differential of some scalar function F(x,y)F(x, y) — that is, there is a "potential" FF with dF=Fxdx+Fydy=Mdx+NdydF = \frac{\partial F}{\partial x} dx + \frac{\partial F}{\partial y} dy = M \, dx + N \, dy

When that happens, the ODE reduces to dF=0dF = 0, so solutions are simply the level curves F(x,y)=C.F(x, y) = C.

No integration by separation, no integrating factor — the work is already done, you just have to discover FF.

The exactness test

If FF exists, then M=FxM = F_x and N=FyN = F_y. Equality of mixed partials (Fxy=FyxF_{xy} = F_{yx}) forces My=Nx\boxed{\, \frac{\partial M}{\partial y} = \frac{\partial N}{\partial x} \,}

This is both necessary and (on a simply connected domain) sufficient. Check it first — if it fails, the equation is not exact and you need an integrating factor.

The given equation

(2xy+3)dx+(x2+4y)dy=0(2xy + 3) \, dx + (x^{2} + 4y) \, dy = 0

So M(x,y)=2xy+3M(x, y) = 2xy + 3 and N(x,y)=x2+4yN(x, y) = x^{2} + 4y.

Step 1 — Test for exactness

My=y(2xy+3)=2x\frac{\partial M}{\partial y} = \frac{\partial}{\partial y}(2xy + 3) = 2x Nx=x(x2+4y)=2x\frac{\partial N}{\partial x} = \frac{\partial}{\partial x}(x^{2} + 4y) = 2x

Equal. The equation is exact. ✓

Step 2 — Recover FF by integrating MM with respect to xx

Since Fx=M=2xy+3F_x = M = 2xy + 3, integrate with respect to xx (treating yy as a constant): F(x,y)=(2xy+3)dx=x2y+3x+g(y)F(x, y) = \int (2xy + 3) \, dx = x^{2} y + 3x + g(y)

The "constant" of integration is actually a function g(y)g(y) because yy was held fixed — any term depending only on yy would vanish under /x\partial/\partial x.

Step 3 — Determine g(y)g(y) by matching Fy=NF_y = N

Differentiate FF with respect to yy: Fy=y[x2y+3x+g(y)]=x2+g(y)F_y = \frac{\partial}{\partial y}\bigl[x^{2} y + 3x + g(y)\bigr] = x^{2} + g'(y)

This must equal N=x2+4yN = x^{2} + 4y: x2+g(y)=x2+4y    g(y)=4yx^{2} + g'(y) = x^{2} + 4y \implies g'(y) = 4y g(y)=2y2g(y) = 2 y^{2}

(Constant of integration can be absorbed into the level-curve constant CC at the end.)

Step 4 — Assemble FF and write the solution

F(x,y)=x2y+3x+2y2F(x, y) = x^{2} y + 3x + 2 y^{2}

Every solution satisfies the implicit equation x2y+3x+2y2=C\boxed{\, x^{2} y + 3x + 2 y^{2} = C \,}

This is a one-parameter family of level curves.

Verification

Fx=2xy+3=M\frac{\partial F}{\partial x} = 2xy + 3 = M \quad\checkmark Fy=x2+4y=N\frac{\partial F}{\partial y} = x^{2} + 4y = N \quad\checkmark

Or, take the total derivative along a solution curve: dF=(2xy+3)dx+(x2+4y)dy=0dF = (2xy + 3)\, dx + (x^{2} + 4y)\, dy = 0 \quad\checkmark

An alternative route — integrate NN with respect to yy instead

Equally valid and sometimes easier when NN is simpler than MM: F=Ndy=(x2+4y)dy=x2y+2y2+h(x)F = \int N \, dy = \int (x^{2} + 4y) \, dy = x^{2} y + 2 y^{2} + h(x) Match Fx=MF_x = M:   2xy+h(x)=2xy+3    h(x)=3    h(x)=3x\; 2xy + h'(x) = 2xy + 3 \implies h'(x) = 3 \implies h(x) = 3x. So F=x2y+2y2+3xF = x^{2} y + 2 y^{2} + 3x — the same answer.

Initial value problem

If y(1)=0y(1) = 0, plug in to get CC: 120+31+202=3    C=31^{2} \cdot 0 + 3 \cdot 1 + 2 \cdot 0^{2} = 3 \implies C = 3 x2y+3x+2y2=3x^{2} y + 3x + 2 y^{2} = 3

You usually cannot solve for yy explicitly — implicit form is often the final answer for exact equations.

When the test fails — integrating factor for exactness

If MyNxM_y \ne N_x, look for μ(x)\mu(x) or μ(y)\mu(y) making μMdx+μNdy=0\mu M \, dx + \mu N \, dy = 0 exact:

  • MyNxN\dfrac{M_y - N_x}{N} depends on xx only     \implies μ=μ(x)\mu = \mu(x), satisfying μ/μ=(MyNx)/N\mu' / \mu = (M_y - N_x)/N.
  • NxMyM\dfrac{N_x - M_y}{M} depends on yy only     \implies μ=μ(y)\mu = \mu(y).

Geometric picture

Think of F(x,y)F(x, y) as a height function. The ODE dF=0dF = 0 says solutions stay at constant height — they are contour lines of the surface. The differential form Mdx+NdyM \, dx + N \, dy is the gradient's action, and exactness says that form is conservative.

Common mistakes

  • Skipping the exactness test. If MyNxM_y \ne N_x the potential doesn't exist and every step below is nonsense.
  • Treating gg as a constant instead of a function of yy when integrating MM with respect to xx. The whole method hinges on keeping the "constant" general enough to depend on the other variable.
  • Double-counting terms that appear in both integrations. When you integrate MM w.r.t. xx you've already captured all terms with an xx in them; when you then compute FyF_y and compare with NN, only the pure-yy terms should remain to determine g(y)g'(y).
  • Forgetting the = C. The answer is an implicit family, not a function.

Try it in the visualization

Draw the level curves F(x,y)=CF(x, y) = C as contour lines, with the vector field (M,N)(M, N) shown as arrows. Watch that the arrows stay tangent to the level curves — that's the exactness condition visualized.

Interactive Visualization

Parameters

3.00
4.00
4.00
8.00
1.00
1.00
tangent (flow)
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Exact Differential Equations | MathSpin