Exact differential equations and integrating factors
Exact differential equations (M dx + N dy = 0), tests for exactness, potential function ψ(x,y), and standard integrating factors to make non-exact equations exact.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Engineers often model steady-state systems (heat flow, electrostatics, fluid potential, chemical equilibrium) with relations that come from a potential function. Exact differential equations help you recover that potential directly. When the equation is not exact, integrating factors give a systematic way to convert it into an exact one so it can be solved reliably.
Key ideas
Test for exactness (necessary and sufficient condition): If
M, Nhave continuous first partial derivatives on a simply connected domain D, thenM dx + N dy = 0is exact in D if and only if∂M/∂y = ∂N/∂xeverywhere in D. Assumptions:M, N ∈ C¹(D)and D simply connected (no holes). Statement universities expect: “In a simply connected domain where M and N have continuous first partial derivatives,M dx + N dy = 0is exact if and only if∂M/∂y = ∂N/∂x.”Derivation of the test (sketch universities ask):
- If exact,
M = ∂ψ/∂x,N = ∂ψ/∂y. Then∂M/∂y = ∂²ψ/∂y∂x = ∂²ψ/∂x∂y = ∂N/∂xby equality of mixed partials (Clairaut’s theorem) sinceψ ∈ C²(sufficient ifM, N ∈ C¹). - Conversely, if
∂M/∂y = ∂N/∂xon a simply connected domain, defineψ(x,y) = ∫(from x₀ to x) M(s, y) ds + ∫(from y₀ to y) N(x₀, t) dt; then∂ψ/∂x = Mand, using∂M/∂y = ∂N/∂x,∂ψ/∂y = N. Alternatively, use path integrals; simple connectivity ensures path independence.
- If exact,
How to solve an exact DE:
- Check
∂M/∂y = ∂N/∂xto confirm exactness. - Find
ψ(x,y)such that∂ψ/∂x = Mand∂ψ/∂y = N.- Integrate
Mw.r.t.xkeepingyconstant:ψ(x,y) = ∫ M(x,y) dx + h(y). - Differentiate this
ψw.r.t.y:∂ψ/∂y = ∂/∂y[∫ M dx] + h′(y). - Match with
N(x,y)to findh′(y), integrate to geth(y).
- Integrate
- Write the solution as
ψ(x,y) = C.
- Check
Integrating factor (definition): A nonzero function
μ(x,y)such thatμ M dx + μ N dy = 0is exact. We then solve the exact equation.Standard tests to find integrating factors (commonly examined patterns):
- Function of x alone: If
(1/N)(∂M/∂y − ∂N/∂x) = f(x)depends only on x, then an integrating factor isμ(x) = exp(∫ f(x) dx).- Derivation idea: Require exactness of
μ M dx + μ N dy = 0, withμ = μ(x). Condition reduces toμ′(x)/μ(x) = [∂M/∂y − ∂N/∂x]/N = f(x).
- Derivation idea: Require exactness of
- Function of y alone: If
(1/M)(∂N/∂x − ∂M/∂y) = g(y)depends only on y, thenμ(y) = exp(∫ g(y) dy)is an integrating factor. - Homogeneous case (very common): If
M(x,y)andN(x,y)are homogeneous functions of the same degree n (i.e.,M(tx,ty) = tⁿ M(x,y)andN(tx,ty) = tⁿ N(x,y)), then an integrating factor isμ(x,y) = 1/(x M + y N). Assumptions:x M + y N ≠ 0in the domain.- Derivation (sketch you can quote): Using Euler’s theorem for homogeneous functions, one checks directly that
∂/∂y [ M/(x M + y N) ] = ∂/∂x [ N/(x M + y N) ]; henceμ = 1/(x M + y N)is an integrating factor (up to a nonzero constant). Practical use: Multiply the DE by1/(x M + y N)and then check exactness; it will be exact for this class.
- Derivation (sketch you can quote): Using Euler’s theorem for homogeneous functions, one checks directly that
- Linear differential equation in disguise: If you can rewrite in the form
dy/dx + P(x) y = Q(x)ordx/dy + P(y) x = Q(y), then use integrating factor for linear equations (from the Linear and Bernoulli’s differential equations topic):IF = exp(∫ P(x) dx)orexp(∫ P(y) dy)respectively.
- Function of x alone: If
Geometric interpretation (helps memory):
- For exact equations, the vector field
F = (M, N)is a gradient field:F = ∇ψ. Solutionsψ = Care level curves (equipotential lines). The condition∂M/∂y = ∂N/∂xis the 2D curl being zero.
- For exact equations, the vector field
What to draw if asked: Sketch axes with a few smooth closed or open curves labelled
ψ = C₁, C₂, …representing level curves. Draw short arrows of the vector fieldF = (M, N)perpendicular to the level curves (since gradient is normal to level curves). Label x-axis, y-axis, and one point(x₀, y₀)on a level curve.
Formulas
Solution form for exact DE: ψ(x,y) = C—ψis potential function with∂ψ/∂x = M,∂ψ/∂y = N; units of ψ are those of line integral of(M, N).Integrating factor (x-only): μ(x) = exp(∫ [(∂M/∂y − ∂N/∂x)/N] dx)— when the bracket is a function of x alone andN ≠ 0.Integrating factor (y-only): μ(y) = exp(∫ [(∂N/∂x − ∂M/∂y)/M] dy)— when the bracket is a function of y alone andM ≠ 0.Homogeneous integrating factor: μ(x,y) = 1/(x M + y N)— whenM, Nare homogeneous of same degree andx M + y N ≠ 0.Linear IF (in x): IF = exp(∫ P(x) dx)— fordy/dx + P(x) y = Q(x)(from Linear and Bernoulli’s differential equations topic).
Worked examples
Example 1: Solve an exact differential equation.
Given: M = 2x y + 3, N = x² + 4y. Solve M dx + N dy = 0.
Steps:
- Check exactness:
∂M/∂y = 2x,∂N/∂x = 2x⇒ Equal ⇒ Exact. - Find potential ψ.
- Integrate M w.r.t. x:
ψ(x,y) = ∫ (2x y + 3) dx = x² y + 3x + h(y). - Differentiate w.r.t. y:
∂ψ/∂y = x² + h′(y). - Match with N:
x² + h′(y) = x² + 4y⇒h′(y) = 4y⇒h(y) = 2y² + C₀(absorb constant later).
- Integrate M w.r.t. x:
- Write solution:
ψ(x,y) = x² y + 3x + 2y² = C.
Final answer: x² y + 3x + 2y² = C.
Example 2: Not exact; integrating factor depends on x only.
Solve (y + 2x) dx + (x + x²) dy = 0.
Steps:
- Identify
M = y + 2x,N = x + x². - Check exactness:
∂M/∂y = 1,∂N/∂x = 1 + 2x⇒ Not exact. - Try x-only integrating factor: Compute
(1/N)(∂M/∂y − ∂N/∂x) = (1/(x + x²)) (1 − (1 + 2x)) = (1/(x + x²)) (−2x) = −2/(1 + x)which is a function of x alone. - Integrating factor:
μ(x) = exp(∫ −2/(1 + x) dx) = exp(−2 ln|1 + x|) = 1/(1 + x)²(take positive branch; domain where1 + x > 0if needed). - Multiply equation by μ:
[(y + 2x)/(1 + x)²] dx + [(x + x²)/(1 + x)²] dy = 0. - Now verify exactness of the new M̃, Ñ:
M̃ = (y + 2x)/(1 + x)²,Ñ = (x + x²)/(1 + x)² = x/(1 + x).∂M̃/∂y = 1/(1 + x)²,∂Ñ/∂x = derivative of x/(1 + x) = (1 + x − x)/(1 + x)² = 1/(1 + x)²⇒ Exact.
- Find potential ψ.
- Integrate M̃ w.r.t. x:
ψ = ∫ [(y + 2x)/(1 + x)²] dx = y ∫ (1 + x)⁻² dx + 2 ∫ x (1 + x)⁻² dx. • First integral:∫ (1 + x)⁻² dx = −(1 + x)⁻¹ + C. • Second: Letu = 1 + x. Thenx = u − 1,∫ 2x u⁻² dx = ∫ 2(u − 1) u⁻² du = ∫ (2u⁻¹ − 2u⁻²) du = 2 ln u + 2 u⁻¹ + C. So,ψ = y [−1/(1 + x)] + [2 ln(1 + x) + 2/(1 + x)] + h(y). - Differentiate w.r.t. y:
∂ψ/∂y = −1/(1 + x) + h′(y). - Match with Ñ =
x/(1 + x)⇒−1/(1 + x) + h′(y) = x/(1 + x)⇒h′(y) = (x + 1)/(1 + x) = 1⇒h(y) = y + C₀.
- Integrate M̃ w.r.t. x:
- Potential function:
ψ = − y/(1 + x) + 2 ln(1 + x) + 2/(1 + x) + y(drop additive constants). - Solution:
− y/(1 + x) + 2 ln(1 + x) + 2/(1 + x) + y = C. Optionally simplify by combining terms, but this is acceptable.
Final answer: − y/(1 + x) + 2 ln(1 + x) + 2/(1 + x) + y = C.
Example 3: Homogeneous M and N; use μ = 1/(xM + yN).
Solve (x² + xy) dx + (xy + y²) dy = 0.
Observation: M = x² + xy, N = xy + y². Both are homogeneous of degree 2.
Steps:
- Check exactness:
∂M/∂y = x,∂N/∂x = y⇒ Not exact unlessx = yidentically, so generally not exact. - Use homogeneous integrating factor:
μ = 1/(x M + y N). Compute denominator:x M + y N = x(x² + xy) + y(xy + y²) = x³ + x² y + x y² + y³ = (x + y)(x² + y²). Soμ = 1/[(x + y)(x² + y²)]where this is nonzero.
- Multiply: New equation
M̃ dx + Ñ dy = 0withM̃ = M μ = (x² + xy)/[(x + y)(x² + y²)],Ñ = N μ = (xy + y²)/[(x + y)(x² + y²)]. - Verify exactness (sketch): Since the theorem guarantees exactness for homogeneous M, N, proceed to integrate.
- Find potential ψ.
- A good trick: Because of symmetry, guess
ψ = F(x/y)orF(y/x). Alternatively, proceed directly: - Integrate
M̃w.r.t. x at fixed y. SimplifyM̃by factoring:(x² + xy) = x(x + y). ThenM̃ = x(x + y)/[(x + y)(x² + y²)] = x/(x² + y²). - Similarly
Ñ = (xy + y²)/[(x + y)(x² + y²)] = y/(x² + y²). Now it is straightforward. - Integrate
M̃w.r.t. x:ψ = ∫ x/(x² + y²) dx = (1/2) ln(x² + y²) + h(y). - Differentiate w.r.t. y:
∂ψ/∂y = (1/2) * (2y)/(x² + y²) + h′(y) = y/(x² + y²) + h′(y). - Match with
Ñ = y/(x² + y²)⇒h′(y) = 0⇒h(y) = const.
- A good trick: Because of symmetry, guess
- Solution:
(1/2) ln(x² + y²) = Cor equivalentlyln(x² + y²) = C₁orx² + y² = C₂(absorb constants).
Final answer: x² + y² = C (with C > 0; the logarithm step excludes (x,y) = (0,0)).
Common mistakes
- Mixing up the exactness test: writing
∂M/∂x = ∂N/∂yinstead of∂M/∂y = ∂N/∂x. - For integrating factor tests, not checking whether
(∂M/∂y − ∂N/∂x)/Ndepends only on x (or the y-only analogue) before applying the formula; leads to incorrect μ. - Algebraic slips in partial derivatives, especially when M, N are products or quotients.
- In homogeneous-IF problems, forgetting to simplify
M̃, Ñafter multiplying byμ = 1/(xM + yN); this often cancels factors and makes integration easy. - Ignoring domain restrictions (e.g., division by
1 + xor byx² + y²), which matter for logarithms and for defining μ.
For your exam
- Short derivations: prove the exactness test; derive integrating factor when μ depends on x only or y only.
- Procedural problems: check exactness and solve by finding ψ; when not exact, identify and apply a suitable integrating factor (x-only, y-only, or homogeneous case).
- Conceptual: explain geometric meaning; describe the diagram of level curves and gradient field.
- What full-marks answers include:
- Clear statement of conditions (continuity, simply connected domain) when using the exactness test.
- Neat, step-by-step calculation: compute
∂M/∂yand∂N/∂x, show equality or not; if not, show the chosen IF test explicitly. - When building ψ: show the integral of M w.r.t. x, include
h(y), differentiate and match with N to findh(y); or the symmetric approach starting from N. - Final solution stated as
ψ(x,y) = C(or simplified equivalent), with domains when logarithms appear. - If using a standard result (e.g., homogeneous IF), state the criterion before applying it.
Quick check
- State the condition for
M dx + N dy = 0to be exact. - If
(1/N)(∂M/∂y − ∂N/∂x)is a function of x only, what integrating factor do you use? - For homogeneous
M, Nof the same degree, what is a standard integrating factor?
Answers: 1) ∂M/∂y = ∂N/∂x on a simply connected domain with continuous partials. 2) μ(x) = exp(∫ [(∂M/∂y − ∂N/∂x)/N] dx). 3) μ(x,y) = 1/(x M + y N) where x M + y N ≠ 0.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?