Skip to content

Integration by parts: formula, choices and worked examples

Integration by parts reverses the product rule for differentiation. It is mainly used when an integrand is a product and differentiating one factor makes it simpler.

The formula is

udvdxdx=uvvdudxdx.\boxed{\int u\,\frac{dv}{dx}\,dx=uv-\int v\,\frac{du}{dx}\,dx}.

It is often written more compactly as

udv=uvvdu.\boxed{\int u\,dv=uv-\int v\,du}.

The aim is not merely to apply the formula. It is to choose uu and dvdv so that the new integral is easier than the original one.

You should be able to:

  • differentiate products using the product rule
  • differentiate and integrate powers, exponentials and trigonometric functions
  • differentiate lnx\ln x and recognise that 1dx=x\int 1\,dx=x
  • evaluate definite integrals
  • distinguish integration by parts from integration by substitution

For functions u(x)u(x) and v(x)v(x), the product rule says

ddx(uv)=udvdx+vdudx.\frac{d}{dx}(uv)=u\frac{dv}{dx}+v\frac{du}{dx}.

Integrate every term with respect to xx:

uv=udvdxdx+vdudxdx.uv=\int u\frac{dv}{dx}\,dx+\int v\frac{du}{dx}\,dx.

Rearranging gives

udvdxdx=uvvdudxdx.\int u\frac{dv}{dx}\,dx =uv-\int v\frac{du}{dx}\,dx.

This derivation explains the minus sign. It also explains why one factor is differentiated while the other is integrated.

Given an integral that can be regarded as a product:

  1. Choose uu, the factor to differentiate.
  2. Let the rest of the integrand, including dxdx, be dvdv.
  3. Find dudu by differentiating uu and find vv by integrating dvdv.
  4. Substitute into udv=uvvdu\int u\,dv=uv-\int v\,du.
  5. Simplify and check whether the remaining integral is easier.

A small table keeps the roles clear:

u=dv=dxdu=dxv=\begin{array}{c|c} u=\cdots & dv=\cdots\,dx\\ du=\cdots\,dx & v=\cdots \end{array}

Only vv is an antiderivative. Do not include an arbitrary constant when finding vv inside the method. Any such constant cancels, and the final +C+C supplies the full family of antiderivatives.

A good choice usually has both of these features:

  • differentiating uu simplifies it
  • integrating dvdv is possible immediately

For a polynomial multiplied by eaxe^{ax}, sin(ax)\sin(ax) or cos(ax)\cos(ax), choose the polynomial as uu. Each differentiation lowers its degree.

For lnx\ln x or an inverse trigonometric function, choose that function as uu and treat the integrand as a product with 11. These functions are easy to differentiate but do not have immediate standard antiderivatives at this stage.

The mnemonic LIATE can help choose uu:

  1. logarithmic functions
  2. inverse trigonometric functions
  3. algebraic functions, such as polynomials
  4. trigonometric functions
  5. exponential functions

Choose as uu the type appearing earliest in this list. LIATE is a guide, not a theorem. The decisive test is whether the new integral is simpler.

Not every product requires integration by parts. First look for a composite function accompanied by its derivative.

2xcos(x2)dx\int 2x\cos(x^2)\,dx

is best handled by substitution because 2x2x is the derivative of x2x^2. In contrast,

xcosxdx\int x\cos x\,dx

has no inner function whose derivative is the other factor, and differentiating xx simplifies it. Integration by parts is natural.

Worked example 1: xexdx\int xe^x\,dx

Section titled “Worked example 1: ∫xex dx\int xe^x\,dx∫xexdx”

Choose u=xu=x because differentiating it gives 11. Let dv=exdxdv=e^x\,dx because exe^x is easy to integrate.

u=xdv=exdxdu=dxv=ex\begin{array}{c|c} u=x & dv=e^x\,dx\\ du=dx & v=e^x \end{array}

Apply the formula:

xexdx=xexexdx=xexex+C=ex(x1)+C.\begin{aligned} \int xe^x\,dx &=xe^x-\int e^x\,dx\\ &=xe^x-e^x+C\\ &=\boxed{e^x(x-1)+C}. \end{aligned}

Differentiate to check:

ddx[ex(x1)]=ex(x1)+ex=xex.\frac{d}{dx}\left[e^x(x-1)\right] =e^x(x-1)+e^x =xe^x.

Find

xe3xdx.\int x e^{3x}\,dx.

Use u=xu=x and dv=e3xdxdv=e^{3x}\,dx. Take care when integrating the exponential:

