How to Solve Exact Differential Equations Step by Step

Solving an exact differential equation comes down to finding a single function whose partial derivatives match the two pieces of your equation. Once you find that function, the solution is just setting it equal to a constant. The process is systematic: check one condition, do two integrations, and you’re done.

What Makes an Equation Exact

An exact differential equation has the form M(x,y) + N(x,y) dy/dx = 0, where M and N are functions of x and y. The equation is “exact” when there exists some function Ψ(x,y) whose partial derivative with respect to x equals M and whose partial derivative with respect to y equals N. If such a function exists, the entire equation is really just saying dΨ = 0, which means Ψ(x,y) = C for some constant. That’s your solution.

The test for exactness is straightforward: take the partial derivative of M with respect to y and the partial derivative of N with respect to x. If they’re equal, the equation is exact. This works because of the symmetry of mixed partial derivatives. If Ψ exists and its derivatives are continuous, then differentiating Ψ first by x then by y gives the same result as differentiating first by y then by x.

For example, if your equation has M = 2y and N = 2x, you compute ∂M/∂y = 2 and ∂N/∂x = 2. They match, so the equation is exact.

The Solution Method, Step by Step

Once you’ve confirmed the equation is exact, you need to reconstruct the function Ψ(x,y). You have two relationships to work with: ∂Ψ/∂x = M and ∂Ψ/∂y = N. You’ll use one to build most of Ψ, then use the other to fill in what’s missing.

Step 1: Integrate M With Respect to x

Start by integrating M(x,y) with respect to x. This gives you Ψ(x,y) up to an unknown piece. The key detail: your “constant” of integration isn’t a plain constant. Since you’re integrating with respect to x while y is floating around as another variable, anything that depends purely on y would vanish during partial differentiation with respect to x. So your constant of integration is actually an unknown function h(y).

As a concrete example, suppose M(x,y) = 2xy − 9x² and N(x,y) = x² + 2y + 1. Integrating M with respect to x gives Ψ(x,y) = x²y − 3x³ + h(y).

Step 2: Find h(y) Using N

Now differentiate your partial result for Ψ with respect to y. This must equal N(x,y), because ∂Ψ/∂y = N is the second condition that defines exactness. Set them equal and solve for h'(y).

Continuing the example: differentiating Ψ = x²y − 3x³ + h(y) with respect to y gives x² + h'(y). Setting this equal to N = x² + 2y + 1, you get h'(y) = 2y + 1. Integrate to find h(y) = y² + y. You can drop the extra constant of integration here since it’ll be absorbed into the final constant C.

Step 3: Write the Solution

Plug h(y) back into Ψ to get the complete function. In the example, Ψ(x,y) = x²y − 3x³ + y² + y. The implicit solution to the differential equation is then x²y − 3x³ + y² + y = C.

You Can Start With N Instead

Nothing forces you to begin by integrating M with respect to x. You can just as well integrate N with respect to y first. That gives you Ψ(x,y) = ∫N dy + h(x), where the unknown function now depends on x instead of y. Then you differentiate with respect to x, set the result equal to M, and solve for h(x).

Both paths lead to the same Ψ. The practical advice: look at M and N before choosing, and pick whichever one will be easier to integrate. If N is a simpler function of y than M is of x, start with N.

Solving With Initial Conditions

If the problem gives you an initial condition like y(x₀) = y₀, you can pin down the constant C. Once you have Ψ(x,y) = C, substitute in x₀ and y₀ to compute C directly.

For instance, if your solution is x² + xy² = C and the initial condition is y(1) = 1, plug in x = 1 and y = 1 to get 1 + 1 = 2, so C = 2. The particular solution is x² + xy² = 2.

When the Equation Isn’t Exact

If ∂M/∂y and ∂N/∂x aren’t equal, the equation isn’t exact as written. But you may be able to multiply the entire equation by an integrating factor that forces exactness. Two standard formulas cover the most common cases:

  • Integrating factor depending only on x: Compute (∂M/∂y − ∂N/∂x) / N. If this expression depends only on x (no y terms survive), then μ(x) = e^(∫ that expression dx) is your integrating factor.
  • Integrating factor depending only on y: Compute (∂N/∂x − ∂M/∂y) / M. If this depends only on y, then μ(y) = e^(∫ that expression dy) works.

Multiply the original M and N by the integrating factor, and the resulting equation will be exact. Then solve it using the same steps above. Note that neither formula is guaranteed to produce a clean result. If the expression you compute still depends on both x and y, these simple integrating factors won’t work, and more advanced techniques are needed.

Why This Method Works

If you’ve taken multivariable calculus, exact equations will look familiar. The function Ψ(x,y) is essentially a potential function, and the pair (M, N) acts like a conservative vector field in the plane. The exactness condition ∂M/∂y = ∂N/∂x is the same test you’d use to check whether a vector field is conservative. The solution Ψ(x,y) = C describes level curves of that potential function, and every solution curve of the differential equation lies along one of those level curves.

This same structure appears in thermodynamics, where state functions like internal energy and entropy have exact differentials. The fact that a state function’s value depends only on the current state (not on the path taken to reach it) is mathematically identical to the path-independence property that defines exact differentials. When a differential is exact, integrating it between two points gives the same answer regardless of the route, which is why the exactness test matters in physics as well as in pure math.