Skip to content
EN - Language: English
MathematicsHigh school

Integration by parts and substitution - two methods, step by step

· 13 min read

In short

Integration by parts reverses the product rule, and integration by substitution reverses the chain rule. Integration by parts trades the integral of a product for another, often simpler one; substitution names the inner function as a new variable u. In a definite integral the limits must be converted to the new variable, and the value of the integral stays the same.

Words to know

Integration by parts
The rule ∫u dv = uv − ∫v du, which comes from the product rule.
Integration by substitution
Replacing the inner function of a composite function by a new variable u, so that the integral gets simpler.
Differential du
For u = g(x) we write du = g′(x) dx. This is what lets you swap dx for du when you substitute.
Limits of integration
The numbers a and b of a definite integral. After a substitution they must be converted to the new variable.

What do you think?

Which of these functions has the derivative 2xcos⁡(x2)2x\cos(x^2)?

The idea: run the derivative rules in reverse

The product rule and the chain rule give you the derivative of a product and of a composite function. Integration has no such rules: the integral of a product is not the product of the integrals. Instead, two methods take those derivative rules and read them backwards:

  • the product rule gives integration by parts,
  • the chain rule gives integration by substitution.

So when you meet an integral of a product, ask whether one factor gets simpler when you differentiate it. When you meet a composite function, ask whether the derivative of its inner function (up to a constant) sits next to it.

Integration by substitution: the same area in a new variable

Go through the animation step by step with the buttons or the arrow keys. We find the area under x e−x2x\,e^{-x^2} from 00 to 22.

12340.20.40.6x = 0x = 2

area = ?

Step 1 of 5
Steps of the animation. Arrow keys move between steps.

We want the area under the graph of x·e^(−x²) from x = 0 to x = 2. The antiderivative is not obvious, so we try a change of variable.

Notice the limits: 00 and 22 have become 00 and 44, and the graph of the integrand is different too. The value we were after has not changed.

Integration by parts: the product rule in reverse

The product rule, (uv)′=u′v+uv′(uv)' = u'v + uv', gives uv′=(uv)′−u′vuv' = (uv)' - u'v. Integrate both sides and write v′ dxv'\,dx as dvdv and u′ dxu'\,dx as dudu. That is the formula for integration by parts:

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

The method pays off when the integral ∫v du\int v\,du on the right is simpler than the one you started with.

Try it yourself: the two terms of the formula

Pick a function and move the upper limit bb. Below the graph you see three numbers: the first term of the formula, [uv][uv] between the limits; the second term, ∫v du\int v\,du; and the integral itself. The integral is always the first number minus the second.

Integrand

Our choice: u = x, dv = eˣ dx → du = dx, v = eˣ

0.511.5251015
b = 1
the first term, [u·v] from a to b
2.718
the second term, ∫ v du from a to b
1.718
the integral: first term − second term
1

What to notice:

  • in all three cases, uu is the factor that gets simpler when differentiated: the derivative of xx is 11, and the derivative of ln⁡x\ln x is 1x\frac{1}{x},
  • dvdv is the rest of the integrand, and it has to be something we can integrate,
  • in ∫ln⁡x dx\int \ln x\,dx there is no visible product at all. So we write ln⁡x\ln x as ln⁡x⋅1\ln x \cdot 1 and take dv=dxdv = dx.

How to choose uu and dvdv

There is no rule that always works, but there is a simple guideline: choose them so that ∫v du\int v\,du is no harder than the original integral. In practice:

  • take as uu the factor that gets simpler when differentiated, such as xx or ln⁡x\ln x,
  • take as dvdv a factor you can integrate.

For ∫xsin⁡x dx\int x \sin x\,dx the choice u=xu = x, dv=sin⁡x dxdv = \sin x\,dx gives du=dxdu = dx and v=−cos⁡xv = -\cos x, and the new integral is just ∫(−cos⁡x) dx\int (-\cos x)\,dx. The opposite choice, u=sin⁡xu = \sin x, dv=x dxdv = x\,dx, gives v=x22v = \frac{x^2}{2} and the integral ∫x22cos⁡x dx\int \frac{x^2}{2}\cos x\,dx, which is harder than the original.