du=dx,v=13e3x.du=dx, \qquad v=\frac13e^{3x}.

Therefore

xe3xdx=x3e3x13e3xdx=x3e3x19e3x+C=e3x9(3x1)+C.\begin{aligned} \int xe^{3x}\,dx &=\frac{x}{3}e^{3x}-\int\frac13e^{3x}\,dx\\ &=\frac{x}{3}e^{3x}-\frac19e^{3x}+C\\ &=\boxed{\frac{e^{3x}}9(3x-1)+C}. \end{aligned}

The factor 1/31/3 appears once when finding vv and again when integrating e3xe^{3x} in the remaining integral.

A polynomial times a trigonometric function

Section titled “A polynomial times a trigonometric function”

Worked example 3: xcosxdx\int x\cos x\,dx

Section titled “Worked example 3: ∫xcos⁡x dx\int x\cos x\,dx∫xcosxdx”

Let

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

Then

du=dx,v=sinx.du=dx, \qquad v=\sin x.

Hence

xcosxdx=xsinxsinxdx=xsinx+cosx+C.\begin{aligned} \int x\cos x\,dx &=x\sin x-\int\sin x\,dx\\ &=\boxed{x\sin x+\cos x+C}. \end{aligned}

The final sign is positive because sinxdx=cosx\int\sin x\,dx=-\cos x, and the formula already contains a subtraction.

Find

xsin(2x)dx.\int x\sin(2x)\,dx.

Choose u=xu=x and dv=sin(2x)dxdv=\sin(2x)\,dx. Then

du=dx,v=12cos(2x).du=dx, \qquad v=-\frac12\cos(2x).

Thus

xsin(2x)dx=x2cos(2x)(12cos(2x))dx=x2cos(2x)+12cos(2x)dx=x2cos(2x)+14sin(2x)+C.\begin{aligned} \int x\sin(2x)\,dx &=-\frac{x}{2}\cos(2x) -\int\left(-\frac12\cos(2x)\right)dx\\ &=-\frac{x}{2}\cos(2x)+\frac12\int\cos(2x)\,dx\\ &=\boxed{-\frac{x}{2}\cos(2x)+\frac14\sin(2x)+C}. \end{aligned}

If uu is a polynomial of degree 22 or more, one application usually leaves another product requiring integration by parts. Keep differentiating the polynomial until it becomes zero.

Find

x2exdx.\int x^2e^x\,dx.

First use u=x2u=x^2 and dv=exdxdv=e^x\,dx:

x2exdx=x2ex2xexdx=x2ex2xexdx.\begin{aligned} \int x^2e^x\,dx &=x^2e^x-\int 2xe^x\,dx\\ &=x^2e^x-2\int xe^x\,dx. \end{aligned}

The remaining integral is Example 1, or can be handled by parts again:

xexdx=xexex.\int xe^x\,dx=xe^x-e^x.

Therefore

x2exdx=x2ex2(xexex)+C=ex(x22x+2)+C.\begin{aligned} \int x^2e^x\,dx &=x^2e^x-2(xe^x-e^x)+C\\ &=\boxed{e^x(x^2-2x+2)+C}. \end{aligned}

There is only one arbitrary constant, written after the whole calculation.

For repeated products of a polynomial with a repeatedly integrable function, the same work can be organised as follows:

signdifferentiate x2integrate ex+x2ex2xex+2ex0ex\begin{array}{c|c|c} \text{sign} & \text{differentiate }x^2 & \text{integrate }e^x\\ \hline + & x^2 & e^x\\ - & 2x & e^x\\ + & 2 & e^x\\ - & 0 & e^x \end{array}

Multiply diagonally and add:

x2ex2xex+2ex+C.x^2e^x-2xe^x+2e^x+C.

The tabular method is compressed repeated integration by parts. It should not replace understanding of the formula.

An expression such as lnx\ln x is secretly a product:

lnx=1lnx.\ln x=1\cdot\ln x.

Choose u=lnxu=\ln x, since it becomes the simpler function 1/x1/x when differentiated, and choose dv=dxdv=dx.

Worked example 6: lnxdx\int\ln x\,dx

Section titled “Worked example 6: ∫ln⁡x dx\int\ln x\,dx∫lnxdx”

For x>0x>0,

u=lnx,dv=dx,du=1xdx,v=x.u=\ln x, \qquad dv=dx, \qquad du=\frac1x\,dx, \qquad v=x.

Then

