Integrating Factors and Exact Equations

Write a first-order ODE not as y′=f(x,y)y'=f(x,y) but in the even-handed differential form M(x,y) dx+N(x,y) dy=0M(x,y)\,\mathrm{d}x + N(x,y)\,\mathrm{d}y = 0, and a geometric question replaces the analytic one: is the one-form ω=M dx+N dy\omega = M\,\mathrm{d}x + N\,\mathrm{d}y the total differential of some scalar F(x,y)F(x,y)? If it is, the equation says dF=0\mathrm{d}F = 0, and every solution is a level curve F(x,y)=CF(x,y) = C — the whole problem collapses to two partial integrations. Such an equation is called exact, and there is a single test that decides the matter: the mixed-partial equality ∂M/∂y=∂N/∂x\partial M/\partial y = \partial N/\partial x, Clairaut's symmetry of second derivatives read backwards. That test is necessary everywhere and, on any simply connected region, sufficient — the Poincaré-lemma statement that a closed form is locally exact. It is the same "curl-free implies conservative" fact that lets a force field carry a potential energy and makes a line integral path-independent, transplanted from vector calculus into the theory of ODEs. When the test fails, the form is not exact — but multiplying by a well-chosen nonzero scalar μ(x,y)\mu(x,y), the integrating factor, can make it exact without disturbing the solution curves, since μ≠0\mu\neq 0 leaves the zero set untouched. Every first-order equation has such a factor in principle, though finding it is generically as hard as solving the equation. The method's real payoff is the structured cases where μ\mu falls out in closed form: when the normalised defect (My−Nx)/N(M_y-N_x)/N or (Nx−My)/M(N_x-M_y)/M depends on a single variable. The linear equation's universal factor e∫p dxe^{\int p\,\mathrm{d}x}, the thermodynamic factor 1/T1/T that builds entropy, and the weight that makes an operator self-adjoint are all one idea wearing different clothes.

