Integration by Parts: Formula, Method and Worked Examples

Integration by parts is the standard method for integrals of products, such as x\cos x, x e^x or \ln x. It is the product rule for derivatives, run backwards. This article covers the formula, a reliable way to choose the parts, four worked examples and a faster table method. You can check any example along the way in the integral calculator, which shows the solution step by step.

If you are not sure that integration by parts is the right tool, see How to Solve Integrals Step by Step for the overall workflow.

Formula and where it comes from

Start with the product rule for two differentiable functions u(x) and v(x):

(uv)' = u'v + uv'

Integrate both sides with respect to x:

uv = \int v\,du + \int u\,dv

Rearranging gives the integration by parts formula:

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

Here du = u'(x)\,dx and dv = v'(x)\,dx. The idea is to replace a hard integral \int u\,dv with a different integral \int v\,du that is easier.

For a definite integral, the product term gets the limits too:

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

To apply the formula you do four things:

  1. Split the integrand into u and dv.
  2. Differentiate u to get du.
  3. Integrate dv to get v (no constant is needed here).
  4. Substitute into uv - \int v\,du and finish the new integral.

The whole method depends on step 1.

How to choose u and dv (the LIATE rule)

A good choice makes \int v\,du simpler than the original. A bad choice makes it harder. The LIATE rule gives a reliable default: pick u as the function that appears first in this list, and let everything else be dv.

Letter Type of function Examples
L Logarithmic \ln x, \log_2 x
I Inverse trigonometric \arctan x, \arcsin x
A Algebraic (polynomials, powers) x, x^2, \sqrt{x}
T Trigonometric \sin x, \cos x
E Exponential e^x, 2^x

The logic is that functions near the top get simpler when differentiated (logarithms and inverse trig functions turn into algebraic ones, and powers shrink), while functions near the bottom stay about equally complex when integrated.

LIATE is a rule of thumb, not a theorem. It does not apply if the integrand is a composite function. For \int x e^{x^2}\,dx, a substitution is much faster; see Integration by Substitution.

Example 1: \int x\cos x\,dx

The integrand is algebraic times trigonometric. By LIATE, A comes before T, so:

u = x, \qquad dv = \cos x\,dx

Then:

du = dx, \qquad v = \sin x

Apply the formula:

\int x\cos x\,dx = x\sin x - \int \sin x\,dx = x\sin x + \cos x + C

Check by differentiating:

\frac{d}{dx}\left(x\sin x + \cos x\right) = \sin x + x\cos x - \sin x = x\cos x

This matches the original integrand.

You can check this step by step in the integral calculator, using the expression x*cos(x).

Example 2: \int \ln x\,dx

This integral has only one visible factor, but integration by parts still works. Write the integrand as \ln x \cdot 1:

u = \ln x, \qquad dv = dx

Then:

du = \frac{1}{x}\,dx, \qquad v = x

Apply the formula:

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

Check:

\frac{d}{dx}\left(x\ln x - x\right) = \ln x + x\cdot\frac{1}{x} - 1 = \ln x

Logarithms and inverse trig functions often have no obvious product form. In those cases, take dv = dx and let the function itself be u. The same trick gives \int \arctan x\,dx.

Repeated integration by parts and the cyclic case

Sometimes one application of the formula leaves an integral that still needs parts. Apply the method again, keeping the same type of choice each time.

Repeated parts: \int x^2 e^x\,dx

Take u = x^2 and dv = e^x\,dx, so du = 2x\,dx and v = e^x:

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

The remaining integral needs parts again, with u = x, dv = e^x\,dx:

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

Substitute back:

\int x^2 e^x\,dx = x^2 e^x - 2x e^x + 2e^x + C = e^x\left(x^2 - 2x + 2\right) + C

Check:

\frac{d}{dx}\left[e^x(x^2 - 2x + 2)\right] = e^x(x^2 - 2x + 2) + e^x(2x - 2) = x^2 e^x

The cyclic case: \int e^x \sin x\,dx

Here neither factor gets simpler. Differentiating \sin x gives \cos x, and differentiating again brings back -\sin x. The original integral reappears, and that turns out to be useful.

Let I = \int e^x\sin x\,dx. Take u = \sin x and dv = e^x\,dx, so du = \cos x\,dx and v = e^x:

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

Apply parts to the new integral, keeping the same pattern (u is the trigonometric factor, dv = e^x\,dx). Now u = \cos x, so du = -\sin x\,dx and v = e^x:

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

Substitute this into the first equation:

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

Now solve for I like an ordinary equation:

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

The constant C is added at the end, once the last integral has been absorbed.

Check:

\frac{d}{dx}\left[\frac{e^x(\sin x - \cos x)}{2}\right] = \frac{e^x(\sin x - \cos x) + e^x(\cos x + \sin x)}{2} = e^x\sin x

To see each step of this one, enter e^x*sin(x) in the integral calculator.

Two practical points about the cyclic case. Keep the same type of choice for u in both steps. If you switch (trig first, exponential second), the two steps cancel and you get the trivial identity I = I. Also, the method only works when the coefficient on the repeated integral is not 1. Here it became 2I, so you can divide.

Tabular method

When one factor is a polynomial that reaches zero after repeated differentiation, repeated parts becomes tedious. The tabular method does the same work in a table.

Take \int x^3 e^x\,dx. Make two columns. In the left column, write u and differentiate repeatedly until you reach 0. In the right column, write dv and integrate repeatedly. Alternate signs, starting with +:

Sign Differentiate u Integrate dv
x^3 e^x
+ 3x^2 e^x
- 6x e^x
+ 6 e^x
- 0 e^x

Multiply each entry in the left column by the entry one row below it in the right column, using the sign shown on that row:

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

Check:

\frac{d}{dx}\left[e^x(x^3 - 3x^2 + 6x - 6)\right] = e^x(x^3 - 3x^2 + 6x - 6) + e^x(3x^2 - 6x + 6) = x^3 e^x

The table works well for polynomials times e^x, \sin x or \cos x. It does not help for \ln x or inverse trig functions, because their derivatives never reach zero. It also does not replace the equation trick in the cyclic case.

Common mistakes

Integration by parts is mostly practice: after a few integrals of each type, the choice of u becomes automatic. Work an example by hand first, differentiate to check, and use the integral calculator to confirm the steps.