How to rescue a broken equation by multiplying by exactly the right function — turning chaos into something perfectly differentiable.
Before we can understand what an integrating factor does, we need to understand the thing it fixes. So let's build up the whole picture from scratch.
Almost every first-order ODE can be written as:
Think of \(M\) and \(N\) as two ingredients. Together they tell you: "take a tiny step \(dx\) in the \(x\)-direction, and a tiny step \(dy\) in the \(y\)-direction. Combine them with the weights \(M\) and \(N\). Their weighted total is zero."
Imagine you're walking on a landscape (a surface in \(xy\)-space). The equation \(M\,dx + N\,dy = 0\) says: at every point, the direction you can move is perpendicular to the vector \((M, N)\). The solution curves are the level curves you walk along while staying flat.
A beautiful thing happens when \(M\) and \(N\) happen to be the partial derivatives of some single function \(F(x,y)\):
If this is true, then \(M\,dx + N\,dy\) is literally the total differential of \(F\):
So the equation \(M\,dx + N\,dy = 0\) is just saying \(dF = 0\), which means \(F(x,y) = C\) — a constant. Done. The solution is just a family of level curves of \(F\). This is the ideal situation.
The equation \(M\,dx + N\,dy = 0\) is exact if and only if:
Why? If \(F\) exists with \(F_x = M\) and \(F_y = N\), then by Clairaut's theorem (mixed partials commute for smooth functions): \(\frac{\partial M}{\partial y} = F_{xy} = F_{yx} = \frac{\partial N}{\partial x}\). The converse is also true in a simply connected region. So this one equality is the complete test.
If you check \(\partial M/\partial y\) and \(\partial N/\partial x\) and they're different, the equation is not exact. You can't write \(M\,dx + N\,dy\) as \(dF\). The equation can't be solved by the clean level-curve trick.
But wait — what if we could multiply both sides by some clever function \(\mu(x,y)\) and make it exact? That's the entire game.
Here's the trick, stated plainly: Take your non-exact equation \(M\,dx + N\,dy = 0\). Multiply every term by some function \(\mu(x,y)\):
If we can find \(\mu\) such that this new equation is exact, then:
...and we can solve the new equation using the exact-equation method. The function \(\mu\) is called the integrating factor.
Think of a messy fraction like \(\frac{3}{7} + \frac{2}{5}\). You can't add them directly. But multiply through by the LCD (35) and suddenly everything is clean integers you can add. The integrating factor is exactly like the LCD — it clears the "mess" and makes the structure obvious.
This is a subtle point worth making explicit. When we multiply by \(\mu\):
Any solution \(y(x)\) to the original equation satisfies the original equation, so it also satisfies \(\mu \cdot 0 = 0\), meaning it satisfies the new equation too. Conversely, if \(\mu \neq 0\) everywhere, a solution to the multiplied equation satisfies the original.
If \(\mu = 0\) at some point, solutions might be gained or lost there. Always check that your integrating factor is nonzero on the region of interest.
Sometimes you're handed a proposed integrating factor \(\mu\) and asked to confirm it actually makes the equation exact. The procedure is mechanical — just apply the exactness test to the modified equation.
Multiply through: define \(\tilde{M} = \mu M\) and \(\tilde{N} = \mu N\).
Compute \(\dfrac{\partial \tilde{M}}{\partial y}\) using the product rule: \(\dfrac{\partial(\mu M)}{\partial y} = \mu_y M + \mu M_y\).
Compute \(\dfrac{\partial \tilde{N}}{\partial x}\) using the product rule: \(\dfrac{\partial(\mu N)}{\partial x} = \mu_x N + \mu N_x\).
Check whether \(\dfrac{\partial \tilde{M}}{\partial y} = \dfrac{\partial \tilde{N}}{\partial x}\). If yes, \(\mu\) is a valid integrating factor.
Consider the equation:
Here \(M = 2xy\) and \(N = x^2 + y^2\). First let's check if it's already exact:
They're equal! Wait — this one is already exact. Let's use a non-exact example instead.
Equation: \(\quad (y^2)\,dx + (xy)\,dy = 0\)
Here \(M = y^2\), \(N = xy\). Check exactness:
Not equal, so not exact. Now suppose someone hands us \(\mu = \frac{1}{y}\) as a proposed integrating factor. Let's verify it.
Step 1 — Multiply through by \(\mu = \frac{1}{y}\):
New equation: \(\quad y\,dx + x\,dy = 0\)
Step 2 — Apply the exactness test:
Equal! So \(\mu = \frac{1}{y}\) is indeed a valid integrating factor. Note: \(y\,dx + x\,dy = d(xy)\), so the solution is \(xy = C\).
This is the hardest part. We don't know \(\mu\) yet. We want to find it. The equation we need \(\mu\) to satisfy comes from the exactness condition applied to \(\mu M\,dx + \mu N\,dy = 0\).
For \(\mu M\,dx + \mu N\,dy = 0\) to be exact, we need:
Expand both sides using the product rule:
Rearrange:
This is a partial differential equation for \(\mu\). In full generality, it's just as hard as what we started with. The trick is to try special forms of \(\mu\).
Assume \(\mu = \mu(x)\). Then \(\mu_y = 0\) and \(\mu_x = \frac{d\mu}{dx}\). The master condition becomes:
Divide both sides by \(\mu N\) (assuming both are nonzero):
Or equivalently:
If the expression \(\dfrac{M_y - N_x}{N}\) is a function of \(x\) alone (no \(y\) in it after simplification), then we can find \(\mu(x)\):
This is a separable ODE for \(\mu\): \(\dfrac{d\mu}{\mu} = \dfrac{M_y - N_x}{N}\,dx\), so \(\ln|\mu| = \int \dfrac{M_y - N_x}{N}\,dx\), giving \(\mu = e^{(\cdots)}\).
Assume \(\mu = \mu(y)\). Then \(\mu_x = 0\) and \(\mu_y = \frac{d\mu}{dy}\). The master condition becomes:
Divide by \(\mu M\):
If the expression \(\dfrac{N_x - M_y}{M}\) is a function of \(y\) alone, then:
We want \(\mu(x)\) such that \(\mu M\,dx + \mu N\,dy = 0\) is exact. Exactness requires \(\partial_y(\mu M) = \partial_x(\mu N)\).
Left side: Since \(\mu = \mu(x)\) only,
Right side:
Setting equal:
Rearrange to isolate \(\mu'\):
This is separable. Write \(\frac{d\mu}{\mu} = \frac{M_y - N_x}{N}\,dx\) and integrate both sides:
Exponentiate:
We can drop the absolute value and the \(\pm\) from \(e^{\ln|\mu|}\) since we only need one integrating factor — the constant of integration doesn't matter (any nonzero constant multiple of an IF is still an IF).
| Compute this ratio | If it simplifies to... | Then the IF is |
|---|---|---|
| \(\dfrac{M_y - N_x}{N}\) | A function of \(x\) only | \(\mu(x) = e^{\int \frac{M_y - N_x}{N}\,dx}\) |
| \(\dfrac{N_x - M_y}{M}\) | A function of \(y\) only | \(\mu(y) = e^{\int \frac{N_x - M_y}{M}\,dy}\) |
If \(\dfrac{M_y - N_x}{N}\) depends on both \(x\) and \(y\), and so does \(\dfrac{N_x - M_y}{M}\), then the IF is a function of both variables. Finding it requires solving a PDE, which is generally much harder. In a first course, problems are designed so one of the two simple cases works.
Once you have \(\mu\), the rest is the standard exact-equation method. Here is the complete end-to-end recipe.
Write the equation in the form \(M\,dx + N\,dy = 0\). Identify \(M\) and \(N\).
Check exactness: compute \(M_y\) and \(N_x\). If they're equal, skip to step 05 (already exact).
Find the IF: Compute \(\dfrac{M_y - N_x}{N}\). If it's a function of \(x\) only, set \(\mu = e^{\int(\cdots)\,dx}\). Otherwise try \(\dfrac{N_x - M_y}{M}\) and set \(\mu = e^{\int(\cdots)\,dy}\).
Multiply through: Replace \(M \to \mu M\) and \(N \to \mu N\). (Optionally re-verify exactness.)
Find \(F\) by integration: Integrate \(F_x = \mu M\) with respect to \(x\), keeping \(y\) constant. This gives \(F = \int \mu M\,dx + g(y)\).
Determine \(g(y)\): Differentiate \(F\) with respect to \(y\) and set it equal to \(\mu N\). Solve for \(g'(y)\), then integrate to get \(g(y)\).
Write the solution: \(F(x,y) = C\). Apply initial conditions if given.
After multiplying by \(\mu\), we have an exact equation \(\tilde{M}\,dx + \tilde{N}\,dy = 0\) with \(\tilde{M}_y = \tilde{N}_x\). By the converse of the exactness theorem (Green's theorem in disguise), there exists a function \(F(x,y)\) with \(F_x = \tilde{M}\) and \(F_y = \tilde{N}\). Therefore the equation is:
Integrating: \(F(x,y) = C\). Every solution of the ODE lies on a level curve of \(F\).
When you integrate \(F_x = \tilde{M}\) in step 05, you integrate with respect to \(x\) while treating \(y\) as constant. This is only a partial antiderivative — it can miss any function of \(y\) alone. That's why we write \(g(y)\): it's the unknown \(y\)-only part. We pin it down in step 06 using the condition \(F_y = \tilde{N}\).
When you differentiate \(F\) with respect to \(x\), all purely-\(y\) terms vanish. So integrating back recovers \(F\) but leaves a \(g(y)\)-shaped hole. The second equation (\(F_y = \tilde{N}\)) plugs that hole. Think of it as two clues pointing at the same hidden \(F\).
Problem: Solve \(\quad (y + 2)\,dx - x\,dy = 0\)
Since \(1 \neq -1\), the equation is not exact.
Compute the ratio:
This is a function of \(x\) only. So the IF is:
Verify exactness (optional check):
The constant is absorbed into \(C\).
Equivalently, multiply both sides by \(-x\): \(\quad y + 2 = -Cx\), or \(\quad y = Ax - 2\) (where \(A = -C\) is an arbitrary constant). These are lines with slope \(A\) shifted down by 2.
Problem: Solve \(\quad x\,dx + (x^2y - 1)\,dy = 0\)
Since \(0 \neq 2xy\) in general, not exact.
This depends on both \(x\) and \(y\). So we can't use \(\mu(x)\). Try \(\mu(y)\):
This is a function of \(y\) only! So:
Verify exactness:
Wait — let me recheck \(\tilde{N}_x\):
Set equal to \(\tilde{N} = (x^2y - 1)e^{y^2}\):
Hmm — \(\int -e^{y^2}\,dy\) has no elementary closed form. This suggests either the equation must remain in implicit form, or we made an error. Let's note: the solution is written implicitly as \(F = C\):
This is acceptable as an implicit solution — not all equations have elementary explicit forms. This example shows that the method is still valid even when integrals aren't clean.
Problem: Solve \(\quad (2y - 6x)\,dx + (3x - 4x^2/y)\,dy = 0\) ...
Actually, let's do a cleaner IVP example:
Problem: Solve \(\quad (3xy + y^2)\,dx + (x^2 + xy)\,dy = 0, \quad y(1) = 1\)
Not equal, so not exact.
This is a function of \(x\) only:
Verify:
Identify \(M = 3x^2 y + 2y\), \(N = x^3 + 2x\).
Equal! So the equation is already exact. Integrate \(F_x = M\):
Now \(F_y = x^3 + 2x + g'(y) = N = x^3 + 2x\), so \(g'(y) = 0\).
\(M = y^2\), \(N = 2xy + y^3\).
Wait — they're equal! This equation is already exact. Let's solve it:
\(M = y\), \(N = 2x - ye^y\).
Not exact. Try \(\mu(x)\):
This depends on \(y\). Try \(\mu(y)\):
Function of \(y\) only! So:
Multiply through: \(\tilde{M} = y^2\), \(\tilde{N} = 2xy - y^2e^y\). Verify exactness:
Now integrate: \(F = \int y^2\,dx = xy^2 + g(y)\). Then:
Integrate by parts twice: \(\int y^2 e^y\,dy = y^2 e^y - 2ye^y + 2e^y\). So:
The core insight: exactness means the left-hand side \(M\,dx + N\,dy\) is a perfect total differential \(dF\). If it isn't, we can't integrate it directly.
An integrating factor \(\mu\) reshapes \(M\) and \(N\) by scaling them, so that the new combination \(\mu M\,dx + \mu N\,dy\) becomes a total differential \(dF\). The equation then says \(dF = 0\), whose solutions are the level curves \(F = C\).
The existence of such a \(\mu\) is guaranteed in general (for smooth \(M, N\)), though finding it explicitly requires special structure (like \(\mu\) depending only on \(x\) or only on \(y\)). This is analogous to an integrating factor in linear first-order ODEs, which is just the special case \(M = p(x)y - q(x)\), \(N = 1\), where the IF formula gives \(\mu = e^{\int p\,dx}\).
A linear first-order ODE is:
Here \(M = p(x)y - q(x)\) and \(N = 1\).
So the integrating factor is:
This is exactly the same formula you use to solve linear ODEs! The integrating factor method from Section 2.6 is the general framework that unifies all these cases. Linear ODEs are just the special case where \(N = 1\) and the IF is always a function of \(x\) alone.