Key takeaways
  • A first-order ODE in the form M dx+N dy=0M\,\mathrm{d}x + N\,\mathrm{d}y = 0 is exact when its left side is the total differential dF\mathrm{d}F of a potential F(x,y)F(x,y); the general solution is then just F(x,y)=CF(x,y) = C, a family of level curves.
  • The test is the equality of mixed partials, ∂M/∂y=∂N/∂x\partial M/\partial y = \partial N/\partial x, which holds because ∂2F/∂y ∂x=∂2F/∂x ∂y\partial^2 F/\partial y\,\partial x = \partial^2 F/\partial x\,\partial y for smooth FF and, on a simply connected region, is also sufficient (Poincaré's lemma).
  • When the test fails, seek an integrating factor μ(x,y)\mu(x,y) making μM dx+μN dy\mu M\,\mathrm{d}x + \mu N\,\mathrm{d}y exact; in general finding μ\mu is as hard as solving the ODE.
  • Two cases are tractable: if (My−Nx)/N(M_y-N_x)/N depends on xx alone then μ=μ(x)\mu=\mu(x); if (Nx−My)/M(N_x-M_y)/M depends on yy alone then μ=μ(y)\mu=\mu(y).
  • The linear equation y′+p y=qy'+p\,y=q is the flagship special case: its textbook factor μ=exp⁡ ⁣∫p dx\mu=\exp\!\int p\,\mathrm{d}x is exactly the multiplier that makes it an exact total differential.
  • Key idea: write the ODE as M dx+N dy=0M\,\mathrm{d}x+N\,\mathrm{d}y=0; if My=NxM_y=N_x it is exact and the solution is the potential F(x,y)=CF(x,y)=C with Fx=M, Fy=NF_x=M,\ F_y=N, and otherwise hunt for an integrating factor μ\mu making μM dx+μN dy\mu M\,\mathrm{d}x+\mu N\,\mathrm{d}y exact — solvable in closed form when (My−Nx)/N(M_y-N_x)/N or (Nx−My)/M(N_x-M_y)/M depends on a single variable.
The core insight

Write the ODE as M dx+N dy=0M\,\mathrm{d}x+N\,\mathrm{d}y=0. If My=NxM_y=N_x it is exact and the solution is the potential F(x,y)=CF(x,y)=C with Fx=M, Fy=NF_x=M,\ F_y=N. Otherwise hunt for an integrating factor μ\mu making μM dx+μN dy\mu M\,\mathrm{d}x+\mu N\,\mathrm{d}y exact — solvable in closed form when (My−Nx)/N(M_y-N_x)/N or (Nx−My)/M(N_x-M_y)/M depends on a single variable.

Where this lives today

The exactness test and its factor are not a museum piece; they are working infrastructure. In thermodynamics the entire scaffold of Maxwell relations is the statement that the differentials of the potentials U,H,F,GU,H,F,G are exact, so their mixed partials agree — every relation like (∂S/∂V)T=(∂p/∂T)V(\partial S/\partial V)_T=(\partial p/\partial T)_V is one application of My=NxM_y=N_x, and Carathéodory's 1909 axiomatisation makes the existence of an integrating factor for δQrev\delta Q_\text{rev} the mathematical form of the second law. In computer algebra, symbolic ODE solvers implement exactly the branches derived above: SymPy's `dsolve` carries an explicit `1st_exact` hint, and the classical Prelle–Singer algorithm (1983) searches for elementary integrating factors when the two heuristics fail, connecting the problem to Lie's theorem that an integrating factor is equivalent to a one-parameter symmetry. In differential geometry the failure mode of the warning box becomes a measurement: the punctured-plane angle form generates the first de Rham cohomology H1(R2∖{0})≅RH^1(\mathbb{R}^2\setminus\{0\})\cong\mathbb{R}, so "closed but not exact" is quantified rather than merely warned against, and the same distinction organises electromagnetism and Hamiltonian mechanics. The one idea — rescale a one-form until it is a gradient — reaches from a homework ODE to the topology of the domain it lives on.

The physical picture

Cover the plane with the contour lines of an unknown height function F(x,y)F(x,y). The combination M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y measures how much FF changes under a tiny step (dx,dy)(\mathrm{d}x,\mathrm{d}y); setting it to zero means "move so the height does not change." The solution curves of the ODE are therefore exactly the contours F=CF=C, and the coefficient field (M,N)(M,N) is the gradient ∇F\nabla F, which crosses every contour at a right angle. The first figure makes this concrete on the exact equation solved below.

Figure
Exact form ω = dF: the integral curves of M dx + N dy = 0 are the level sets F(x, y) = C of a hidden potential, and the gradient field (M, N) = ∇F crosses them at right angles — drawn for M = 2xy + 3x², N = x² − 1, where M_y = N_x = 2x so the potential exists and equals F = x²y + x³ − y
Exact: the integral curves are contours F = C of a hidden potential F = C₁ F = C₂ F = C₃ F = C₄ (M, N) = ∇F step (dx, dy): M dx + N dy = 0 M_y = N_x = 2x ⇒ potential exists: F = x²y + x³ − y = C

The exactness test My=NxM_y=N_x asks whether the field (M,N)(M,N) is a gradient — equivalently, whether its two-dimensional curl vanishes. A curl-free field on a hole-free region is conservative, so a potential exists; this is literally "the work done by a conservative force is path-independent." When the curl does not vanish the field is not a gradient, but an integrating factor is a point-by-point rescaling that straightens it into one. Multiplying (M,N)(M,N) by μ\mu can kill the excess curl while leaving the zero set of the form — and hence the solution curves — exactly where they were. The second figure contrasts a non-exact field with the exact gradient it becomes after the factor μ=x\mu=x.

Figure
Integrating factor as a straightener: the field of a non-exact equation circulates so M_y − N_x = x + y ≠ 0 and carries no potential, but the normalised defect (M_y − N_x)/N = 1/x depends on x alone, so μ = exp ∫ dx/x = x makes it a curl-free gradient with potential F = x³y + ½x²y²
Integrating factor: multiply by μ = x to straighten a circulating field into a gradient not exact — field circulates exact — field is a gradient ∇F M_y − N_x = x + y ≠ 0 M̃_y = Ñ_x — curves F = C × μ = x (M_y − N_x)/N = (x + y)/(x² + xy) = 1/x ⇒ μ = exp ∫ dx/x = x, F = x³y + ½x²y²

The core equations

The starting point is to abandon the asymmetry of y′=f(x,y)y'=f(x,y) and treat xx and yy as equal partners. Any first-order equation can be cleared of denominators into the symmetric form below, in which (M,N)(M,N) is read as a planar vector field.

M(x,y) dx+N(x,y) dy=0(1)M(x,y)\,\mathrm{d}x + N(x,y)\,\mathrm{d}y = 0 \qquad (1)

where: M,NM,N — coefficient functions of x,yx,y, together the components of a planar field; dx,dy\mathrm{d}x,\mathrm{d}y — differentials, the basis one-forms on the plane. A residual sign choice remains, so fix the form once and track signs. The equation is exact precisely when its left side is the total differential of a scalar potential FF. Everything operational follows from this definition.

ω=dF  ⟺  M=∂F∂x,N=∂F∂y(2)\omega = \mathrm{d}F \;\Longleftrightarrow\; M=\frac{\partial F}{\partial x},\quad N=\frac{\partial F}{\partial y} \qquad (2)

where: F(x,y)F(x,y) — the potential whose level sets are the solution curves; ω\omega — the one-form M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y. When (2) holds the ODE reads dF=0\mathrm{d}F=0, integrating at once to F=CF=C. Since a potential is rarely visible by inspection, one needs a test that uses only MM and NN. Equality of mixed partials supplies it.

∂M∂y=∂N∂x(3)\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x} \qquad (3)