For ∫ln⁡x dx\int \ln x\,dx take u=ln⁡xu = \ln x and dv=dxdv = dx. Then du=dxxdu = \frac{dx}{x}, v=xv = x, and the second integral is ∫1 dx=x\int 1\,dx = x. The result is xln⁡x−x+Cx \ln x - x + C.

The rules

Integration by parts. For a definite integral the first term is evaluated between the limits:

∫abu dv=[uv]ab−∫abv du.\int_a^b u\,dv = \Big[uv\Big]_a^b - \int_a^b v\,du.

Integration by substitution. If u=g(x)u = g(x), then du=g′(x) dxdu = g'(x)\,dx and

∫abf(g(x)) g′(x) dx=∫g(a)g(b)f(u) du.\int_a^b f(g(x))\,g'(x)\,dx = \int_{g(a)}^{g(b)} f(u)\,du.

Why does it work? Let FF be an antiderivative of ff. By the chain rule, (F(g(x)))′=f(g(x)) g′(x)\big(F(g(x))\big)' = f(g(x))\,g'(x), so the integral on the left equals F(g(b))−F(g(a))F(g(b)) - F(g(a)). That is exactly the integral of f(u)f(u) from u=g(a)u = g(a) to u=g(b)u = g(b).

There are two ways to handle the limits of a definite integral:

  • convert them to g(a)g(a) and g(b)g(b) and finish in uu - as the animation did,
  • or find the indefinite integral in uu first, go back to xx, and use the original limits aa and bb.

Do not mix the two: the old limits belong to xx, and the new ones to uu.

Both methods reverse rules for taking derivatives, and they help you compute a definite integral when the antiderivative is not obvious.

Example 1: integration by parts - the integral of x exx\,e^x

We want ∫01x ex dx\int_0^1 x\,e^x\,dx. The integrand is xx times an exponential function, so we try integration by parts.

Step 1. Choose u and dv

The factor xx gets simpler when differentiated, and exe^x is easy to integrate.

u=xdv=ex dx\begin{aligned} u &= x \\ dv &= e^x\,dx \end{aligned}

Step 2. Find du and v

We differentiate uu and integrate dvdv.

du=dxv=ex\begin{aligned} du &= dx \\ v &= e^x \end{aligned}

Step 3. Put the pieces into the formula

The first term is uvuv, and from it we subtract the integral of v duv\,du.

∫x ex dx=x ex−∫ex dx\int x\,e^x\,dx = x\,e^x - \int e^x\,dx

Step 4. Finish the remaining integral

What is left is the integral of exe^x, and its antiderivative is exe^x again.

∫x ex dx=x ex−ex+C\boxed{\int x\,e^x\,dx = x\,e^x - e^x + C}

Step 5. Use the limits

We subtract the value of the antiderivative at 00 from its value at 11.

∫01x ex dx=(e−e)−(0−1)=1\begin{aligned} \int_0^1 x\,e^x\,dx &= (e - e) - (0 - 1) \\ &= 1 \end{aligned}

Answer

∫01x ex dx=1\int_0^1 x\,e^x\,dx = 1. This means the area under x exx\,e^x between 00 and 11 is exactly 11.

Example 2: integration by substitution - the integral of x e−x2x\,e^{-x^2}

We want ∫02x e−x2 dx\int_0^2 x\,e^{-x^2}\,dx, the area from the animation.

Step 1. Choose u

The exponent contains x2x^2, and its derivative, 2x2x, differs from the factor xx in front only by a constant.

u=x2u = x^2

Step 2. Find du

We differentiate and solve for x dxx\,dx, because that is what appears in the integral.

du=2x dxx dx=12 du\begin{aligned} du &= 2x\,dx \\ x\,dx &= \tfrac{1}{2}\,du \end{aligned}

Step 3. Convert the limits

The old limits belong to xx, so we turn them into values of uu.

x=0 ⇒ u=0x=2 ⇒ u=4\begin{aligned} x = 0 &\ \Rightarrow\ u = 0 \\ x = 2 &\ \Rightarrow\ u = 4 \end{aligned}

Step 4. Rewrite the integral