lnxdx=xlnxx(1x)dx=xlnx1dx=xlnxx+C.\begin{aligned} \int\ln x\,dx &=x\ln x-\int x\left(\frac1x\right)dx\\ &=x\ln x-\int1\,dx\\ &=\boxed{x\ln x-x+C}. \end{aligned}

More generally, on any interval not crossing x=0x=0,

lnxdx=xlnxx+C.\int\ln|x|\,dx=x\ln|x|-x+C.

Worked example 7: an algebraic factor with a logarithm

Section titled “Worked example 7: an algebraic factor with a logarithm”

Find

xlnxdx,x>0.\int x\ln x\,dx, \qquad x>0.

LIATE suggests choosing u=lnxu=\ln x. Put the remaining factor into dvdv:

u=lnx,dv=xdx,du=1xdx,v=x22.u=\ln x, \quad dv=x\,dx, \quad du=\frac1x\,dx, \quad v=\frac{x^2}{2}.

Therefore

xlnxdx=x22lnxx221xdx=x22lnx12xdx=x22lnxx24+C.\begin{aligned} \int x\ln x\,dx &=\frac{x^2}{2}\ln x -\int\frac{x^2}{2}\frac1x\,dx\\ &=\frac{x^2}{2}\ln x-\frac12\int x\,dx\\ &=\boxed{\frac{x^2}{2}\ln x-\frac{x^2}{4}+C}. \end{aligned}

Choosing u=xu=x would force you to integrate lnx\ln x before you had solved that problem, so it does not simplify the work.

For limits aa and bb, integration by parts becomes

abudv=[uv]ababvdu.\boxed{\int_a^b u\,dv=[uv]_a^b-\int_a^b v\,du}.

Keep the limits on the remaining integral and evaluate the boundary term at both endpoints. An alternative is to find an indefinite antiderivative first and then apply the limits. Do not mix the two approaches halfway through.

Worked example 8: definite integration by parts

Section titled “Worked example 8: definite integration by parts”

Evaluate

01xe2xdx.\int_0^1 xe^{2x}\,dx.

Let u=xu=x and dv=e2xdxdv=e^{2x}\,dx. Then du=dxdu=dx and v=12e2xv=\frac12e^{2x}.

01xe2xdx=[x2e2x]011201e2xdx=e2212[12e2x]01=e2214(e21)=e2+14.\begin{aligned} \int_0^1xe^{2x}\,dx &=\left[\frac{x}{2}e^{2x}\right]_0^1 -\frac12\int_0^1e^{2x}\,dx\\ &=\frac{e^2}{2}-\frac12\left[\frac12e^{2x}\right]_0^1\\ &=\frac{e^2}{2}-\frac14(e^2-1)\\ &=\boxed{\frac{e^2+1}{4}}. \end{aligned}

The value is positive, as expected because xe2x0xe^{2x}\geq0 on [0,1][0,1].

Worked example 9: logarithm with an endpoint

Section titled “Worked example 9: logarithm with an endpoint”

Evaluate

1elnxdx.\int_1^e\ln x\,dx.

Using lnxdx=xlnxx\int\ln x\,dx=x\ln x-x,

1elnxdx=[xlnxx]1e=(ee)(01)=1.\begin{aligned} \int_1^e\ln x\,dx &=[x\ln x-x]_1^e\\ &=(e-e)-(0-1)\\ &=\boxed{1}. \end{aligned}

For some products, applying integration by parts twice produces the original integral. This is useful: collect that integral algebraically and solve for it.

Worked example 10: excosxdx\int e^x\cos x\,dx

Section titled “Worked example 10: ∫excos⁡x dx\int e^x\cos x\,dx∫excosxdx”

Let

I=excosxdx.I=\int e^x\cos x\,dx.

Choose u=cosxu=\cos x and dv=exdxdv=e^x\,dx:

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

Apply integration by parts to the new integral, choosing u=sinxu=\sin x and dv=exdxdv=e^x\,dx:

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

Substitute this back:

I=excosx+exsinxI.I=e^x\cos x+e^x\sin x-I.

Now solve for II:

2I=ex(sinx+cosx),2I=e^x(\sin x+\cos x),

so

excosxdx=12ex(sinx+cosx)+C.\boxed{\int e^x\cos x\,dx =\frac12e^x(\sin x+\cos x)+C}.

Do not continue applying integration by parts in a loop. As soon as the original integral reappears, treat it as an algebraic unknown.

For xlnxdx\int x\ln x\,dx, choosing u=xu=x and dv=lnxdxdv=\ln x\,dx is unhelpful because finding vv is already the main problem. Choose u=lnxu=\ln x instead.