where: ∂M/∂y\partial M/\partial y — rate of change of MM in yy at fixed xx; ∂N/∂x\partial N/\partial x — rate of change of NN in xx at fixed yy. Their equality is the two-dimensional curl-free condition and is necessary always, sufficient on a simply connected domain. Once the test passes, the potential is reconstructed by integrating MM in xx and fixing the leftover function of yy by matching NN.

F(x,y)=∫M dx+g(y),g′(y)=N−∂∂y ⁣∫M dx(4)F(x,y) = \int M\,\mathrm{d}x + g(y),\qquad g'(y) = N - \frac{\partial}{\partial y}\!\int M\,\mathrm{d}x \qquad (4)

where: ∫M dx\int M\,\mathrm{d}x — partial antiderivative of MM in xx with yy held fixed; g(y)g(y) — the "constant" of integration, itself a function of yy set by Fy=NF_y=N. Because My=NxM_y=N_x, the right side for g′g' is guaranteed to be free of xx. When the test fails, one rescales the form by a nonzero factor μ\mu and demands that the rescaled form be exact. That is a single first-order linear PDE for μ\mu.

∂(μM)∂y=∂(μN)∂x(5)\frac{\partial (\mu M)}{\partial y} = \frac{\partial (\mu N)}{\partial x} \qquad (5)

where: μ(x,y)\mu(x,y) — a nowhere-zero integrating factor. Equation (5) always has local solutions, but solving it in full is generically no easier than solving the original ODE. The PDE becomes an ordinary, separable equation in the lucky case that the normalised exactness defect is a function of xx alone.

μ(x)=exp⁡ ⁣(∫My−NxN dx)(6)\mu(x) = \exp\!\left(\int \frac{M_y - N_x}{N}\,\mathrm{d}x\right) \qquad (6)

where: (My−Nx)/N(M_y-N_x)/N — the normalised defect, which must be independent of yy for this branch to apply. The mirror case, with (Nx−My)/M(N_x-M_y)/M a function of yy alone, gives μ(y)=exp⁡ ⁣∫(Nx−My)/M dy\mu(y)=\exp\!\int (N_x-M_y)/M\,\mathrm{d}y. The most important instance is the linear first-order equation, whose familiar integrating factor is exactly the output of rule (6).

y′+p(x) y=q(x)  ⇒  μ(x)=e∫p dx,y=1μ ⁣[∫μq dx+C](7)y' + p(x)\,y = q(x)\;\Rightarrow\; \mu(x)=e^{\int p\,\mathrm{d}x},\quad y=\frac{1}{\mu}\!\left[\int \mu q\,\mathrm{d}x + C\right] \qquad (7)

where: p(x)p(x) — coefficient of yy in standard form; q(x)q(x) — forcing term; CC — arbitrary constant. Multiplying by μ\mu collapses the left side to (μy)′(\mu y)', the signature of exactness. Finally, the connection to vector calculus is Green's theorem, which shows the exactness defect is precisely the enclosed circulation of the field.

∮γ(M dx+N dy)=∬D(∂N∂x−∂M∂y)dx dy(8)\oint_{\gamma} (M\,\mathrm{d}x + N\,\mathrm{d}y) = \iint_{D}\left(\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}\right)\mathrm{d}x\,\mathrm{d}y \qquad (8)

where: γ\gamma — a closed loop bounding region DD; Nx−MyN_x-M_y — the two-dimensional curl. A vanishing curl makes every loop integral zero, which is path-independence, which is exactness.

Derivation AWhy the mixed-partial test is necessary and, on a simply connected region, sufficient

The exactness criterion My=NxM_y=N_x can look like a fortunate coincidence, but it is forced in one direction by the symmetry of second derivatives and returned in the other by the topology of the domain. The goal here is to prove both halves cleanly: that the existence of a potential makes the mixed-partial equality unavoidable, and that on a simply connected region the same equality is enough to build a potential explicitly, so that checking one equation decides solvability outright.

Step 1. Suppose the form is exact, ω=dF\omega=\mathrm{d}F, so that M=FxM=F_x and N=FyN=F_y. Differentiate the first across yy and the second across xx: My=∂2F/∂y ∂xM_y=\partial^2 F/\partial y\,\partial x and Nx=∂2F/∂x ∂yN_x=\partial^2 F/\partial x\,\partial y. Why: the test is a statement about MM and NN, so we push the assumption about FF down onto their derivatives, where the two sides become the two orders of the same mixed partial.