The new integral has no xx and no dxdx left - only uu.

∫02x e−x2 dx=12∫04e−u du\int_0^2 x\,e^{-x^2}\,dx = \frac{1}{2}\int_0^4 e^{-u}\,du

Step 5. Integrate and use the limits

An antiderivative of e−ue^{-u} is −e−u-e^{-u}.

12[−e−u]04=12(−e−4+1)=1−e−42≈0.491\begin{aligned} \frac{1}{2}\Big[-e^{-u}\Big]_0^4 &= \frac{1}{2}\left(-e^{-4} + 1\right) \\ &= \frac{1 - e^{-4}}{2} \approx 0.491 \end{aligned}

Answer

∫02x e−x2 dx=1−e−42≈0.491\int_0^2 x\,e^{-x^2}\,dx = \frac{1 - e^{-4}}{2} \approx 0.491 - the same area the animation shaded.

Your turn

Work out ∫0πxsin⁡x dx\int_0^{\pi} x \sin x\,dx. Which factor should be uu?

Hintshow

Take u=xu = x, because it gets simpler when differentiated. Then dv=sin⁡x dxdv = \sin x\,dx and v=−cos⁡xv = -\cos x.

Solutiontry it on your own first

Step 1. Choose u and dv

The factor xx gets simpler when differentiated, and sin⁡x\sin x is easy to integrate.

u=xdv=sin⁡x dx\begin{aligned} u &= x \\ dv &= \sin x\,dx \end{aligned}

Step 2. Find du and v

We differentiate uu and integrate dvdv.

du=dxv=−cos⁡x\begin{aligned} du &= dx \\ v &= -\cos x \end{aligned}

Step 3. Put the pieces into the formula

The first term is evaluated between the limits.

∫0πxsin⁡x dx=[−xcos⁡x]0π+∫0πcos⁡x dx\begin{aligned} \int_0^{\pi} x \sin x\,dx &= \Big[-x\cos x\Big]_0^{\pi} \\ &\quad + \int_0^{\pi} \cos x\,dx \end{aligned}

Step 4. Evaluate the first term

Put the limits into −xcos⁡x-x\cos x: at π\pi, cos⁡π=−1\cos\pi = -1, so the term is π\pi; at 00 it is 00.

[−xcos⁡x]0π=−πcos⁡π−0=π\begin{aligned} \Big[-x\cos x\Big]_0^{\pi} &= -\pi\cos\pi - 0 \\ &= \pi \end{aligned}

Step 5. Evaluate the second term

The remaining integral is a basic one: an antiderivative of cos⁡x\cos x is sin⁡x\sin x.

∫0πcos⁡x dx=sin⁡π−sin⁡0=0\int_0^{\pi} \cos x\,dx = \sin\pi - \sin 0 = 0

Answer

∫0πxsin⁡x dx=π+0=π\int_0^{\pi} x \sin x\,dx = \pi + 0 = \pi.

Common mistakes

  • The old limits after a substitution. If you write 12∫02e−u du\frac{1}{2}\int_0^2 e^{-u}\,du, you get 1−e−22≈0.432\frac{1 - e^{-2}}{2} \approx 0.432 instead of 0.4910.491. The limits 00 and 22 belonged to xx, not to uu.
  • A leftover xx in the integral. After a substitution, nothing in xx may remain, and that includes the dxdx. If a factor does not cancel, the substitution is probably not the right one. For example, ∫ex2 dx\int e^{x^2}\,dx cannot be done this way, because the factor xx is missing.
  • A lost constant factor. From du=2x dxdu = 2x\,dx you get x dx=12 dux\,dx = \frac{1}{2}\,du, not 2 du2\,du.
  • A lost minus sign in integration by parts. The formula is uv−∫v duuv - \int v\,du. It is easy to drop this minus, or the sign inside vv itself, as in v=−cos⁡xv = -\cos x.
  • A bad choice of uu and dvdv. If the new integral is harder than the old one, swap the roles. If no split helps, the method may simply not fit this integral.

At school and at university

