Integration by Parts

Where does a diving board balance, and how long on average until a randomly-arriving bus turns up? Answers like these come out as integrals of a product — one factor climbing while the other decays — and none of the standard rules can prise such a product apart. The technique on this page is the one that can.

Try to integrate x e^x. It isn't a standard form. Substituting t = x does nothing; substituting t = e^x tangles it up worse. The integrand is a product of two unlike functions — a polynomial and an exponential — and none of your tools so far can split a product apart.

But differentiation can. The product rule tells you exactly how a product behaves under the derivative — and just as substitution is the chain rule run backwards, integration by parts is the product rule run backwards:

\int u\, dv = uv - \int v\, du.

Read it as a trade. You split the integrand into two pieces, a u and a dv. Then you differentiate the u piece, integrate the dv piece, and swap the integral you cannot do, \int u\,dv, for a new one, \int v\,du — plus the boundary term uv for free. Choose the split well and the new integral is genuinely easier; choose badly and it is worse. The formula is mechanical — the skill is the choosing, and this page is about learning to choose.

Deriving the rule from the product rule

Take two differentiable functions u(x) and v(x). The product rule tells us how their product changes; we integrate that statement and rearrange. Three lines, and the whole technique falls out.

Step 1 — the product rule, in differential form. The derivative of a product spreads over both factors:

\frac{d}{dx}(uv) = u\,\frac{dv}{dx} + v\,\frac{du}{dx}, \qquad\text{i.e.}\qquad d(uv) = u\, dv + v\, du.

Step 2 — integrate both sides. The left integrates back to the product itself; the right splits by linearity:

\int d(uv) = \int u\, dv + \int v\, du \qquad\Longrightarrow\qquad uv = \int u\, dv + \int v\, du.

Step 3 — solve for the integral we want. Move the second integral to the left:

\int u\, dv = uv - \int v\, du.

That is the whole rule — the product rule, integrated and rearranged. Notice what the rearrangement bought us: the product rule mixes the two integrals together, and we simply chose to treat one of them as the unknown and the other as the price. The art is that you get to decide which factor to call u (which you will differentiate — hopefully into something tamer) and which to call dv (which you must be able to integrate on the spot).

Worked example 1: \displaystyle\int x e^{x}\, dx

Step 1 — split into u and dv. Ask of each factor: what happens to you if I differentiate you? What if I integrate you? Differentiating x simplifies it to the constant 1 — a clear win. Integrating e^x costs nothing at all: it is its own integral. So:

u = x,\quad dv = e^x\, dx \qquad\Longrightarrow\qquad du = dx,\quad v = e^x.

(The LIATE checklist in the box below reaches the same verdict instantly: Algebraic beats Exponential, so u = x.)

Step 2 — apply \int u\,dv = uv - \int v\,du.

\int x e^x\, dx = x e^x - \int e^x\, dx.

Look at the trade we just made: the troublesome x has been differentiated away, and the leftover integral is one of the most basic on the syllabus.

Step 3 — the new integral is elementary.

\int e^x\, dx = e^x + C.

Step 4 — collect and factor.

\int x e^x\, dx = x e^x - e^x + C = (x - 1)e^x + C.

Check by the product rule: \frac{d}{dx}\big[(x-1)e^x\big] = e^x + (x-1)e^x = x e^x. ✓ A ten-second differentiation check like this catches almost every parts slip — make it a habit.

The LIATE heuristic. When in doubt, pick u to be whichever factor comes first in this list — because that is the factor most worth differentiating (and hardest to integrate):

The list is really a ranking of how much differentiation improves each type. A logarithm is awkward to integrate but differentiates into a plain power — top of the list. An exponential is unchanged by either operation, so it may as well sit in dv — bottom of the list. In \int x e^x\, dx, Algebraic beats Exponential, so u = x — exactly what we chose. In \int x^2 \ln x\, dx, Logarithmic beats Algebraic, so u = \ln x even though x^2 "looks" like the natural u.

Worked example 2: \displaystyle\int x \cos x\, dx

Same shape of problem — a power of x multiplying a function that cycles under integration. LIATE: Algebraic beats Trigonometric, so the x is the piece to kill by differentiating.

u = x,\quad dv = \cos x\, dx \qquad\Longrightarrow\qquad du = dx,\quad v = \sin x.

Apply the rule:

\int x \cos x\, dx = x\sin x - \int \sin x\, dx.

Finish carefully — here comes the classic sign trap. The leftover integral is \int \sin x\, dx = -\cos x, and it enters with a minus sign in front of it, so the two minuses make a plus:

\int x \cos x\, dx = x\sin x - (-\cos x) + C = x\sin x + \cos x + C.

Check: \frac{d}{dx}\big[x\sin x + \cos x\big] = \sin x + x\cos x - \sin x = x\cos x. ✓

Four traps account for nearly every lost mark on a parts question:

Worked example 3, a sneaky one: \displaystyle\int \ln x\, dx

There is no obvious product here — just a lone logarithm, which is famously not on the standard integrals list. The trick is to invent a product: regard the integrand as \ln x times 1, and hand the invisible 1 to dv.

Step 1 — take dv = dx. Differentiating \ln x demolishes the logarithm and leaves an ordinary power; that is the entire win:

u = \ln x,\quad dv = dx \qquad\Longrightarrow\qquad du = \frac{1}{x}\, dx,\quad v = x.

Step 2 — apply the rule.

\int \ln x\, dx = x\ln x - \int x \cdot \frac{1}{x}\, dx.

Step 3 — the leftover integral collapses, since x\cdot\frac1x = 1:

\int x \cdot \frac{1}{x}\, dx = \int 1\, dx = x.

Step 4 — collect.

\int \ln x\, dx = x\ln x - x + C.

The same dv = dx gambit integrates \arctan x, \arcsin x and (\ln x)^2 — any function that is hard to integrate but easy to differentiate. Keep it in your back pocket.

For differentiable u(x) and v(x):

The boomerang: \displaystyle\int e^x \sin x\, dx

Some integrals never simplify — they come back. Neither factor of e^x \sin x ever wears out: the exponential shrugs off both operations, and the sine just cycles through \sin \to \cos \to -\sin \to -\cos. Apply parts and watch what happens. Call the target I = \int e^x \sin x\, dx and take u = \sin x,\ dv = e^x dx:

I = e^x \sin x - \int e^x \cos x\, dx.

The new integral is no easier — so go around again, with the same style of choice (u = \cos x,\ dv = e^x dx):

\int e^x \cos x\, dx = e^x \cos x + \int e^x \sin x\, dx = e^x\cos x + I.

The original integral has reappeared. That looks like failure — we are going in circles — but substitute back and look again:

I = e^x \sin x - e^x \cos x - I.

This is no longer an integration problem. It is an equation, and I is just an unknown to solve for — add I to both sides and divide by two:

2I = e^x(\sin x - \cos x) \quad\Longrightarrow\quad I = \tfrac{1}{2}e^x(\sin x - \cos x) + C.

Two cautions. First, be consistent: put the trig factor in u both times (or the exponential both times). Mix the choices and the second application simply undoes the first, giving the perfectly true, perfectly useless statement I = I. Second, the +C appears when you divide by 2 at the end — an antiderivative is only ever defined up to a constant, so we restore it in the final line.

For \int x^3 e^x\, dx you would need parts three times, each round its own u, dv and minus sign — plenty of chances to slip. The tabular (or "DI") method compresses all three rounds into one table. Differentiate the polynomial column down to zero, integrate the exponential column the same number of times, and prefix alternating signs:

\begin{array}{c|c|c} \text{sign} & D\ (\text{differentiate}) & I\ (\text{integrate}) \\ \hline + & x^3 & e^x \\ - & 3x^2 & e^x \\ + & 6x & e^x \\ - & 6 & e^x \\ & 0 & e^x \end{array}

Multiply each D entry by the I entry one row down, with its sign, and add:

\int x^3 e^x\, dx = x^3 e^x - 3x^2 e^x + 6x e^x - 6e^x + C = (x^3 - 3x^2 + 6x - 6)\,e^x + C.

It is exactly integration by parts applied three times — the table just does the bookkeeping, and the alternating signs are the -\int v\,du compounding. This is the trick made famous by the film Stand and Deliver, where a room of teenagers uses it to breeze through calculus. It only works this cleanly when one factor differentiates to zero — for boomerangs like e^x \sin x you still stop the table early and solve, as above.

See it: integrand and antiderivative

Parts is algebra, but its output is still an antiderivative — and you can see the relationship. The faint curve is the integrand x e^{kx}; the bold curve is the antiderivative that parts produces, \frac{1}{k^2}(kx - 1)e^{kx} (for k = 1 that is our worked answer (x-1)e^x).

Two things to watch as you slide the rate k. First, the bold curve's slope always matches the faint curve's height — that is what "antiderivative" means, live. Second, look at x = 0: the integrand crosses zero there, and sure enough the bold curve bottoms out — flat tangent — at exactly that point, for every k. If your parts answer ever fails a check like this, a sign has gone missing somewhere.

Why integration is genuinely hard

A last, humbling perspective. Differentiation is a closed game: the product, quotient and chain rules guarantee that any function you can write down, you can differentiate, mechanically. Integration has no such guarantee. Parts and substitution are not a complete toolkit — they are the two best moves in a game that cannot always be won.

Differentiating e^{x^2} is a one-liner: \frac{d}{dx}e^{x^2} = 2x\,e^{x^2}. So surely \int e^{x^2} dx yields to a clever substitution or a cunning parts? It does not — and not because mathematicians haven't found the trick yet. In the 1830s Joseph Liouville proved that no elementary function — no finite combination of polynomials, exponentials, logs and trig — has e^{x^2} as its derivative. The antiderivative exists (it is a perfectly good function, a cousin of the famous \operatorname{erf} from statistics); it simply cannot be spelled with our alphabet. The same fate befalls \int \frac{\sin x}{x} dx, \int \frac{e^x}{x} dx and \int \frac{dx}{\ln x}.

So when an integral resists you, it may not be you. Part of mastering parts is developing the judgement to recognise which products it can crack — a polynomial times something integrable, a lone logarithm, a boomerang pair — and which are simply beyond every elementary technique.

See it explained