Step 2. For F∈C2F\in C^2 the mixed partials agree, ∂2F/∂y ∂x=∂2F/∂x ∂y\partial^2 F/\partial y\,\partial x=\partial^2 F/\partial x\,\partial y, which is Clairaut's (Schwarz's) theorem, so My=NxM_y=N_x. Why: this is the entire content of necessity — any exact form automatically passes the test, with no assumption beyond continuity of the second derivatives.

Step 3. For the converse, construct a candidate potential F(x,y)=∫x0xM(s,y) ds+g(y)F(x,y)=\int_{x_0}^{x} M(s,y)\,\mathrm{d}s + g(y), which already satisfies Fx=MF_x=M. Its yy-derivative must equal NN, forcing g′(y)=N−∂y ⁣∫x0xM dsg'(y)=N-\partial_y\!\int_{x_0}^{x} M\,\mathrm{d}s. Why: we are trying to invert the definition, recovering FF from (M,N)(M,N); the only freedom left after matching Fx=MF_x=M is the additive g(y)g(y).

Step 4. Differentiate that right side in xx: ∂x(N−∂y∫M ds)=Nx−My\partial_x\big(N-\partial_y\int M\,\mathrm{d}s\big)=N_x-M_y, which vanishes exactly when My=NxM_y=N_x. So the bracket is independent of xx, gg can be found by a single integration in yy, and FF exists. On a simply connected region this construction never gets trapped by a hole, which is the Poincaré lemma: closed implies exact. Why: sufficiency is not free — it needs the domain to have no holes, precisely the loophole the punctured-plane counterexample exploits. *Verified: differentiating the constructed FF returns Fx=MF_x=M by the fundamental theorem and Fy=NF_y=N by Step 3, so dF=ω\mathrm{d}F=\omega; necessity uses only F∈C2F\in C^2, sufficiency only simple connectivity.*

Go deeper · Derivation B · 1 minThe general equation for an integrating factor and its two solvable reductions
Derivation BThe general equation for an integrating factor and its two solvable reductions

Multiplying M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y by a scalar μ\mu leaves the solution curves untouched but changes the exactness defect, so there is always some μ\mu that makes the form exact. The goal is to write down the equation μ\mu must satisfy, see why it is generically intractable, and isolate the two circumstances — a defect depending on xx only, or on yy only — in which the partial differential equation degenerates to an elementary separable ordinary one.

Step 1. Impose exactness on the rescaled form, (μM)y=(μN)x(\mu M)_y=(\mu N)_x, and expand each side by the product rule to get μyM+μMy=μxN+μNx\mu_y M+\mu M_y=\mu_x N+\mu N_x. Why: this is the defining condition (5) written out; it is a first-order linear PDE in the unknown μ(x,y)\mu(x,y), and in general solving it is a reformulation of the original problem, not a simplification.

Step 2. Gamble that μ\mu depends on xx only, so μy=0\mu_y=0. The PDE reduces to μ′N=μ(My−Nx)\mu' N=\mu(M_y-N_x), that is 1μdμdx=My−NxN\dfrac{1}{\mu}\dfrac{\mathrm{d}\mu}{\mathrm{d}x}=\dfrac{M_y-N_x}{N}. Why: the left side is a function of xx alone, so the equation is consistent only if the right side is too — that requirement is the exact condition under which an xx-only factor exists.

