Integrating Factors

The hook: a magic multiplier

Look at y' + 2y = e^{x}. It is first-order linear, but you cannot separate the variables and you cannot just integrate — the left side, y' + 2y, mixes the unknown and its derivative in a way that refuses to fold up. It looks unsolvable by elementary means.

The escape is almost cheeky. There exists a single function \mu(x) — the integrating factor — such that if you multiply the whole equation by it, the tangled left side collapses into one neat derivative. An equation you could not integrate becomes an equation that is already a derivative, waiting to be undone by a single integral. This page is about where that magic multiplier comes from, why it is exactly \mu = e^{\int P\,dx}, and how to drive the method by hand.

The trick, and why it is engineered to work

Start from the standard form — coefficient of y' equal to 1:

y' + P(x)\,y = Q(x).

Multiply every term by a mystery factor \mu(x) we have not chosen yet:

\mu\,y' + \mu P\,y = \mu Q.

Now stare at the left side and remember the product rule:

(\mu y)' = \mu\,y' + \mu'\,y.

Our left side is \mu\,y' + (\mu P)\,y; the product rule gives \mu\,y' + \mu'\,y. These are the same expression the moment the y-coefficients agree — that is, precisely when

\mu' = \mu P.

That single requirement is the whole design. We do not hope the left side collapses; we engineer \mu to force it. And \mu' = P\mu is itself a separable equation we can solve:

\frac{d\mu}{\mu} = P\,dx \;\Longrightarrow\; \ln\mu = \int P\,dx \;\Longrightarrow\; \boxed{\;\mu(x) = e^{\int P(x)\,dx}.\;}

With that \mu in hand the left side really is (\mu y)', so the equation becomes

\big(\mu\,y\big)' = \mu\,Q,

and one integration (plus a divide by \mu) finishes it:

y = \frac{1}{\mu(x)}\left(\int \mu(x)\,Q(x)\,dx + C\right).

You never need the constant of integration inside \ln\mu = \int P\,dx — any one antiderivative of P works, because an extra constant just multiplies \mu by a number that cancels on both sides.

Worked example 1: y' + 2y = e^{x}

Already in standard form, so read off P(x) = 2 and Q(x) = e^{x}.

Step 1 — the integrating factor. \displaystyle \mu = e^{\int 2\,dx} = e^{2x}.

Step 2 — multiply through and watch the left side collapse. Multiply every term by e^{2x}:

e^{2x}y' + 2e^{2x}y = e^{2x}\cdot e^{x} \;\Longrightarrow\; \big(e^{2x}y\big)' = e^{3x}.

Step 3 — integrate both sides:

e^{2x}y = \int e^{3x}\,dx = \tfrac{1}{3}e^{3x} + C.

Step 4 — divide by \mu = e^{2x}:

\boxed{\,y = \tfrac{1}{3}e^{x} + C\,e^{-2x}.}

Sanity check. y' = \tfrac{1}{3}e^{x} - 2Ce^{-2x}, so y' + 2y = \big(\tfrac{1}{3}e^{x} - 2Ce^{-2x}\big) + 2\big(\tfrac{1}{3}e^{x} + Ce^{-2x}\big) = e^{x}. ✓ The answer splits into a forced piece \tfrac{1}{3}e^{x} and a homogeneous transient Ce^{-2x} that fades away.

Suppose you use a different antiderivative, \int P\,dx + k. Then your factor is \tilde\mu = e^{k}\,\mu = A\mu for a constant A = e^{k}. The collapsed equation becomes (A\mu\,y)' = A\mu Q, and the constant A divides straight out of both sides. So there is no "right" antiderivative — the simplest one (no extra constant) is always fine. Only the final integration carries a C.

Worked example 2: y' + \tfrac{1}{x}y = x (for x > 0)

Now P(x) = \tfrac{1}{x} is not constant — that is exactly where the e^{\int P} formula earns its keep. Here Q(x) = x.

Step 1 — the integrating factor. Integrate P = 1/x:

\mu = e^{\int \frac{1}{x}\,dx} = e^{\ln x} = x.

The exponential and the logarithm undo each other, leaving the pleasingly simple \mu = x.

Step 2 — multiply through by x and collapse:

x\,y' + y = x\cdot x \;\Longrightarrow\; \big(x\,y\big)' = x^{2}.

(Check the collapse: (xy)' = x\,y' + y — exactly the left side.)

Step 3 — integrate both sides:

x\,y = \int x^{2}\,dx = \tfrac{1}{3}x^{3} + C.

Step 4 — divide by \mu = x:

\boxed{\,y = \tfrac{1}{3}x^{2} + \frac{C}{x}.}

Sanity check. y' = \tfrac{2}{3}x - \tfrac{C}{x^{2}}, so y' + \tfrac{1}{x}y = \big(\tfrac{2}{3}x - \tfrac{C}{x^{2}}\big) + \tfrac{1}{x}\big( \tfrac{1}{3}x^{2} + \tfrac{C}{x}\big) = \tfrac{2}{3}x + \tfrac{1}{3}x = x. ✓ The homogeneous part is now C/x = C\,\mu^{-1}, exactly the C\,e^{-\int P} you would predict.

The integrating factor only works on linear equations. A close cousin, the Bernoulli equation y' + P(x)y = Q(x)y^{n}, is nonlinear — but a clever substitution turns it back into a linear one you can attack with exactly this method.

To solve a first-order linear ODE:

The single most common way to get the wrong answer is to read P(x) off an equation whose y' still has a stray coefficient. You must make the coefficient of y' equal to 1 before identifying P.

Given x\,y' + 3y = x^{2}, it is tempting to say "P = 3." Wrong. First divide every term by the leading coefficient x:

y' + \frac{3}{x}\,y = x.

Now P = 3/x, so \mu = e^{\int 3/x\,dx} = e^{3\ln x} = x^{3} — nothing like the e^{3x} you would have gotten from the stray-coefficient blunder. Two further reminders: Q gets divided too, and once you have \mu you must multiply every term (including Q) by it, not just the left side.

The integrating factor is old machinery: Gottfried Leibniz and Johann Bernoulli were trading solutions to linear differential equations in the 1690s, barely a decade after calculus itself. Leonhard Euler later systematised the e^{\int P} factor into the recipe you just learned.

It is not a museum piece. Every filling-and-draining system — a mixing tank relaxing to its equilibrium concentration, a capacitor charging through a resistor toward the supply voltage, a body cooling to room temperature (Newton's law of cooling) — is a first-order linear ODE with constant P, and every one is solved by the very same \mu = e^{Pt}. One multiplier, a dozen textbooks' worth of applications.

The whole family, at a glance

Here is the general solution of Example 1, y = \tfrac{1}{3}e^{x} + Ce^{-2x}. Slide the constant C (fixed in practice by an initial condition): the Ce^{-2x} transient dies quickly, so no matter where a solution starts it is pulled onto the same dashed forced curve y = \tfrac{1}{3}e^{x}. The one integrating factor e^{2x} produced this entire family.