Write a first-order ODE in differential form, treating
x and y on equal footing:
M(x, y)\,dx + N(x, y)\,dy = 0.
The dream is that the whole left side is secretly the total differential of some single function
F(x, y). If so, the equation reads dF = 0, and
a quantity whose differential is zero is constant — so the solution is simply the level
curves
F(x, y) = C.
When this happens the equation is called exact. The questions are: how do we
recognise exactness, and how do we reconstruct the hidden potential
F? Both answers come from the
partial derivatives
of F.
The exactness test, and where it comes from
Recall the total differential: if F(x,y) has partials
F_x and F_y, then
dF = F_x\,dx + F_y\,dy.
Matching this against M\,dx + N\,dy, the equation is exact precisely when
there is an F with
F_x = M \qquad\text{and}\qquad F_y = N.
The test. Suppose such an F exists and is smooth. Then by
Clairaut's theorem the mixed second partials agree,
F_{xy} = F_{yx}. Differentiating F_x = M by
y and F_y = N by x:
\frac{\partial M}{\partial y} = F_{xy} = F_{yx} = \frac{\partial N}{\partial x}.
So a necessary condition is M_y = N_x. On a simply-connected
region it is also sufficient — the equality guarantees a potential exists. That single
equality is the whole exactness test.
The centrepiece: test, then reconstruct F
Solve
\underbrace{(2xy + 3x^2)}_{M}\,dx + \underbrace{(x^2 + \cos y)}_{N}\,dy = 0.
Step 1 — identify M and N.
M = 2xy + 3x^2, N = x^2 + \cos y.
Step 2 — run the exactness test. Differentiate M by
y and N by x:
\frac{\partial M}{\partial y} = 2x, \qquad \frac{\partial N}{\partial x} = 2x.
They are equal, so the equation is exact — a potential
F exists.
Step 3 — integrate M in x to
recover the bulk of F. Since F_x = M,
integrate M holding y fixed — but the
"constant" of integration may depend on y, so call it
g(y):
F(x, y) = \int (2xy + 3x^2)\,dx = x^2 y + x^3 + g(y).
Step 4 — differentiate that F by
y and match it to N to pin down the
missing g(y):
F_y = x^2 + g'(y) \;\overset{!}{=}\; N = x^2 + \cos y.
Step 5 — solve for g. The
x^2 terms cancel, leaving g'(y) = \cos y, so
g(y) = \sin y (any constant is folded into the final
C).
Step 6 — assemble F and write the solution. The
implicit general solution is the level set F = C:
\boxed{\,x^2 y + x^3 + \sin y = C.\,}
We cannot in general solve such a relation for y explicitly — and we do
not need to. The family of level curves is the solution, and an initial condition
y(x_0) = y_0 simply selects the one value of
C whose curve passes through that point.
Consider M(x,y)\,dx + N(x,y)\,dy = 0 on a simply-connected region where
M, N have continuous first partials.
-
Exactness criterion. The equation is exact — that is, there is
a potential F with F_x = M,
F_y = N — if and only if
\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}.
-
Solution. When exact, the general solution is the implicit family
F(x, y) = C (the level curves of the potential).
-
Construction. Recover F by integrating
M in x,
F = \int M\,dx + g(y), then choosing
g(y) so that F_y = N.
What if the test fails, M_y \ne N_x? Often we can multiply the whole
equation by an integrating factor \mu(x, y) that makes
it exact — the same idea that powered the
first-order linear
method, now in two-variable dress. We need
(\mu M)_y = (\mu N)_x, which in general is a PDE for
\mu — hard. But in two lucky cases it collapses to an ODE:
-
if \dfrac{M_y - N_x}{N} depends on x
alone, then \mu(x) = \exp\!\int \dfrac{M_y - N_x}{N}\,dx works;
-
if \dfrac{N_x - M_y}{M} depends on y
alone, then \mu(y) = \exp\!\int \dfrac{N_x - M_y}{M}\,dy works.
Indeed the integrating factor \mu = e^{\int P\,dx} of a linear ODE is
exactly this construction applied to
(P y - Q)\,dx + dy = 0 — the two methods are one. And a
separable
equation is just an exact one in disguise, with F the sum of the two
single-variable integrals.
The solution is a contour map
Because the general solution is F(x, y) = C, the solution curves are the
level curves (contours) of the potential F — exactly
like the contour lines on a topographic map, each tracing one height
C. Below are several contours of
F(x, y) = x^2 y + x^3 + \sin y from the worked example. Step through to
draw them one value of C at a time; each curve is one particular solution
of the exact ODE, and an initial condition just chooses which level you ride.