Step 3. When that ratio is indeed xx-only, integrate to μ(x)=exp⁡ ⁣∫ ⁣My−NxN dx\mu(x)=\exp\!\int\!\frac{M_y-N_x}{N}\,\mathrm{d}x. By the mirror argument, setting μx=0\mu_x=0 gives 1μdμdy=Nx−MyM\dfrac{1}{\mu}\dfrac{\mathrm{d}\mu}{\mathrm{d}y}=\dfrac{N_x-M_y}{M} and μ(y)=exp⁡ ⁣∫ ⁣Nx−MyM dy\mu(y)=\exp\!\int\!\frac{N_x-M_y}{M}\,\mathrm{d}y whenever that ratio is yy-only. Why: these two closed forms are the practical heart of the method — every routine "integrating factor" a student computes is one of these two branches, and the linear equation below is the xx-only branch in disguise. *Verified: substituting μ(x)\mu(x) from Step 3 back into (μM)y−(μN)x(\mu M)_y-(\mu N)_x gives μ[(My−Nx)−N (ln⁡μ)′]=0\mu\big[(M_y-N_x)-N\,(\ln\mu)'\big]=0, which vanishes by construction; the yy-branch checks identically.*

Go deeper · Derivation C · 1 minThe linear first-order equation as a disguised exact equation
Derivation CThe linear first-order equation as a disguised exact equation

The universal integrating factor e∫p dxe^{\int p\,\mathrm{d}x} that every course attaches to y′+p y=qy'+p\,y=q is usually presented as a trick to memorise. The goal here is to show it is not a trick at all but the xx-only reduction of the previous derivation applied to the linear equation, so that the collapse of the left side into a single derivative (μy)′(\mu y)' is nothing more than the statement that the rescaled form has become exact.

Step 1. Put the linear equation in symmetric form: y′+p y=qy'+p\,y=q becomes (p y−q) dx+dy=0(p\,y-q)\,\mathrm{d}x+\mathrm{d}y=0, so M=p y−qM=p\,y-q and N=1N=1. Then My=pM_y=p and Nx=0N_x=0. Why: writing it as M dx+N dy=0M\,\mathrm{d}x+N\,\mathrm{d}y=0 is what lets the exact-equation machinery see the linear equation at all.

Step 2. The normalised defect is (My−Nx)/N=(p−0)/1=p(x)(M_y-N_x)/N=(p-0)/1=p(x), a function of xx alone, so the xx-only branch applies and dμdx=p μ\dfrac{\mathrm{d}\mu}{\mathrm{d}x}=p\,\mu gives μ=e∫p dx\mu=e^{\int p\,\mathrm{d}x}. Why: the factor is not guessed — it is forced by requiring (μM)y=(μN)x(\mu M)_y=(\mu N)_x, and it is unique up to a multiplicative constant.

Step 3. Multiply the original equation by μ\mu: μy′+μp y=μq\mu y'+\mu p\,y=\mu q. The left side is exactly ddx(μy)\dfrac{\mathrm{d}}{\mathrm{d}x}(\mu y) because μ′=pμ\mu'=p\mu, so (μy)′=μq(\mu y)'=\mu q. Why: the exactness we just engineered is visible here as a perfect derivative — that is what "exact" means once one variable has been trivially integrated.

Step 4. Integrate once: μy=∫μq dx+C\mu y=\int \mu q\,\mathrm{d}x+C, hence y=1μ ⁣[∫μq dx+C]y=\dfrac{1}{\mu}\!\left[\int \mu q\,\mathrm{d}x+C\right]. As a check, constant p,qp,q give μ=epx\mu=e^{px}, ∫epxq dx=(q/p)epx\int e^{px}q\,\mathrm{d}x=(q/p)e^{px}, and y=q/p+Ce−pxy=q/p+Ce^{-px}. Why: recovering the standard relaxation solution from the general formula confirms the whole chain, from symmetric form to integrating factor to quadrature. *Verified: with constant coefficients y=q/p+Ce−pxy=q/p+Ce^{-px} satisfies y′+py=−pCe−px+p(q/p+Ce−px)=qy'+py=-pCe^{-px}+p(q/p+Ce^{-px})=q; the general yy satisfies (μy)′=μq(\mu y)'=\mu q by construction.*

Limiting cases

Recognising when the general machinery collapses to something elementary is most of the practical skill.

CaseResultMeaning
Already exactMy=NxM_y = N_xNo factor needed; integrate Fx=MF_x=M and match Fy=NF_y=N to get F=CF=C directly.
xx-only factor existsMy−NxN=f(x)\dfrac{M_y - N_x}{N} = f(x)Multiply by μ(x)=exp⁡ ⁣∫f dx\mu(x)=\exp\!\int f\,\mathrm{d}x; the defect depends on xx alone.
yy-only factor existsNx−MyM=g(y)\dfrac{N_x - M_y}{M} = g(y)Multiply by μ(y)=exp⁡ ⁣∫g dy\mu(y)=\exp\!\int g\,\mathrm{d}y; the defect depends on yy alone.
Linear equationy′+p y=qy' + p\,y = qThe case M=p y−q, N=1M=p\,y-q,\ N=1; the standard factor μ=e∫p dx\mu=e^{\int p\,\mathrm{d}x} is the xx-only branch.
Separable equationM=M(x), N=N(y)M=M(x),\ N=N(y)Automatically exact — My=0=NxM_y=0=N_x — so separation of variables is a special case of exactness.
Closed but not exactMy=NxM_y=N_x on a punctured domainTest passes locally yet no global potential exists; simple connectivity is essential.

Worked examples

1 · An exact equation solved end to end (confidence builder)

Solve (2xy+3x2) dx+(x2−1) dy=0(2xy + 3x^2)\,\mathrm{d}x + (x^2 - 1)\,\mathrm{d}y = 0, with M=2xy+3x2M=2xy+3x^2 and N=x2−1N=x^2-1.

Step 1. Test exactness. My=∂y(2xy+3x2)=2xM_y=\partial_y(2xy+3x^2)=2x and Nx=∂x(x2−1)=2xN_x=\partial_x(x^2-1)=2x. They are equal, so the equation is exact and a potential exists.

Step 2. Integrate MM in xx, holding yy fixed: F=∫(2xy+3x2) dx=x2y+x3+g(y)F=\int(2xy+3x^2)\,\mathrm{d}x=x^2y+x^3+g(y), where g(y)g(y) is the unknown function of yy.

Step 3. Match Fy=NF_y=N. Differentiating, Fy=x2+g′(y)F_y=x^2+g'(y), and this must equal N=x2−1N=x^2-1. The x2x^2 terms cancel — a check that Step 1 was right — leaving g′(y)=−1g'(y)=-1, so g(y)=−yg(y)=-y up to a constant absorbed into CC.

Step 4. Assemble the implicit general solution: x2y+x3−y=C\boxed{x^2y+x^3-y=C}. Where x2−1≠0x^2-1\neq 0 one may solve explicitly, y=(C−x3)/(x2−1)y=(C-x^3)/(x^2-1).

Step 5. Verify by differentiating back: dF=(2xy+3x2) dx+(x2−1) dy\mathrm{d}F=(2xy+3x^2)\,\mathrm{d}x+(x^2-1)\,\mathrm{d}y, which reproduces the original form exactly. The solution is F=x2y+x3−y=CF = x^2y+x^3-y = C, and My=Nx=2xM_y=N_x=2x confirmed exactness.

2 · Building an integrating factor from scratch

Solve (3xy+y2) dx+(x2+xy) dy=0(3xy + y^2)\,\mathrm{d}x + (x^2 + xy)\,\mathrm{d}y = 0, with M=3xy+y2M=3xy+y^2, N=x2+xyN=x^2+xy.

Step 1. Test exactness. My=3x+2yM_y=3x+2y and Nx=2x+yN_x=2x+y, so My−Nx=x+y≠0M_y-N_x=x+y\neq 0: not exact as written.

Step 2. Try the xx-only branch: My−NxN=x+yx2+xy=x+yx(x+y)=1x\dfrac{M_y-N_x}{N}=\dfrac{x+y}{x^2+xy}=\dfrac{x+y}{x(x+y)}=\dfrac{1}{x}. This depends on xx alone, so an xx-only factor exists.

Step 3. Compute it: μ(x)=exp⁡ ⁣∫1x dx=eln⁡x=x\mu(x)=\exp\!\int\frac{1}{x}\,\mathrm{d}x=e^{\ln x}=\boxed{x}. Multiply the equation through by xx to get (3x2y+xy2) dx+(x3+x2y) dy=0(3x^2y+xy^2)\,\mathrm{d}x+(x^3+x^2y)\,\mathrm{d}y=0.

Step 4. Confirm the new form is exact: M~y=3x2+2xy\tilde M_y=3x^2+2xy and N~x=3x2+2xy\tilde N_x=3x^2+2xy — equal, as designed.

Step 5. Recover the potential: F=∫(3x2y+xy2) dx=x3y+12x2y2+g(y)F=\int(3x^2y+xy^2)\,\mathrm{d}x=x^3y+\tfrac12 x^2y^2+g(y). Then Fy=x3+x2y+g′(y)F_y=x^3+x^2y+g'(y) must equal N~=x3+x2y\tilde N=x^3+x^2y, so g′(y)=0g'(y)=0 and gg is constant.

Step 6. The solution is x3y+12x2y2=C\boxed{x^3y+\tfrac12 x^2y^2=C}. Back-substitution shows dF=x[(3xy+y2) dx+(x2+xy) dy]\mathrm{d}F=x\big[(3xy+y^2)\,\mathrm{d}x+(x^2+xy)\,\mathrm{d}y\big], confirming μ=x\mu=x. Factor μ=x\mu=x, solution x3y+12x2y2=Cx^3y+\tfrac12 x^2y^2=C.

3 · The integrating factor 1/T that builds entropy

For a reversible process on an ideal gas, the first law gives the heat one-form δQ=CV dT+nRTV dV\delta Q = C_V\,\mathrm{d}T + \dfrac{nRT}{V}\,\mathrm{d}V (using p=nRT/Vp=nRT/V). Show it is not exact, but that μ=1/T\mu=1/T makes it exact, defining entropy.

Step 1. Read off M=CVM=C_V (in the variable TT) and N=nRT/VN=nRT/V (in the variable VV). Test exactness: ∂M/∂V=0\partial M/\partial V=0 but ∂N/∂T=nR/V≠0\partial N/\partial T=nR/V\neq 0, so δQ\delta Q is not exact — heat is a path-dependent process quantity, not a state function.

Step 2. Try μ=1/T\mu=1/T. The rescaled form is δQT=CVT dT+nRV dV\dfrac{\delta Q}{T}=\dfrac{C_V}{T}\,\mathrm{d}T+\dfrac{nR}{V}\,\mathrm{d}V, so now M/T=CV/TM/T=C_V/T and N/T=nR/VN/T=nR/V.

Step 3. Re-test: ∂(CV/T)/∂V=0\partial(C_V/T)/\partial V=0 and ∂(nR/V)/∂T=0\partial(nR/V)/\partial T=0 — equal, so δQ/T\delta Q/T is exact. There is a potential, and it is the entropy.

Step 4. Integrate to recover it: S=∫CVT dT+∫nRV dV=CVln⁡T+nRln⁡V+constS=\int\frac{C_V}{T}\,\mathrm{d}T+\int\frac{nR}{V}\,\mathrm{d}V=\boxed{C_V\ln T+nR\ln V+\text{const}}, the Sackur-style ideal-gas entropy up to a constant. The factor 1/T1/T turns path-dependent heat into the exact differential dS\mathrm{d}S — the same construction as every ODE integrating factor, now doing thermodynamics.

Physics of the portrait

Exact equations and integrating factors sit at a rare crossroads: an eighteenth-century calculation about total differentials that turned out to encode conservative forces, thermodynamic state functions, and, two centuries later, the cohomology of differential forms. The person whose name is stamped on the test itself is Alexis Clairaut.

Origins · 1 minAlexis Clairaut and how this was discovered
AC
Alexis Clairaut
1713–1765 · exact differential equations and the integrability condition

Clairaut was the prodigy of the French Enlightenment mathematics: he read l'Hôpital's calculus text at nine, presented original geometry to the Académie des sciences at thirteen, and was elected a full member at eighteen, its youngest ever. His deepest technical legacy for this article is a pair of memoirs of 1739–1740 on the integral calculus, in which he studied when a differential expression M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y is the total differential of a single function and stated the integrability condition ∂M/∂y=∂N/∂x\partial M/\partial y=\partial N/\partial x — the exactness test, and the two-dimensional shadow of what we now call Clairaut's (or Schwarz's) theorem on the symmetry of mixed second derivatives. The question was not abstract: Clairaut needed it for geodesy and the shape of the rotating Earth, where the equilibrium of a fluid figure demands that the force field derive from a potential, and his celebrated theorem relating a planet's flattening to its surface gravity is exactly a statement that a certain one-form is exact. The complementary idea — that a non-exact equation can be rescued by an integrating factor, or "multiplier" — belongs chiefly to Leonhard Euler, who developed the systematic theory in the 1730s and after, giving the method that Clairaut's condition tests. Clairaut went on to a triumph of applied analysis in 1759, when his integration of the perturbed three-body problem predicted the return of Halley's comet to within a month. What began as his bookkeeping for total differentials is now the first thing one checks about any first-order ODE.

