# U-Substitution: How to Choose u, With Worked Examples

> Learn u-substitution step by step: how to choose u, how to change the bounds of a definite integral, worked examples, and when the method fails.

Source: https://practicecalculus.com/blog/u-substitution
Updated: 2026-08-21

## Key takeaways

- U-substitution reverses the chain rule: if the integrand looks like $f(g(x))\,g'(x)$, set $u = g(x)$ and $du = g'(x)\,dx$.
- Choose $u$ to be the inside function whose derivative also appears (up to a constant) somewhere in the integrand.
- For a definite integral, either change the bounds to $u$-values or switch back to $x$ before plugging in, but never mix the two.
- After substituting, every $x$ must be gone. If one is left over and you cannot rewrite it in terms of $u$, try a different $u$ or a different method.

You know $\int \cos u\,du = \sin u + C$. But what about $\int 2x\cos(x^2)\,dx$? None of the basic rules applies directly, and there is no product rule for integrals. **U-substitution** is the tool that turns integrals like this back into ones you already know, and it is the first technique to reach for on almost any integral.

## What is u-substitution?

U-substitution (also called integration by substitution or change of variables) is the **chain rule in reverse**. The chain rule says

$$\frac{d}{dx}\,F(g(x)) = F'(g(x))\cdot g'(x).$$

So any integrand with the shape "a function of $g(x)$, times $g'(x)$" has an easy antiderivative. Setting $u = g(x)$ makes that shape obvious:

$$\int f(g(x))\,g'(x)\,dx = \int f(u)\,du, \qquad u = g(x),\quad du = g'(x)\,dx.$$

In words: rename the inside function as $u$, replace $g'(x)\,dx$ with $du$, integrate in $u$, then put $g(x)$ back.

## The u-substitution method in five steps

1. **Choose $u$.** Pick an inside function $g(x)$.
2. **Find $du$.** Differentiate: $du = g'(x)\,dx$.
3. **Rewrite everything in $u$.** Replace $g(x)$ with $u$ and $g'(x)\,dx$ with $du$. No $x$ may remain.
4. **Integrate** the new, simpler integral.
5. **Substitute back** $u = g(x)$ and add $+C$.

## How to choose u

Most of the skill in u-substitution is picking $u$. Ask: **is there a function inside another function whose derivative is also sitting in the integrand?** If yes, that inside function is your $u$.

| Integrand                   | Good choice of $u$ | Why it works                         |
| --------------------------- | ------------------ | ------------------------------------ |
| $2x\cos(x^2)$               | $x^2$              | $du = 2x\,dx$ is right there         |
| $x(x^2+3)^4$                | $x^2+3$            | $du = 2x\,dx$, and $x\,dx$ is present |
| $\frac{e^x}{e^x+1}$         | $e^x+1$            | $du = e^x\,dx$ is the numerator      |
| $\tan x\sec^2 x$            | $\tan x$           | $du = \sec^2 x\,dx$                  |
| $\frac{\ln x}{x}$           | $\ln x$            | $du = \frac{1}{x}\,dx$               |
| $\sin^4 x \cos x$           | $\sin x$           | $du = \cos x\,dx$                    |

Some useful patterns:

- **Something in parentheses raised to a power:** let $u$ be what is in the parentheses.
- **A fraction whose numerator is (almost) the derivative of the denominator:** let $u$ be the denominator. The answer will involve $\ln|u|$.
- **An exponential or trig function with a complicated argument:** let $u$ be the argument.

> **Tip:** constant factors never matter. If $du = 2x\,dx$ but your integrand only has $x\,dx$, write $x\,dx = \tfrac12\,du$ and move on.

## Worked example 1: the basic pattern

Evaluate $\int 2x\cos(x^2)\,dx$.

**Step 1. Choose $u$.** The inside function is $x^2$, so let $u = x^2$.

**Step 2. Find $du$.** $du = 2x\,dx$.

**Step 3. Rewrite.** The integrand is $\cos(x^2)\cdot 2x\,dx = \cos u\,du$.

**Step 4. Integrate.** $\int \cos u\,du = \sin u + C$.

**Step 5. Substitute back.**

$$\int 2x\cos(x^2)\,dx = \sin(x^2) + C$$

Check by differentiating: the chain rule gives $\cos(x^2)\cdot 2x$. It matches.

## Worked example 2: adjusting a constant

Evaluate $\int x(x^2+3)^4\,dx$.

**Step 1.** Let $u = x^2 + 3$.

**Step 2.** $du = 2x\,dx$, so $x\,dx = \tfrac12\,du$.

**Step 3.** Substitute:

$$\int (x^2+3)^4\,x\,dx = \int u^4 \cdot \tfrac12\,du = \tfrac12\int u^4\,du.$$

**Step 4.** $\tfrac12\cdot\frac{u^5}{5} = \frac{u^5}{10} + C$.

