4.6.7Ordinary Differential Equations

Integrating factors for non-exact equations

1,828 words8 min readdifficulty · medium1 backlinks

A "fixer" you multiply through a stubborn ODE to make it exact, so you can solve it by potential functions.

The setup: what "exact" means

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

The exactness test. Since mixed partials commute (Fxy=FyxF_{xy} = F_{yx} for smooth FF): My=Fxy=Fyx=Nx.M_y = F_{xy} = F_{yx} = N_x. So: Exact    My=Nx.\boxed{\text{Exact} \iff M_y = N_x.}

The problem: most equations are NOT exact

If MyNxM_y \neq N_x, there is no FF and we're stuck... unless we multiply the whole equation by a function μ(x,y)\mu(x,y), the integrating factor: μMdx+μNdy=0.\mu M\,dx + \mu N\,dy = 0. This has the SAME solution curves (we only multiplied by something nonzero), but now we demand it be exact.

Deriving the condition on μ\mu from scratch

Exactness of the multiplied equation requires y(μM)=x(μN).\frac{\partial}{\partial y}(\mu M) = \frac{\partial}{\partial x}(\mu N). Expand both sides with the product rule: μyM+μMy=μxN+μNx.\mu_y M + \mu M_y = \mu_x N + \mu N_x. Rearrange:   NμxMμy=μ(MyNx)  \boxed{\;N\,\mu_x - M\,\mu_y = \mu\,(M_y - N_x)\;}

This is a PDE for μ\mu — generally as hard as the original ODE! The trick is to guess that μ\mu depends on only one variable, which kills a term.

Case 1: μ=μ(x)\mu = \mu(x) only

Then μy=0\mu_y = 0, μx=μ\mu_x = \mu'. The PDE becomes Nμ=μ(MyNx)    μμ=MyNxN.N\,\mu' = \mu\,(M_y - N_x) \implies \frac{\mu'}{\mu} = \frac{M_y - N_x}{N}.

Case 2: μ=μ(y)\mu = \mu(y) only

By symmetry (μx=0\mu_x=0): Mμ=μ(MyNx)    μμ=NxMyM.-M\,\mu' = \mu(M_y - N_x) \implies \frac{\mu'}{\mu} = \frac{N_x - M_y}{M}.

Full procedure (the 80/20 core)

  1. Write as Mdx+Ndy=0M\,dx + N\,dy = 0.
  2. Test: is My=NxM_y = N_x? If yes, skip to step 5.
  3. Compute MyNxN\frac{M_y-N_x}{N} → function of xx? Use μ(x)\mu(x). Else compute NxMyM\frac{N_x-M_y}{M} → function of yy? Use μ(y)\mu(y).
  4. Multiply through by μ\mu. Now exact.
  5. Find FF: integrate Fx=MF_x=M^* in xx, add unknown ϕ(y)\phi(y), differentiate in yy, match NN^*.
  6. Solution: F(x,y)=CF(x,y)=C.

Worked Example 1 — factor in xx

Solve (3xy+y2)dx+(x2+xy)dy=0.(3xy + y^2)\,dx + (x^2 + xy)\,dy = 0.

Here M=3xy+y2M = 3xy + y^2, N=x2+xyN = x^2 + xy.

My=3x+2yM_y = 3x + 2y,   Nx=2x+y\;N_x = 2x + y. Why? Differentiate MM w.r.t. yy, NN w.r.t. xx. Not exact since 3x+2y2x+y3x+2y \neq 2x+y.

MyNxN=(3x+2y)(2x+y)x2+xy=x+yx(x+y)=1x.\frac{M_y-N_x}{N} = \frac{(3x+2y)-(2x+y)}{x^2+xy} = \frac{x+y}{x(x+y)} = \frac{1}{x}. Why this step? The numerator factors and cancels the (x+y)(x+y), leaving a pure-xx function — so Case 1 works.

μ=exp ⁣(1xdx)=elnx=x.\mu = \exp\!\left(\int \tfrac{1}{x}\,dx\right) = e^{\ln x} = x.

Multiply: M=3x2y+xy2M^* = 3x^2 y + xy^2, N=x3+x2yN^* = x^3 + x^2 y. Check exact: My=3x2+2xyM^*_y = 3x^2 + 2xy, Nx=3x2+2xyN^*_x = 3x^2 + 2xy. ✓

Find FF: F=(3x2y+xy2)dx=x3y+12x2y2+ϕ(y).F = \int (3x^2y + xy^2)\,dx = x^3 y + \tfrac12 x^2 y^2 + \phi(y). Why ϕ(y)\phi(y)? Integration "constant" w.r.t. xx may depend on yy. Fy=x3+x2y+ϕ(y)F_y = x^3 + x^2 y + \phi'(y) must equal N=x3+x2yN^* = x^3 + x^2 y, so ϕ(y)=0\phi'(y)=0.

x3y+12x2y2=C.\boxed{x^3 y + \tfrac12 x^2 y^2 = C.}

Worked Example 2 — factor in yy

Solve ydx+(2xyey)dy=0.y\,dx + (2x - ye^y)\,dy = 0.

M=yM = y, N=2xyeyN = 2x - ye^y. My=1M_y = 1, Nx=2N_x = 2. Not exact.

