Integration by parts: formulas, proof, and four useful patterns

Original publication: Updated:

The formulas

Integration by parts rewrites an integral of a product so that one factor is differentiated and the other integrated. In the familiar notation,

∫u dv=uv−∫v du.\boxed{\int u\,dv=uv-\int v\,du.}

Equivalently, for suitably differentiable functions f,gf,g on an interval,

∫f(x)g′(x) dx=f(x)g(x)−∫f′(x)g(x) dx.\int f(x)g'(x)\,dx=f(x)g(x)-\int f'(x)g(x)\,dx.

Indefinite-integral identities are understood up to an arbitrary constant. For continuously differentiable f,gf,g on a closed interval [a,b][a,b], the definite-integral formula is

∫abf(x)g′(x) dx=[f(x)g(x)]ab−∫abf′(x)g(x) dx.\boxed{\int_a^b f(x)g'(x)\,dx=[f(x)g(x)]_a^b-\int_a^b f'(x)g(x)\,dx.}

The boundary term is f(b)g(b)−f(a)g(a)f(b)g(b)-f(a)g(a); forgetting the lower endpoint changes the answer.

Proof from the product rule

Differentiate the product:

(fg)′=f′g+fg′.(fg)'=f'g+fg'.

Rearrange to fg′=(fg)′−f′gfg'=(fg)'-f'g and integrate both sides. For indefinite integrals this gives the first formula. Integrating from aa to bb and using the fundamental theorem of calculus gives the definite version.

A useful verbal reminder is: integrate one factor, keep the product, then subtract the integral with the differentiation transferred to the other factor. The minus sign comes directly from rearranging the product rule.

How to choose the factors

The goal is to simplify the remaining integral, not merely to apply the formula. Four common situations are:

  1. A logarithm: differentiating it often makes the expression simpler.
  2. A polynomial times a sine or cosine: differentiate the polynomial.
  3. A polynomial times an exponential: again differentiate the polynomial.
  4. An exponential times a trigonometric function: repeat the process until the original integral reappears, then solve for it.

These are useful patterns rather than requirements. Sometimes substitution or a trigonometric identity should come first.

Example 1: a logarithmic integral

Problem. Find ∫x(ln⁡x)2 dx\int x(\ln x)^2\,dx for x>0x>0.

Choose u=(ln⁡x)2u=(\ln x)^2 and dv=x dxdv=x\,dx. Then

du=2ln⁡xx dx,v=x22.du=\frac{2\ln x}{x}\,dx,\qquad v=\frac{x^2}2.

Integration by parts gives

∫x(ln⁡x)2 dx=x22(ln⁡x)2−∫xln⁡x dx.\int x(\ln x)^2\,dx=\frac{x^2}2(\ln x)^2-\int x\ln x\,dx.

For the remaining integral, choose u=ln⁡xu=\ln x, dv=x dxdv=x\,dx:

∫xln⁡x dx=x22ln⁡x−∫x2 dx=x22ln⁡x−x24+C.\int x\ln x\,dx=\frac{x^2}2\ln x-\int\frac x2\,dx=\frac{x^2}2\ln x-\frac{x^2}4+C.

Hence

∫x(ln⁡x)2 dx=x22(ln⁡x)2−x22ln⁡x+x24+C.\boxed{\int x(\ln x)^2\,dx=\frac{x^2}2(\ln x)^2-\frac{x^2}2\ln x+\frac{x^2}4+C.}

Here ln⁡\ln denotes the natural logarithm. The original Japanese article writes this logarithm as log⁡\log; specifying the base avoids an ambiguity in English notation.

Choosing the logarithm as the factor to integrate would generally make the work longer. Differentiating it instead reduces its power at each step.

Example 2: a polynomial times a trigonometric function

Problem. Find ∫x2sin⁡x dx\int x^2\sin x\,dx.

Take u=x2u=x^2, dv=sin⁡x dxdv=\sin x\,dx. Since v=−cos⁡xv=-\cos x,