**Step 5.**

$$\int x(x^2+3)^4\,dx = \frac{(x^2+3)^5}{10} + C$$

Expanding $(x^2+3)^4$ would have worked too, but it would have taken far longer and invited arithmetic mistakes.

## Worked example 3: a logarithm answer

Evaluate $\int \frac{e^x}{e^x+1}\,dx$.

**Step 1.** Let $u = e^x + 1$, the denominator.

**Step 2.** $du = e^x\,dx$, which is exactly the numerator times $dx$.

**Step 3.** The integral becomes $\int \frac{1}{u}\,du$.

**Step 4.** $\int \frac1u\,du = \ln|u| + C$.

**Step 5.** Since $e^x + 1 > 0$, the absolute value can go:

$$\int \frac{e^x}{e^x+1}\,dx = \ln(e^x+1) + C$$

## Worked example 4: when x is left over

Evaluate $\int x\sqrt{x+1}\,dx$.

Let $u = x + 1$, so $du = dx$. The root becomes $\sqrt u$, but there is still an $x$ in front. Here is the trick: solve the substitution for $x$. Since $u = x+1$, we have $x = u - 1$.

$$\int x\sqrt{x+1}\,dx = \int (u-1)\,u^{1/2}\,du = \int \left(u^{3/2} - u^{1/2}\right)du$$

Integrate each power:

$$= \tfrac25 u^{5/2} - \tfrac23 u^{3/2} + C = \tfrac25 (x+1)^{5/2} - \tfrac23 (x+1)^{3/2} + C$$

This "solve for $x$" move rescues many substitutions where $u$ is linear.

## Worked example: a log in the numerator

Evaluate $\int \frac{(\ln x)^2}{x}\,dx$.

**Step 1. Spot the pair.** The function $\ln x$ is squared, and its derivative $\frac1x$ appears as a factor. So let $u = \ln x$.

**Step 2.** $du = \frac1x\,dx$.

**Step 3. Rewrite.** $\frac{(\ln x)^2}{x}\,dx = (\ln x)^2\cdot\frac1x\,dx = u^2\,du$.

**Step 4.** $\int u^2\,du = \frac{u^3}{3} + C$.

**Step 5.**

$$\int \frac{(\ln x)^2}{x}\,dx = \frac{(\ln x)^3}{3} + C$$

Spotting $\frac1x$ as the derivative of $\ln x$ is a skill worth practicing on its own. It turns up constantly, often disguised as division by $x$.

## Always check by differentiating

Every u-substitution answer can be verified in seconds, because differentiating it is just the chain rule. Take example 2's answer, $\frac{(x^2+3)^5}{10}$. Its derivative is

$$\frac{5(x^2+3)^4\cdot 2x}{10} = x(x^2+3)^4,$$

which is exactly the integrand. If the check produces an extra or missing constant (say $2x(x^2+3)^4$), you know right away that a $\tfrac12$ went astray. Building this habit catches almost every constant-factor error before it costs you points.

## U-substitution with definite integrals: changing the bounds

For a definite integral, the bounds $a$ and $b$ are $x$-values. Once you switch to $u$, they must become $u$-values:

$$\int_a^b f(g(x))\,g'(x)\,dx = \int_{g(a)}^{g(b)} f(u)\,du$$

### Worked example 5: changing the bounds

Evaluate $\int_0^1 2x(x^2+1)^3\,dx$.

**Step 1.** Let $u = x^2 + 1$, so $du = 2x\,dx$.

**Step 2. Convert the bounds.** When $x = 0$, $u = 0^2 + 1 = 1$. When $x = 1$, $u = 1^2 + 1 = 2$.

**Step 3. Rewrite and integrate entirely in $u$.**

$$\int_0^1 2x(x^2+1)^3\,dx = \int_1^2 u^3\,du = \left[\frac{u^4}{4}\right]_1^2 = \frac{16}{4} - \frac{1}{4} = \frac{15}{4}$$

There is no need to substitute back, because the new bounds already belong to $u$.

```graph
title: 'Area under y = 2x(x² + 1)³ from x = 0 to x = 1'
caption: 'The shaded area is $\int_0^1 2x(x^2+1)^3\,dx = \int_1^2 u^3\,du = \frac{15}{4}$.'
x: [-0.5, 1.3]
y: [-2, 18]
functions:
  - expr: 2x(x^2+1)^3
    label: y = 2x(x² + 1)³
shade: {expr: 2x(x^2+1)^3, from: 0, to: 1}
points:
  - [1, 16, '(1, 16)']
```

### Worked example 6: a trig definite integral

Evaluate $\int_0^{\pi/4} \tan x\sec^2 x\,dx$.

Let $u = \tan x$, so $du = \sec^2 x\,dx$. New bounds: $\tan 0 = 0$ and $\tan\frac{\pi}{4} = 1$.