History
1734
— Euler introduces the integrating factor, his "multiplier," for first-order equations
1739
— Clairaut publishes the exactness condition ∂M/∂y = ∂N/∂x for total differentials
1865
— Clausius names entropy, the state function dS = δQ_rev/T built by the factor 1/T
1899
— Poincaré and Cartan recast exactness as the closed-implies-exact lemma for differential forms
1909
— Carathéodory grounds the second law in the existence of an integrating factor for heat

Going further

Texts. Arfken & Weber, Mathematical Methods for Physicists, 7th ed., first-order ODE section · Hassani, Mathematical Physics, chapters on ODEs and differential forms · Stone & Goldbart, Mathematics for Physics, ODE chapter · Riley, Hobson & Bence, Mathematical Methods for Physics and Engineering, Ch. 14 · Boyce & DiPrima, Elementary Differential Equations, §2.6 · Nakahara, Geometry, Topology and Physics, §5 (closed and exact forms, de Rham cohomology).

Provenance. The exactness test and potential-recovery procedure follow Riley–Hobson–Bence Ch. 14 and Boyce & DiPrima §2.6; the integrating-factor PDE and its two single-variable reductions follow the Arfken & Weber first-order ODE section; the linear factor e∫p dxe^{\int p\,\mathrm{d}x} is standard across all three. A verifier should recompute: (1) My=NxM_y=N_x for each worked example; (2) that dF\mathrm{d}F reproduces the boxed solutions by direct differentiation; (3) (My−Nx)/N=1/x(M_y-N_x)/N=1/x giving μ=x\mu=x in Example 2; (4) that δQ/T\delta Q/T is exact for the ideal gas, with S=CVln⁡T+nRln⁡VS=C_V\ln T+nR\ln V; (5) that the polar-angle one-form is the canonical closed-not-exact form on the punctured plane, with My=Nx=(y2−x2)/(x2+y2)2M_y=N_x=(y^2-x^2)/(x^2+y^2)^2.

