LocusBlog

Integration by parts

Integration by parts rewrites the integral of a product as a product minus a different integral:

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

Here $u$ and $v$ are functions of $x$, with $du = u'(x)\,dx$ and $dv = v'(x)\,dx$. Integration by parts evaluates nothing on its own. It trades $\int u\,dv$ for $\int v\,du$, and the trade is worth making only when the second integral is easier than the first.

That condition is the whole game, and it is where the wrong answers come from. Nothing stops you from applying the rule with $u$ and $dv$ swapped. The result is still a true equation. It is just a worse one, and the next step makes it worse again.

Where it comes from

Differentiate a product: $(uv)' = u'v + uv'$. Integrate both sides with respect to $x$, which undoes the derivative on the left, and isolate the term you want:

$$uv = \int u'v\,dx + \int uv'\,dx \quad\Longrightarrow\quad \int uv'\,dx = uv - \int u'v\,dx$$

Written in differential notation that last equation is the boxed formula. One line, no cleverness, and it explains why the method only ever appears when the integrand is a product: the product rule is the only thing being inverted.

OpenStax Calculus Volume 2 introduces it exactly this way in section 3.1, and the study guide for that section follows the same route.

Choosing $u$, and choosing it wrong

You pick $u$; everything left over is $dv$. The usual guide is LIATE, which ranks the function types Logarithmic, Inverse trigonometric, Algebraic, Trigonometric, Exponential, and tells you to take $u$ from whichever type comes first in that list. The reason it works is that the list runs roughly from “gets simpler when differentiated” to “stays the same when integrated”. A logarithm differentiates into an algebraic function, a power differentiates down toward a constant, and $e^x$ integrates to itself at no cost.

LIATE is a heuristic, not a theorem. No result guarantees it, nothing breaks when it fails, and there are integrands where the other choice is the good one. It is a first guess that is usually right, and if the new integral looks worse than the old one, you stop and swap.

Take $\int x e^x\,dx$. Algebraic beats Exponential, so $u = x$ and $dv = e^x\,dx$, giving $du = dx$ and $v = e^x$:

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

Differentiate the answer to check it: $e^x(x-1) + e^x \cdot 1 = x e^x$. Correct.

Now do it the other way round, with $u = e^x$ and $dv = x\,dx$, so $du = e^x dx$ and $v = x^2/2$:

$$\int x e^x\,dx = \frac{x^2 e^x}{2} - \frac{1}{2}\int x^2 e^x\,dx$$

That equation is true. It is also useless. The power on $x$ went from 1 to 2, and applying the rule the same way again sends it to 3. Each step buys a smaller coefficient and a bigger exponent, and the process never terminates. The failure is not an error you can spot by checking signs. It is visible only by looking at the integral you produced and asking whether it is simpler than the one you started with.

When once is not enough

If $u$ is a power of $x$, each application drops the power by one, so $\int x^2\sin x\,dx$ needs two. First pass, $u = x^2$ and $dv = \sin x\,dx$, so $v = -\cos x$:

$$\int x^2\sin x\,dx = -x^2\cos x + \int 2x\cos x\,dx$$

Second pass on what is left, $u = 2x$ and $dv = \cos x\,dx$, so $v = \sin x$:

$$\int 2x\cos x\,dx = 2x\sin x - \int 2\sin x\,dx = 2x\sin x + 2\cos x$$

$$\int x^2\sin x\,dx = -x^2\cos x + 2x\sin x + 2\cos x + C$$

Differentiating gives $(-2x\cos x + x^2\sin x) + (2\sin x + 2x\cos x) - 2\sin x$. The $\cos x$ terms cancel, the $\sin x$ terms cancel, and $x^2\sin x$ is left.

A different thing happens with $\int e^x\sin x\,dx$, where neither factor ever simplifies. Call the integral $I$ and take $u = \sin x$, $dv = e^x dx$:

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

Apply the rule again to the new integral, keeping the trigonometric factor as $u$ so the two passes are consistent:

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

Substituting back gives $I = e^x\sin x - e^x\cos x - I$, an equation in $I$ rather than a dead end. Solve it:

$$I = \frac{e^x(\sin x - \cos x)}{2} + C$$

If instead you switch which factor plays $u$ on the second pass, the second application undoes the first and you arrive at $I = I$. True, and worth nothing. Consistency across the two passes is what makes the integral reappear with the opposite sign.

The definite form

For a definite integral the product term is evaluated at the endpoints:

$$\int_a^b u\,dv = \Big[uv\Big]_a^b - \int_a^b v\,du$$

The bracket is not optional bookkeeping, and dropping it is the most common arithmetic loss here. Take $\int_1^e \ln x\,dx$, where the integrand is not obviously a product at all. Write it as $\ln x \cdot 1$, take $u = \ln x$ and $dv = dx$, so $du = dx/x$ and $v = x$:

$$\int_1^e \ln x\,dx = \Big[x\ln x\Big]_1^e - \int_1^e x\cdot\frac{1}{x}\,dx = (e \cdot 1 - 1 \cdot 0) - (e - 1) = 1$$

Exactly 1, which Simpson’s rule on the same interval confirms to twelve decimal places.

The circular example checks out numerically too. Over $[0, \pi]$,

$$\int_0^{\pi} e^x\sin x\,dx = \left[\frac{e^x(\sin x - \cos x)}{2}\right]_0^{\pi} = \frac{e^{\pi}(0 + 1)}{2} - \frac{1(0 - 1)}{2} = \frac{e^{\pi} + 1}{2}$$

With $e^{\pi} = 23.140693$ that is $12.070346$, and numerical integration of the original integrand over the same interval returns $12.070346$. The algebra that looked like a trick produced a number a computer agrees with.

Integration by parts is also where reduction formulas come from: applying it to $\int \sin^n x\,dx$ returns the same integral with $n$ lowered by two, which is the same “solve for the integral” move in a family instead of a single case. Working through a batch of them is the fastest way to see which choice of $u$ is the productive one, and the integration by parts drill grades the antiderivative symbolically, so an answer that differs from the posted one by a constant is still marked right.

References