$$\int_0^{\pi/4} \tan x\sec^2 x\,dx = \int_0^1 u\,du = \left[\frac{u^2}{2}\right]_0^1 = \frac12$$

> **Tip:** if you prefer, you can find the antiderivative $\tfrac12\tan^2 x$, then plug in the original $x$-bounds. You get the same $\tfrac12$. Just never plug $x$-bounds into a $u$-expression.

## When u-substitution fails

U-substitution is powerful but not universal. Watch for these signs that it will not work:

- **The derivative of $u$ is missing.** In $\int e^{x^2}\,dx$, setting $u = x^2$ needs $2x\,dx$, but there is no $x$ in the integrand. You cannot invent one. (This integral has no elementary antiderivative at all.)
- **A product of unrelated functions.** $\int x e^x\,dx$ and $\int x\cos x\,dx$ do not simplify under any substitution. They need [integration by parts](/blog/integration-by-parts).
- **A rational function with a factored denominator.** $\int \frac{1}{x^2-1}\,dx$ is handled by [partial fractions](/blog/partial-fractions).
- **A square root of a quadratic with no matching derivative.** $\int \sqrt{4 - x^2}\,dx$ calls for [trig substitution](/blog/trig-substitution).

A useful test: after substituting, if an $x$ remains and you cannot rewrite it using $u$, your choice of $u$ is wrong or the method does not apply.

## Common u-substitution mistakes

1. **Forgetting to replace $dx$.** Writing $\int \cos u\,dx$ is mixing variables. The $dx$ must become $du$ (with any needed constant).
2. **Ignoring a constant factor.** In example 2, dropping the $\tfrac12$ gives $\frac{(x^2+3)^5}{5}$, which is twice too big.
3. **Using the old bounds.** In example 5, evaluating $\left[\frac{u^4}{4}\right]_0^1$ gives $\tfrac14$ instead of $\tfrac{15}{4}$.
4. **Not substituting back.** For indefinite integrals the final answer must be in $x$.
5. **Dropping $+C$** on indefinite integrals.
6. **Treating a variable like a constant.** You can pull a $\tfrac12$ out of the integral, but never an $x$.

## Quick reference

| Pattern in the integrand        | Substitution    | Result                          |
| ------------------------------- | --------------- | ------------------------------- |
| $(ax+b)^n$                      | $u = ax+b$      | $\frac{(ax+b)^{n+1}}{a(n+1)} + C$ |
| $\frac{g'(x)}{g(x)}$            | $u = g(x)$      | $\ln\lvert g(x)\rvert + C$      |
| $e^{g(x)}g'(x)$                 | $u = g(x)$      | $e^{g(x)} + C$                  |
| $[g(x)]^n g'(x)$, $n \ne -1$    | $u = g(x)$      | $\frac{[g(x)]^{n+1}}{n+1} + C$  |
| $\cos(g(x))\,g'(x)$             | $u = g(x)$      | $\sin(g(x)) + C$                |
| $\int_a^b f(g(x))g'(x)\,dx$     | $u = g(x)$      | $\int_{g(a)}^{g(b)} f(u)\,du$   |

## Build the habit with practice

Choosing $u$ feels like guesswork at first, but after a couple dozen problems you will see the inside function and its derivative almost instantly. Work through the interactive lesson below: each problem checks your answer right away and shows where a substitution went wrong, so the pattern sticks.

## Frequently asked questions

### What is u-substitution in simple terms?

U-substitution is the chain rule run backward. You rename an inside function as $u$, replace $g'(x)\,dx$ with $du$, and turn a messy integral into a simple one like $\int u^4\,du$. When you are done you put $g(x)$ back in for $u$.

### How do you know what to pick for u?

Look for a function sitting inside another function (inside a power, a root, a trig function, an exponential or a denominator) whose derivative also appears as a factor. That inside function is usually the right $u$. Constant factors do not matter, because you can divide them out.

### Do you have to change the limits of integration with u-substitution?

If you keep the integral in terms of $u$ to the end, yes: replace each $x$-bound with $u = g(\text{bound})$. The alternative is to find the antiderivative, substitute back to $x$, and then use the original bounds. Both give the same answer.

### When does u-substitution not work?

It fails when the derivative of your $u$ is not present, so leftover $x$ terms cannot be expressed in $u$. For example $\int e^{x^2}\,dx$ has no factor of $x$ to pair with $du = 2x\,dx$. Products like $\int x e^x\,dx$ need integration by parts instead.

### Is u-substitution the same as the reverse chain rule?

Yes. Differentiating $F(g(x))$ gives $F'(g(x))\,g'(x)$ by the chain rule, so integrating $F'(g(x))\,g'(x)$ gives back $F(g(x)) + C$. U-substitution is just a tidy notation for spotting and undoing that pattern.
