Calculus

Integration by Substitution With Worked Examples

A step-by-step method for u-substitution, with worked examples, changed limits, and the mistakes that trip people up.

Key takeaways

  • Choose u, compute du = u′(x) dx, and rewrite the whole integral so that no x remains.
  • A missing constant factor is easy to repair, but a missing factor containing x cannot be pulled out of or pushed into an integral.
  • For definite integrals, convert the limits to u-values and you never need to return to x.
  • Always check an indefinite integral by differentiating your answer.

Integration by substitution is the chain rule run backward. When an integral contains a function tucked inside another, along with something close to the inner function's derivative, you rename the inner part u, rewrite everything in terms of u, and integrate a simpler expression.

It is the first technique to try on any integral that is not in your basic table. This guide gives the method, works through the main patterns, and shows where it cannot help.

Where the rule comes from

The chain rule says that if F′ = f, then the derivative of F(g(x)) is f(g(x))·g′(x). Reading that equation from right to left gives:

∫ f(g(x))·g′(x) dx = F(g(x)) + C

With u = g(x) and du = g′(x) dx, this becomes the plain statement ∫ f(u) du = F(u) + C. The differential notation does the bookkeeping for you: g′(x) dx collapses into du.

The method in five steps

  1. Pick a candidate u, usually an inner function: something inside a root, a power, an exponent, a logarithm or a trigonometric function.
  2. Differentiate it and write du = u′(x) dx.
  3. Replace every piece of the integrand, including dx, with expressions in u.
  4. Integrate with respect to u.
  5. Substitute back to x, or use new limits if the integral is definite.

If any x survives step 3 and you cannot express it through u, try a different choice.

The u-substitution routine
1 Spot an inner function Look inside roots, powers and exponents 2 Find du du = u′(x) dx 3 Convert everything No x may remain 4 Integrate in u Use a basic rule 5 Return and check Back to x, then differentiate Spot an inner function Look inside roots, powers and exponents 1 Find du du = u′(x) dx 2 Convert everything No x may remain 3 Integrate in u Use a basic rule 4 Return and check Back to x, then differentiate 5

Example: the derivative is already there

Evaluate ∫ 2x cos(x²) dx. The inner function is x², and its derivative 2x sits right beside the cosine.

u = x²,  du = 2x dx
∫ cos u du = sin u + C
           = sin(x²) + C

Differentiating sin(x²) gives cos(x²)·2x, which matches.

Now evaluate ∫ x√(x² + 1) dx. Let u = x² + 1, so du = 2x dx. You have x dx, which is half of du.

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

Constants can move freely across the integral sign, so the factor of 1/2 causes no trouble.

Linear inner functions

When the inside is ax + b with a ≠ 0, then du = a dx, and the effect is always to divide by a.

Integral Substitution Result
∫ e^(3x) dx u = 3x e^(3x)/3 + C
∫ cos(5x − 2) dx u = 5x − 2 sin(5x − 2)/5 + C
∫ (2x + 7)⁴ dx u = 2x + 7 (2x + 7)⁵/10 + C
∫ 1/(4x + 1) dx u = 4x + 1 (1/4) ln|4x + 1| + C

After a little practice you can do these by sight. The shortcut is valid only for linear insides, though.

Logarithms hiding in fractions

If the numerator is the derivative of the denominator, the integral is the natural logarithm of the denominator's absolute value:

∫ g′(x)/g(x) dx = ln|g(x)| + C

This handles the tangent function. Write tan x = sin x/cos x and let u = cos x, so du = −sin x dx.

∫ tan x dx = −∫ du/u = −ln|u| + C = −ln|cos x| + C

The formula holds on any interval where cos x ≠ 0. The absolute value matters, since cos x is negative on some of those intervals.

When leftover x must be rewritten

Sometimes du does not absorb everything, but you can solve for x in terms of u. Take ∫ x√(x − 1) dx for x ≥ 1.

u = x − 1,  x = u + 1,  dx = du
∫ (u + 1)·√u du = ∫ (u^(3/2) + u^(1/2)) du
                = (2/5)u^(5/2) + (2/3)u^(3/2) + C

Then replace u with x − 1.

A root can also be substituted away. For ∫ 1/(1 + √x) dx with x ≥ 0, let u = √x. Then x = u² and dx = 2u du.

∫ 2u/(1 + u) du = ∫ (2 − 2/(1 + u)) du
                = 2u − 2 ln(1 + u) + C
                = 2√x − 2 ln(1 + √x) + C

Definite integrals: move the limits

With limits, you can translate them along with the variable. Evaluate the integral of x/(x² + 1) from 0 to 2. Let u = x² + 1, so x dx = du/2. When x = 0, u = 1. When x = 2, u = 5.