Prerequisites. First-Order Ordinary Differential Equations · Existence and Uniqueness Theorems for ODEs. Leads to. Variation of Parameters · Reduction of Order · Sturm–Liouville Theory.

Ask the tutor: Hand me any first-order ODE and I will put it in symmetric form, run the My=NxM_y=N_x test, and either integrate out the potential or build the integrating factor with you step by step.

What does it actually mean for an equation to be exact?

It means the left side M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y is the total differential dF\mathrm{d}F of a single scalar function F(x,y)F(x,y), so the equation is secretly saying dF=0\mathrm{d}F=0. Once you see that, solving is trivial: a quantity whose differential is zero is constant, so F(x,y)=CF(x,y)=C, and the solution "curves" are the contour lines of FF. Geometrically the coefficient field (M,N)(M,N) is the gradient ∇F\nabla F, and the solution curves run perpendicular to it — along a contour the height FF never changes. Everything else is machinery for checking whether such an FF exists (the mixed-partial test) or manufacturing one when it does not (the integrating factor).

How do I know whether to look for μ(x) or μ(y)?

Compute the defect My−NxM_y-N_x and try to normalise it into a single-variable function. If (My−Nx)/N(M_y-N_x)/N simplifies to something with no yy in it, an xx-only factor works and equals exp⁡ ⁣∫(My−Nx)/N dx\exp\!\int (M_y-N_x)/N\,\mathrm{d}x. If instead (Nx−My)/M(N_x-M_y)/M comes out free of xx, a yy-only factor works. The practical routine is to form both ratios and see which one loses a variable — often only one does, and sometimes neither, in which case you need a different method. In Example 2 the ratio (x+y)/(x2+xy)(x+y)/(x^2+xy) collapsed to 1/x1/x, the tell that μ(x)\mu(x) is available.

