Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 39 · Integrals

Integration by Substitution

Learn u-substitution, the reverse of the chain rule: choose u, change dx, integrate, and handle definite integrals, with worked examples and checks.

Some integrals look hard until you spot a hidden pattern. Take ∫ 2x · cos(x²) dx. None of the basic rules fit directly. But notice that 2x is the derivative of x², the "inside" of the cosine. This pattern is the chain rule run backwards, and the technique that exploits it is called substitution (or u-substitution).

Where it comes from

The chain rule says d/dx [F(g(x))] = F'(g(x)) · g'(x). Reading that backwards:

Text
∫ f(g(x)) · g'(x) dx = F(g(x)) + C      where F' = f

To use it, give the inside part a new name u = g(x). Then du = g'(x) dx, and the integral turns into a simpler one in u:

Text
∫ f(u) du = F(u) + C

Finally substitute back u = g(x).

The recipe

  1. Choose u, usually the "inside" of a composite function, or something whose derivative also appears in the integrand.
  2. Compute du = u' dx, and solve for dx (or for the leftover pieces).
  3. Rewrite the whole integral in terms of u. No x should remain.
  4. Integrate with respect to u.
  5. Substitute back to get an answer in x. Check by differentiating.

Worked examples

Example 1. ∫ 2x cos(x²) dx. Let u = x², so du = 2x dx. The integral is ∫ cos u du = sin u + C = sin(x²) + C. Differentiate to check: cos(x²) · 2x. Correct.

Example 2. ∫ (3x + 1)⁵ dx. Let u = 3x + 1, so du = 3 dx, which means dx = du/3:

Text
∫ u⁵ · (1/3) du = (1/3) · u⁶/6 + C = (3x + 1)⁶ / 18 + C

Example 3. ∫ x √(x² + 4) dx. Let u = x² + 4, so du = 2x dx, giving x dx = du/2:

Text
∫ √u · (1/2) du = (1/2) · (2/3) u^(3/2) + C = (1/3)(x² + 4)^(3/2) + C

Example 4. ∫ eˣ/(1 + eˣ) dx. Let u = 1 + eˣ, so du = eˣ dx: ∫ du/u = ln(abs(u)) + C = ln(1 + eˣ) + C. (We can drop the absolute value because 1 + eˣ is always positive.)

The code below lets sympy verify each answer by differentiating it and comparing with the original integrand.

Python Verify substitution answers by differentiating

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Definite integrals with substitution

For a definite integral you have two options. You can find the antiderivative in x first and then use the limits, or you can change the limits to values of u and never go back to x.

Example. ∫ from 0 to 2 of x(x² + 1)³ dx. Let u = x² + 1, so du = 2x dx and x dx = du/2. When x = 0, u = 1. When x = 2, u = 5.

Text
∫ from 1 to 5 of u³ · (1/2) du = (1/2) [u⁴/4] from 1 to 5 = (625 - 1)/8 = 78

When you change the variable in a definite integral, you must change the limits too. Writing x-limits next to a u-integral is a classic error.

Python Definite integral with changed limits

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Choosing u wisely

  • Look for a function inside another function: inside a root, a power, sin, cos, eˣ or ln.
  • Check whether the derivative of that inner piece (up to a constant) also appears as a factor.
  • If u = g(x) does not remove all x terms, try a different u.
  • Constants can always be fixed: du = 3 dx means dx = du/3. But a leftover variable factor cannot be: for ∫ cos(x²) dx there is no 2x to pair with, and substitution does not work.

Substitution is a skill that improves with practice. Do many examples and always differentiate your result to check.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Which substitution works best for ∫ x · (x² + 3)⁴ dx?

    With u = x² + 3 we get du = 2x dx, so x dx = du/2 and the integral becomes (1/2)∫ u⁴ du.
  2. 2. ∫ 2x cos(x²) dx equals

    With u = x², the integral is ∫ cos u du = sin u + C = sin(x²) + C.
  3. 3. For ∫ from 0 to 1 of 2x(x² + 1) dx with u = x² + 1, the new limits are

    At x = 0, u = 1. At x = 1, u = 2.
  4. 4. Substitution is the reverse of which differentiation rule?

    The chain rule differentiates f(g(x)) to f'(g(x))g'(x); substitution recognizes that pattern and undoes it.

Summary

  • Substitution reverses the chain rule: set u = g(x), replace g'(x) dx by du, integrate in u, then substitute back.
  • For definite integrals, change the limits to u-values.
  • Choose u as an inner function whose derivative also appears.
  • Always verify by differentiating the result.

Next: Area Between Curves