(1/2) ∫₁⁵ du/u = (1/2)(ln 5 − ln 1) = (ln 5)/2 ≈ 0.805

Another: the integral of 3x²(x³ + 1)⁴ from 0 to 1. With u = x³ + 1 the limits become 1 and 2, and the value is (2⁵ − 1⁵)/5 = 31/5.

The error to avoid is writing an integral in u while keeping the x-limits. If you would rather keep the original limits, find the antiderivative in x first and then evaluate, as the fundamental theorem allows. Either route is fine if you do not mix them.

The new limits may come out in reverse order. Leave them as they are; the sign takes care of itself.

Powers of sine and cosine

Odd powers of sine or cosine are a classic target. The trick is to save one factor to serve as part of du, then convert the rest with sin²x + cos²x = 1.

∫ sin³x dx = ∫ (1 − cos²x) sin x dx        (split off one sine)
u = cos x,  du = −sin x dx
           = −∫ (1 − u²) du
           = −u + u³/3 + C
           = −cos x + cos³x/3 + C

Differentiate to confirm: you get sin x − cos²x sin x, which is sin x(1 − cos²x) = sin³x.

Even powers do not leave a spare factor in the same way. For those, use the half-angle identity, such as cos²x = (1 + cos 2x)/2, and then a linear substitution.

Two good choices for one integral

Often more than one substitution works. Consider ∫ x³√(x² + 1) dx.

One route is u = x² + 1. Then x dx = du/2, and the leftover x² equals u − 1. The integral becomes half of ∫ (u − 1)√u du, which gives (1/5)u^(5/2) − (1/3)u^(3/2) + C.

A second route takes u to be the whole root, u = √(x² + 1). Then u² = x² + 1, so u du = x dx. The integral becomes ∫ (u² − 1)·u·u du = u⁵/5 − u³/3 + C. This is the same result, reached with whole-number powers.

When a root is causing the awkwardness, naming the entire root is often worth trying.

Using symmetry

The substitution u = −x proves two time savers for a continuous function on an interval from −a to a. If f is odd, meaning f(−x) = −f(x), the two halves cancel and the integral is zero. If f is even, meaning f(−x) = f(x), the integral is twice the integral from 0 to a.

So the integral of x³cos x from −2 to 2 is zero, with no antiderivative needed. The integral of x² from −3 to 3 is twice 9, or 18. Check that the interval is centered at zero before using either rule.

What a change of variable does to the picture

A substitution does more than rename a letter. It stretches and squeezes the horizontal axis, and the factor u′(x) records by how much.

Take the integral from 0 to 5/2 of 2/(2x + 1) with u = 2x + 1. The x-interval has length 2.5, while the u-interval runs from 1 to 6 and has length 5, exactly twice as long. Since the axis was stretched by a factor of 2, the heights must be halved to keep the same area. That is what happens: 2 dx becomes du, and you integrate 1/u from 1 to 6 to get ln 6.

For a curved substitution such as u = x², the stretching differs from place to place. Near x = 0.1 a small step in x becomes a step only about a fifth as long in u. Near x = 3 it becomes about six times as long. The factor 2x in du = 2x dx is that local stretch, the same idea that reappears in two and three dimensions as the Jacobian.

Common mistakes and limits of the method

Inventing a factor. To integrate cos(x²), you cannot write sin(x²)/(2x). Dividing by a variable does not undo the chain rule, and differentiating that expression shows it. In fact cos(x²) has no elementary antiderivative at all.

Forgetting dx. Replacing dx with du without the conversion factor is the most frequent slip.

Leaving a mixture. An integral containing both x and u cannot be integrated in u as if x were constant.

Using a substitution that breaks. The change of variable should be continuously differentiable across the interval. A choice like u = 1/x is not allowed on an interval containing 0.

When substitution stalls, consider the alternatives. A product of unrelated factors such as x eˣ calls for integration by parts. A ratio of polynomials often yields to partial fractions. Expressions like √(4 − x²) with no helpful x outside the root suggest a trigonometric substitution, which is the same idea run in the other direction.

How to practice choosing u

Judgment comes from doing many examples and noticing what worked. Before computing, ask which part of the integrand would make the expression simple if it were a single letter, and whether its derivative, up to a constant, appears as a factor.

Try these: ∫ x² e^(x³) dx, ∫ (ln x)/x dx for x > 0, and ∫ sin³x cos x dx. The answers are e^(x³)/3 + C, (ln x)²/2 + C and sin⁴x/4 + C. If a first guess fails, little is lost: a poor substitution usually announces itself within two lines.

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 39 articles in Calculus →

Latest news on this topic