The formula is

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

not uv+vduuv+\int v\,du. Derive it quickly from the product rule if uncertain.

Integration by parts does not replace fgdx\int fg\,dx with fgdx\int f'g'\,dx. One chosen part is differentiated and the other is integrated.

If dv=e4xdxdv=e^{4x}\,dx, then v=14e4xv=\frac14e^{4x}. If dv=sin(3x)dxdv=\sin(3x)\,dx, then v=13cos(3x)v=-\frac13\cos(3x). Differentiate vv mentally to check it returns dv/dxdv/dx.

The integral x(x2+1)5dx\int x(x^2+1)^5\,dx is better handled by substitution because the derivative of x2+1x^2+1 is proportional to xx.

In [uv]ab[uv]_a^b, both uu and vv are evaluated at both limits. The remaining integral also retains the limits aa and bb.

Try each question before opening its answer.

Find

xcos(3x)dx.\int x\cos(3x)\,dx.
Answer

Take u=xu=x and dv=cos(3x)dxdv=\cos(3x)\,dx. Then du=dxdu=dx and v=13sin(3x)v=\frac13\sin(3x).

xcos(3x)dx=x3sin(3x)13sin(3x)dx=x3sin(3x)+19cos(3x)+C.\begin{aligned} \int x\cos(3x)\,dx &=\frac{x}{3}\sin(3x)-\frac13\int\sin(3x)\,dx\\ &=\boxed{\frac{x}{3}\sin(3x)+\frac19\cos(3x)+C}. \end{aligned}

Find

x2sinxdx.\int x^2\sin x\,dx.
Answer

First choose u=x2u=x^2 and dv=sinxdxdv=\sin x\,dx:

x2sinxdx=x2cosx+2xcosxdx=x2cosx+2(xsinx+cosx)+C=x2cosx+2xsinx+2cosx+C.\begin{aligned} \int x^2\sin x\,dx &=-x^2\cos x+2\int x\cos x\,dx\\ &=-x^2\cos x+2(x\sin x+\cos x)+C\\ &=\boxed{-x^2\cos x+2x\sin x+2\cos x+C}. \end{aligned}

Find, for x>0x>0,

x3lnxdx.\int x^3\ln x\,dx.
Answer

Choose u=lnxu=\ln x and dv=x3dxdv=x^3\,dx. Then du=1xdxdu=\frac1x\,dx and v=x44v=\frac{x^4}{4}.

x3lnxdx=x44lnx14x3dx=x44lnxx416+C.\begin{aligned} \int x^3\ln x\,dx &=\frac{x^4}{4}\ln x-\frac14\int x^3\,dx\\ &=\boxed{\frac{x^4}{4}\ln x-\frac{x^4}{16}+C}. \end{aligned}

Evaluate

0π/2xsinxdx.\int_0^{\pi/2}x\sin x\,dx.
Answer

Take u=xu=x and dv=sinxdxdv=\sin x\,dx, so du=dxdu=dx and v=cosxv=-\cos x.

0π/2xsinxdx=[xcosx]0π/2+0π/2cosxdx=0+[sinx]0π/2=1.\begin{aligned} \int_0^{\pi/2}x\sin x\,dx &=[-x\cos x]_0^{\pi/2}+\int_0^{\pi/2}\cos x\,dx\\ &=0+[\sin x]_0^{\pi/2}\\ &=\boxed{1}. \end{aligned}

State the best main method for each integral.

(a) xex2dx,(b) x2exdx,(c) lnxdx.\text{(a) }\int xe^{x^2}\,dx, \qquad \text{(b) }\int x^2e^x\,dx, \qquad \text{(c) }\int\ln x\,dx.
Answer
  • (a) Substitution, because xx is proportional to the derivative of the exponent x2x^2.
  • (b) Repeated integration by parts, choosing u=x2u=x^2.
  • (c) Integration by parts, writing the integrand as 1lnx1\cdot\ln x and choosing u=lnxu=\ln x.

The essential facts are:

udv=uvvdu,\int u\,dv=uv-\int v\,du,
  • choose uu so that differentiating it simplifies the expression
  • choose dvdv so that it can be integrated immediately
  • expect repeated applications when uu is a polynomial of degree greater than 11
  • write logarithms as products with 11
  • preserve limits throughout a definite integral
  • if the original integral returns, collect it algebraically
  • verify an indefinite answer by differentiation

Next, compare this technique with integration by substitution and learn how partial fractions prepare rational functions for integration. For mixed questions, practise choosing an appropriate method.