Try Case 1: MyNxN=12xyey\frac{M_y-N_x}{N} = \frac{-1}{2x-ye^y} — still has xx. ✗ Try Case 2: NxMyM=21y=1y\frac{N_x-M_y}{M} = \frac{2-1}{y} = \frac{1}{y} — pure yy. ✓

μ=exp ⁣(1ydy)=y.\mu = \exp\!\left(\int \tfrac1y\,dy\right) = y.

Multiply: M=y2M^* = y^2, N=2xyy2eyN^* = 2xy - y^2 e^y. Check: My=2yM^*_y = 2y, Nx=2yN^*_x = 2y. ✓

F=y2dx=xy2+ϕ(y)F = \int y^2\,dx = x y^2 + \phi(y). Then Fy=2xy+ϕ(y)=2xyy2eyF_y = 2xy + \phi'(y) = 2xy - y^2 e^y, so ϕ(y)=y2ey\phi'(y) = -y^2 e^y. Integrate by parts: ϕ=ey(y22y+2)\phi = -e^y(y^2 - 2y + 2).

xy2ey(y22y+2)=C.\boxed{xy^2 - e^y(y^2 - 2y + 2) = C.}

Common mistakes

Recall Feynman: explain to a 12-year-old

Imagine a hill where height is FF. Walking so your height never changes means walking along a contour line — that's the solution. Some "walking rules" (Mdx+NdyM\,dx+N\,dy) don't quite trace a real hill's contour. The integrating factor μ\mu is like putting on magic glasses that rescale the map until the rule does match a real hill. Once it matches, you just read off the contour: "stay at height CC."

Flashcards

When is Mdx+Ndy=0M\,dx+N\,dy=0 exact?
When My=NxM_y = N_x (then a potential FF with Fx=M,Fy=NF_x=M,F_y=N exists).
Why does exactness give solution F=CF=C?
Because Mdx+Ndy=dFM\,dx+N\,dy = dF, and dF=0dF=0 means FF is constant along solutions.
PDE that the integrating factor μ\mu must satisfy?
NμxMμy=μ(MyNx)N\mu_x - M\mu_y = \mu(M_y - N_x).
Condition for an xx-only integrating factor?
MyNxN\frac{M_y-N_x}{N} is a function of xx alone.
Formula for the xx-only factor?
μ(x)=exp ⁣MyNxNdx\mu(x)=\exp\!\int \frac{M_y-N_x}{N}\,dx.
Condition and formula for a yy-only factor?
NxMyM\frac{N_x-M_y}{M} is a function of yy alone; μ(y)=exp ⁣NxMyMdy\mu(y)=\exp\!\int \frac{N_x-M_y}{M}\,dy.
Why is multiplying by μ\mu legitimate?
It doesn't change where the expression is zero (same solution curves), only the form.
After multiplying by μ\mu, what must you do?
Re-verify My=NxM^*_y=N^*_x, then find FF by partial integration.

Connections

Concept Map

test

yes exact

Fx=M, Fy=N

no not exact

demand exactness

assume mu of x

assume mu of y

if function of x only

if function of y only

makes exact

makes exact

M dx + N dy = 0

M_y = N_x ?

Potential F exists

Solution F = C

Multiply by factor mu

N mu_x - M mu_y = mu M_y-N_x

mu prime/mu = M_y-N_x /N

mu prime/mu = N_x-M_y /M

mu = exp integral g dx

mu = exp integral h dy

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, ODE ko hum aksar likhte hain Mdx+Ndy=0M\,dx + N\,dy = 0 form mein. Agar yeh "exact" hai — matlab My=NxM_y = N_x — toh ek potential function FF milta hai jiska Fx=MF_x=M aur Fy=NF_y=N, aur answer seedha F=CF=C aa jaata hai. Problem tab aati hai jab equation exact nahi hoti. Tab hum poori equation ko ek clever function μ\mu (integrating factor) se multiply karte hain taaki woh exact ban jaaye. Yeh allowed hai kyunki μ\mu se multiply karne par solution curves same rehti hain, sirf form badalta hai.

μ\mu nikaalne ka rule: pehle MyNxN\frac{M_y-N_x}{N} check karo — agar ismein sirf xx bacha (koi yy nahi), toh μ(x)=e()dx\mu(x)=e^{\int (\cdots)dx}. Agar usmein yy reh gaya, toh doosra check karo: NxMyM\frac{N_x-M_y}{M} — agar yeh sirf yy ka function hai toh μ(y)=e()dy\mu(y)=e^{\int(\cdots)dy}. Dhyaan rakho yy-wale case mein numerator ka sign palat jaata hai (NxMyN_x-M_y), yeh students bahut galti karte hain.

Multiply karne ke baad ek baar dobara My=NxM^*_y = N^*_x verify zaroor karo — yeh chhota sa check tumhari arithmetic galtiyaan pakad leta hai. Phir FF nikaalo: MM^* ko xx mein integrate karke ek extra ϕ(y)\phi(y) jodo (kyunki xx-integration ka "constant" actually yy ka function ho sakta hai), phir FyF_y ko NN^* se match karke ϕ(y)\phi(y) nikaalo. Bas, answer F=CF=C. Intuition: μ\mu ek magic glasses hai jo tilted map ko proper hill bana deta hai, jiske contours hi solution curves hain.

Go deeper — visual, from zero

Test yourself — Ordinary Differential Equations

Connections