In England, both methods are part of A-level Mathematics, though not of the AS: the national subject content asks for simple cases of each and describes them as the chain and product rules run in reverse. In the United States, integration by parts belongs to AP Calculus BC, not AB. At university, both methods are a standard part of a first calculus course, and textbooks such as Active Calculus introduce them soon after the fundamental theorem of calculus.

Sometimes one integral needs integration by parts twice, as with ∫x2ex dx\int x^2 e^x\,dx. Some functions, such as ex2e^{x^2}, have no antiderivative that can be written with elementary functions, so neither method helps there.

Check yourself

Test yourself

Integration by substitution is the reverse of which rule of differentiation?

In ∫x ex dx\int x\,e^x\,dx you take u=xu = x and dv=ex dxdv = e^x\,dx. What is vv?

You compute ∫02x e−x2 dx\int_0^2 x\,e^{-x^2}\,dx with u=x2u = x^2. What are the limits of the new integral?

What is ∫01x ex dx\int_0^1 x\,e^x\,dx?

Which choice is better for ∫xsin⁡x dx\int x \sin x\,dx?

Flashcards for review

Flip a card and say whether you knew the answer. The ones you did not know come back at the end of the deck. Why it pays to come back to them in a few days is explained in the guide Spaced repetition.

Flashcards

  1. Which derivative rule does integration by parts reverse?

    The product rule, (uv)′=u′v+uv′(uv)' = u'v + uv'.
  2. Which derivative rule does integration by substitution reverse?

    The chain rule.
  3. What is the formula for integration by parts?

    ∫u dv=uv−∫v du\int u\,dv = uv - \int v\,du
  4. What does a definite integral become after the substitution u=g(x)u = g(x)?

    ∫abf(g(x)) g′(x) dx=∫g(a)g(b)f(u) du\int_a^b f(g(x))\,g'(x)\,dx = \int_{g(a)}^{g(b)} f(u)\,du
  5. What happens to the limits when you substitute?

    You convert them to uu: g(a)g(a) and g(b)g(b). Or you keep the old limits and go back to xx at the end - but do not mix the two.
  6. How do you choose uu and dvdv in integration by parts?

    So that ∫v du\int v\,du is no harder than the original. uu gets simpler when differentiated (like xx or ln⁡x\ln x), and dvdv is something you can integrate.
  7. What is ∫x ex dx\int x\,e^x\,dx?

    x ex−ex+Cx\,e^x - e^x + C
  8. What is ∫ln⁡x dx\int \ln x\,dx?

    xln⁡x−x+Cx \ln x - x + C, with u=ln⁡xu = \ln x and dv=dxdv = dx.
  9. What is ∫02x e−x2 dx\int_0^2 x\,e^{-x^2}\,dx?

    1−e−42≈0.491\frac{1 - e^{-4}}{2} \approx 0.491, with u=x2u = x^2 and new limits 00 and 44.

Sources

We checked the facts on this page against these sources. All of them may be reused freely: they carry an open licence or are not covered by copyright.

  1. Active Calculus (Matthew Boelkins) - 5.3 Integration by Substitution (the chain rule reversed, du, changing the limits, why e^(x²) cannot be done this way) · CC BY-SA 4.0
  2. Active Calculus (Matthew Boelkins) - 5.4 Integration by Parts (the formula from the product rule, how to choose u and dv, definite integrals) · CC BY-SA 4.0
  3. Business Calculus (Calaway, Hoffman, Lippman) - 3.5 Substitution (translate every x and the dx, the limits) · CC BY 3.0
  4. Business Calculus (Calaway, Hoffman, Lippman) - 3.6 Additional Integration Techniques (the formula, x·e^x, choosing u) · CC BY 3.0
  5. Wikibooks - Calculus/Integration techniques/Integration by Parts (choosing u, x·sin x) · CC BY-SA 4.0
  6. Silvanus P. Thompson - Calculus Made Easy, 2nd edition (1914), Project Gutenberg (integration by parts from the product, x·e^x, w·sin w, ln x) · public domain
  7. Wikipedia - Integration by parts · CC BY-SA 4.0
  8. Wikipedia - Integration by substitution · CC BY-SA 4.0
  9. Wikipedia - AP Calculus (BC covers all AB topics plus integration by parts) · CC BY-SA 4.0

More explainers