∫x2sin⁡x dx=−x2cos⁡x+2∫xcos⁡x dx.\int x^2\sin x\,dx=-x^2\cos x+2\int x\cos x\,dx.

Apply integration by parts again, now with u=xu=x and dv=cos⁡x dxdv=\cos x\,dx:

∫xcos⁡x dx=xsin⁡x−∫sin⁡x dx=xsin⁡x+cos⁡x+C.\int x\cos x\,dx=x\sin x-\int\sin x\,dx=x\sin x+\cos x+C.

Therefore

∫x2sin⁡x dx=−x2cos⁡x+2xsin⁡x+2cos⁡x+C.\boxed{\int x^2\sin x\,dx=-x^2\cos x+2x\sin x+2\cos x+C.}

The polynomial degree drops from two to one and then to zero. Sines and cosines remain equally manageable when integrated, which makes this a productive choice of factors.

For a product containing sin⁡2x\sin^2x or cos⁡2x\cos^2x, a power-reduction identity may simplify the trigonometric factor before integration by parts.

Example 3: a polynomial times an exponential

Problem. Find ∫x2ex dx\int x^2e^x\,dx.

Differentiate the polynomial and integrate exe^x repeatedly:

∫x2ex dx=x2ex−2∫xex dx=x2ex−2(xex−∫ex dx)=ex(x2−2x+2)+C.\begin{aligned} \int x^2e^x\,dx &=x^2e^x-2\int xe^x\,dx\\ &=x^2e^x-2\left(xe^x-\int e^x\,dx\right)\\ &=\boxed{e^x(x^2-2x+2)+C.} \end{aligned}

For a check, differentiate the last expression:

ddx{ex(x2−2x+2)}=ex{x2−2x+2+2x−2}=x2ex.\frac{d}{dx}\{e^x(x^2-2x+2)\}=e^x\{x^2-2x+2+2x-2\}=x^2e^x.

For ecxe^{cx} with nonzero constant cc, remember that its antiderivative is ecx/ce^{cx}/c, so each integration introduces a factor 1/c1/c.

Example 4: an integral that returns to itself

Problem. Find ∫exsin⁡x dx\int e^x\sin x\,dx.

Let II denote an antiderivative of exsin⁡xe^x\sin x. Choose the exponential as the factor to integrate:

I=exsin⁡x−∫excos⁡x dx.I=e^x\sin x-\int e^x\cos x\,dx.

Use the same choice on the remaining integral:

∫excos⁡x dx=excos⁡x+∫exsin⁡x dx.\int e^x\cos x\,dx=e^x\cos x+\int e^x\sin x\,dx.

Thus, up to an additive constant,

I=exsin⁡x−excos⁡x−I.I=e^x\sin x-e^x\cos x-I.

Move the final II to the left and divide by two:

∫exsin⁡x dx=ex2(sin⁡x−cos⁡x)+C.\boxed{\int e^x\sin x\,dx=\frac{e^x}2(\sin x-\cos x)+C.}

You could instead integrate the trigonometric factor each time. What matters is to make a consistent choice so that the second application produces a useful relation, rather than merely undoing the first.

Definite integrals use the same choices

For example, integrating xexxe^x from 00 to 11 gives

∫01xex dx=[xex]01−∫01ex dx=e−(e−1)=1.\int_0^1xe^x\,dx=[xe^x]_0^1-\int_0^1e^x\,dx=e-(e-1)=1.

There is no arbitrary constant in the final definite value. For improper integrals, first apply the formula on a finite interval and then justify the required limits.

Checking your work

For an indefinite answer, differentiation is the most direct check. For a definite answer, check both endpoints and the sign of the value against the sign of the integrand. Repeated integration by parts should either simplify the remaining integral or produce an equation involving the original one.

The product-rule proof also resembles the cancellation behind telescoping sums: both methods move a difference or derivative from one part of an expression to another.

Related articles

About the author

Koki Saito

Physician and graduate of the University of Tokyo Faculty of Medicine. Drawing on his entrance-exam experience, he explains how to choose mathematical methods and construct complete solutions.

Full profile →

Have a question or spotted an error? Contact us.