Does every first-order ODE really have an integrating factor?

Locally, yes — this is a theorem, essentially a restatement of the existence-and-uniqueness theory. Near any point where the field is well behaved, a nonzero μ(x,y)\mu(x,y) exists that makes M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y exact. The catch is that finding it means solving the PDE (μM)y=(μN)x(\mu M)_y=(\mu N)_x, which in general is exactly as hard as solving the original equation, so the guarantee is not constructive. The method is powerful only because a handful of structured situations — the defect depending on xx alone, or yy alone, or the equation being linear — hand you μ\mu in closed form. Outside those, often nothing elementary exists.

Why is the constant of integration a function g(y) rather than a number?

Because you integrated a partial derivative, not an ordinary one. When you undo Fx=MF_x=M by writing F=∫M dxF=\int M\,\mathrm{d}x, you held yy fixed, so anything that depends on yy alone was invisible to the xx-integration and could have been present. The most general antiderivative therefore carries an unknown g(y)g(y), not a constant. That leftover function is not a nuisance — it is where the entire NN equation gets used: differentiating FF in yy and setting it equal to NN pins down g′(y)g'(y), and hence gg. Forget the g(y)g(y) and you throw away half the information in the problem, usually getting a wrong or incomplete solution.

How is this connected to conservative forces and potential energy?

Directly — it is the same mathematics. A planar force field F=(M,N)\mathbf{F}=(M,N) is conservative exactly when it is the gradient of a potential, which is exactly when M dx+N dyM\,\mathrm{d}x+N\,\mathrm{d}y is exact, which is exactly the curl-free condition My=NxM_y=N_x. The potential FF that exact-equation integration produces is (minus) the potential energy UU, and the statement dF=0\mathrm{d}F=0 along a trajectory is conservation of energy. The punctured-plane counterexample has a physical echo too: a field that is curl-free except at an inaccessible singularity can fail to have a global single-valued potential — the classical shadow of the Aharonov–Bohm effect.

Why does 1/T work as an integrating factor for heat?

Empirically and then structurally. The reversible heat one-form δQrev\delta Q_\text{rev} is not exact — heat is path-dependent, so there is no "heat content" state function — and Worked Example 3 shows the test My=NxM_y=N_x failing for an ideal gas. Multiplying by 1/T1/T passes the test, and the resulting exact differential is dS\mathrm{d}S, the entropy. Carathéodory turned this around in 1909: he took the existence of an integrating factor for δQrev\delta Q_\text{rev}, with the reciprocal absolute temperature as that factor, to be the precise mathematical content of the second law of thermodynamics. So the same operation you perform on a homework ODE is, in disguise, the definition of entropy.

Do I need the language of differential forms to use any of this?

No — the whole method works with partial derivatives and integrals, exactly as in the worked examples, and most physics and engineering courses never mention forms. But the language pays off in understanding. Calling ω=M dx+N dy\omega=M\,\mathrm{d}x+N\,\mathrm{d}y a one-form, My=NxM_y=N_x the condition dω=0\mathrm{d}\omega=0 (closed), and exactness the condition ω=dF\omega=\mathrm{d}F, makes the Poincaré lemma ("closed implies exact on a simply connected region") the clean statement of why the test works and when it fails. It also generalises immediately to higher dimensions and to manifolds, where the failure of closed-to-imply-exact is measured by de Rham cohomology. For solving a specific ODE you can ignore all of it; for seeing why the topic is one idea, it is worth learning.

Before this

Where this leads