---
title: The Substitution Rule
module: Integrals
moduleNumber: 4
lessonNumber: 3
order: 403
summary: >
  Substitution runs the Chain Rule backward: spotting an inner function whose
  derivative also appears in the integrand lets the variable change to $u$ and
  collapse a composite integral to a simple one. The rule applies to indefinite and
  definite integrals, with two ways to handle the limits, and it yields the symmetry
  shortcuts that double even integrands and vanish odd ones.
topics: [Integrals]
sources:
  - book: Stewart
    ref: "Ch. 4 — Integrals; §4.5 The Substitution Rule"
draft: false
---

The [Fundamental Theorem](/calculus/integrals/the-fundamental-theorem-of-calculus)
reduces evaluating a definite integral to finding an antiderivative, but the basic
table only covers integrands that are themselves derivatives of familiar functions.
An integral like $\int 2x\sqrt{1 + x^2}\,\d x$ is not in the table. It becomes tractable
once the composite structure is noticed: the factor $2x$ is the derivative of the
inner quantity $1 + x^2$ under the root. Substitution is the technique that exploits
exactly this pattern, and it is the reverse of the
[Chain Rule](/calculus/derivatives/differentiation-rules-and-the-chain-rule).

## Reversing the Chain Rule

The Chain Rule states $\frac{\d}{\d x}F(g(x)) = F'(g(x))\,g'(x)$. Reading it right to
left, $F(g(x))$ is an antiderivative of $F'(g(x))\,g'(x)$, so

$$
\int F'(g(x))\,g'(x)\,\d x = F(g(x)) + C.
$$

The integrand has a recognizable form: an outer derivative $F'$ evaluated at an inner
function $g(x)$, multiplied by the inner function's derivative $g'(x)$. Introduce a
new variable for the inner function, $u = g(x)$, with differential $\d u = g'(x)\,\d x$.
Then the whole integral rewrites in $u$ alone.

> **Theorem (Substitution Rule).** If $u = g(x)$ is differentiable with range an
> interval $I$, and $f$ is continuous on $I$, then
> $$
> \int f(g(x))\,g'(x)\,\d x = \int f(u)\,\d u.
> $$

The mechanical picture: $u = g(x)$ replaces the inner function, and the differential
$\d u = g'(x)\,\d x$ absorbs the leftover factor $g'(x)\,\d x$. Everything in $x$ leaves the
integral, replaced by an integral in $u$ that is, ideally, in the table.

$$
% caption: Substitution as a round trip, shown on $\int 2x\cos(x^2)\,dx$: the
% composite integral in $x$ becomes a table integral in $u = x^2$; integrate, then
% back-substitute to return to $x$.
\begin{tikzpicture}[scale=1.0, >=stealth,
  box/.style={draw, black!70, minimum width=36mm, minimum height=12mm, align=center, font=\footnotesize}]
\definecolor{acc}{HTML}{4A6FA5}
\node[box] (a) at (0,1.7) {$\displaystyle\int 2x\cos(x^2)\,dx$};
\node[box] (b) at (6.6,1.7) {$\displaystyle\int \cos u\,du$};
\node[box] (d) at (6.6,-0.7) {$\sin u + C$};
\node[box] (c) at (0,-0.7) {$\sin(x^2) + C$};
\draw[->, acc, thick] (a) -- (b) node[midway, above, font=\footnotesize, black!70] {$u = x^2$};
\draw[->, acc, thick] (b) -- (d) node[midway, right, font=\footnotesize, black!70] {integrate};
\draw[->, acc, thick] (d) -- (c) node[midway, above, font=\footnotesize, black!70] {$u = x^2$};
\node[black, font=\footnotesize] at (0,0.5) {back-substitute};
\end{tikzpicture}
$$

The differential notation is what makes the bookkeeping reliable: treat $\d u$ and $\d x$
as if they were algebraic quantities linked by $\d u = g'(x)\,\d x$, and the rule reduces
to substituting one for the other under the integral sign.

### Worked substitutions

> **Worked example.** Evaluate $\int 2x\sqrt{1 + x^2}\,\d x$.
>
> The factor $2x$ is the derivative of the inner quantity $1 + x^2$. Let
> $u = 1 + x^2$, so $\d u = 2x\,\d x$ and the integral collapses to a table integral:
> $$
> \int 2x\sqrt{1 + x^2}\,\d x = \int \sqrt{u}\,\d u = \tfrac23 u^{3/2} + C = \tfrac23(1 + x^2)^{3/2} + C.
> $$
> Differentiating the answer by the Chain Rule returns $2x\sqrt{1 + x^2}$, confirming
> the result.

When the matching derivative carries a constant factor, absorb it into $\d u$.

> **Worked example.** Evaluate $\int x^3 \cos(x^4 + 2)\,\d x$.
>
> The inner function is $x^4 + 2$, whose derivative $4x^3$ matches the factor $x^3$
> up to the constant $4$. Let $u = x^4 + 2$, so $\d u = 4x^3\,\d x$ and
> $x^3\,\d x = \tfrac14\,\d u$:
> $$
> \int x^3 \cos(x^4 + 2)\,\d x = \int \cos u \cdot \tfrac14\,\d u = \tfrac14 \sin u + C = \tfrac14 \sin(x^4 + 2) + C.
> $$
> The final step returns to $x$, since the original problem was posed in $x$.

$$
% caption: Anatomy of a substitutable integrand on $\int \cos(x^2)\,2x\,dx$: the
% inner function $x^2$ names $u$, the outer factor becomes $\cos u$, and the
% leftover $2x\,dx$ is exactly $du$, so the product collapses to $\int \cos u\,du$.
\begin{tikzpicture}[scale=1.0, >=stealth,
  bx/.style={draw, black!70, minimum width=27mm, minimum height=11mm, align=center, font=\footnotesize}]
\definecolor{acc}{HTML}{4A6FA5}
\node[bx] (top) at (3,2.0) {$\displaystyle\int \cos(x^2)\,2x\,dx$};
\node[bx] (inner) at (0,0) {inner: $u=x^2$};
\node[bx] (outer) at (3,0) {outer: $\cos u$};
\node[bx] (du) at (6,0) {$du = 2x\,dx$};
\node[bx] (res) at (3,-2.0) {$\displaystyle\int \cos u\,du$};
\draw[->, acc, thick] (top) -- (inner);
\draw[->, acc, thick] (top) -- (outer);
\draw[->, acc, thick] (top) -- (du);
\draw[->, acc, thick] (inner) -- (res);
\draw[->, acc, thick] (outer) -- (res);
\draw[->, acc, thick] (du) -- (res);
\end{tikzpicture}
$$

The procedure is the same every time.

```algorithm
caption: $\textsc{Substitute}$ — evaluate $\int f(g(x))\,g'(x)\,\d x$ by change of variable
choose $u \gets g(x)$, an inner function whose derivative appears in the integrand
compute $\d u \gets g'(x)\,\d x$
rewrite the integral entirely in $u$, replacing $g(x)$ by $u$ and $g'(x)\,\d x$ by $\d u$
antidifferentiate the resulting integral in $u$
back-substitute $u \gets g(x)$ to return to the original variable
```

The one judgment call is the first line. Choose $u$ to be a function inside the
integrand whose differential also occurs, up to a constant factor. If no such factor
is present, try $u$ equal to the inner part of a composition and see whether the
leftover simplifies. Guessing wrong is normal; a substitution either collapses the
integral or it does not, and a failed attempt is quickly abandoned.

### More indefinite integrals

- **Constant inner derivative.** For $\int \sqrt{2x + 1}\,\d x$, take $u = 2x + 1$,
  $\d u = 2\,\d x$, $\d x = \tfrac12\,\d u$:
  $$
  \int \sqrt{2x+1}\,\d x = \tfrac12\int u^{1/2}\,\d u = \tfrac13 u^{3/2} + C = \tfrac13(2x+1)^{3/2} + C.
  $$
- **Radical in a denominator.** For $\int \frac{x}{\sqrt{1 - 4x^2}}\,\d x$, take
  $u = 1 - 4x^2$, $\d u = -8x\,\d x$, so $x\,\d x = -\tfrac18\,\d u$:
  $$
  \int \frac{x}{\sqrt{1-4x^2}}\,\d x = -\tfrac18\int u^{-1/2}\,\d u = -\tfrac14\sqrt{1 - 4x^2} + C.
  $$
- **Extra factor of $x$ handled by algebra.** For $\int x^5\sqrt{1 + x^2}\,\d x$, split
  $x^5 = x^4 \cdot x$ and set $u = 1 + x^2$, $x\,\d x = \tfrac12\,\d u$, $x^2 = u - 1$, so
  $x^4 = (u-1)^2$:
  $$
  \int x^5\sqrt{1+x^2}\,\d x = \tfrac12\int (u-1)^2\sqrt{u}\,\d u = \tfrac12\int \bigl(u^{5/2} - 2u^{3/2} + u^{1/2}\bigr)\,\d u,
  $$
  which integrates term by term to
  $\tfrac17(1+x^2)^{7/2} - \tfrac25(1+x^2)^{5/2} + \tfrac13(1+x^2)^{3/2} + C$.

With practice the explicit $u$ can be skipped for simple cases — $\int \cos 5x\,\d x =
\tfrac15\sin 5x + C$ by inspection — but for anything with an algebraic tangle, writing
the substitution out prevents errors.

### Choosing the substitution

The first line of the procedure is the only real decision. A few recurring shapes
point straight at $u$:

| Integrand shape | Take $u =$ |
| --- | --- |
| a composite $f(g(x))$ with $g'(x)$ present as a factor | the inner function $g(x)$ |
| a power of a linear expression, $(ax + b)^n$ | the linear expression $ax + b$ |
| a trigonometric power times the derivative of its argument | the argument, or the trig factor whose derivative appears |
| a radical $\sqrt{q(x)}$ with $q'(x)$ nearby | the quantity $q(x)$ under the radical |

Three more, chosen so the leftover factor is exactly $\d u$:

> **Worked example.** Evaluate $\int \sin^2 x\cos x\,\d x$.
>
> Let $u = \sin x$, so $\d u = \cos x\,\d x$:
> $$
> \int \sin^2 x\cos x\,\d x = \int u^2\,\d u = \tfrac13 u^3 + C = \tfrac13\sin^3 x + C.
> $$

> **Worked example.** Evaluate $\int \tan^3 x\sec^2 x\,\d x$.
>
> Let $u = \tan x$, so $\d u = \sec^2 x\,\d x$:
> $$
> \int \tan^3 x\sec^2 x\,\d x = \int u^3\,\d u = \tfrac14 u^4 + C = \tfrac14\tan^4 x + C.
> $$

> **Worked example.** Evaluate $\int 3x^2(x^3 + 1)^4\,\d x$.
>
> Let $u = x^3 + 1$, so $\d u = 3x^2\,\d x$:
> $$
> \int 3x^2(x^3 + 1)^4\,\d x = \int u^4\,\d u = \tfrac15 u^5 + C = \tfrac15(x^3 + 1)^5 + C.
> $$

## Substitution in definite integrals

For a definite integral there are two ways to carry the substitution through, and the
second is usually cleaner.

**Method 1 — evaluate the indefinite integral first, then apply the limits in $x$.**
Find the antiderivative in $x$, then use the Fundamental Theorem with the original
$x$-limits. Using the result above for $\sqrt{2x+1}$,

$$
\int_0^4 \sqrt{2x+1}\,\d x = \Bigl[\tfrac13(2x+1)^{3/2}\Bigr]_0^4 = \tfrac13(9^{3/2} - 1^{3/2}) = \tfrac13(27 - 1) = \frac{26}{3}.
$$

**Method 2 — change the limits when the variable changes.** The alternative
transforms the bounds along with the integrand, so there is never a need to return to
$x$.

> **Substitution Rule for definite integrals.** If $g'$ is continuous on $[a, b]$ and
> $f$ is continuous on the range of $u = g(x)$, then
> $$
> \int_a^b f(g(x))\,g'(x)\,\d x = \int_{g(a)}^{g(b)} f(u)\,\d u.
> $$

The new limits are the $u$-values matching the old $x$-values: when $x = a$,
$u = g(a)$; when $x = b$, $u = g(b)$. The integral is then finished entirely in $u$.
For the same integral, $u = 2x + 1$ sends $x = 0 \mapsto u = 1$ and
$x = 4 \mapsto u = 9$:

$$
\int_0^4 \sqrt{2x+1}\,\d x = \int_1^9 \tfrac12\sqrt{u}\,\d u = \Bigl[\tfrac13 u^{3/2}\Bigr]_1^9 = \tfrac13(27 - 1) = \frac{26}{3}.
$$

$$
% caption: Changing the variable also changes the limits: the region under
% $\sqrt{2x+1}$ on $[0,4]$ maps to the region under $\tfrac12\sqrt{u}$ on $[1,9]$,
% with the same area.
\begin{tikzpicture}[scale=1.0, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
% ---- left: x-integral ----
\begin{scope}
  \draw[->, black] (-0.2,0) -- (5.2,0) node[right, black!70] {$x$};
  \draw[->, black] (0,-0.2) -- (0,3.4) node[above, black!70] {$y$};
  \fill[acc!13, domain=0:4, samples=60, smooth]
    plot (\x, {sqrt(2*\x+1)}) -- (4,0) -- (0,0) -- cycle;
  \draw[black, very thick, domain=0:4.6, samples=70, smooth] plot (\x, {sqrt(2*\x+1)});
  \draw[black] (4,0.08) -- (4,-0.08);
  \node[black!70, anchor=north, font=\footnotesize] at (0,-0.12) {$0$};
  \node[black!70, anchor=north, font=\footnotesize] at (4,-0.12) {$4$};
  \node[black, anchor=south west, font=\footnotesize] at (3.2,2.9) {$\sqrt{2x+1}$};
\end{scope}
% ---- arrow ----
\node[acc, font=\footnotesize] at (6.05,1.6) {$u = 2x+1$};
\draw[->, acc, thick] (5.5,1.15) -- (6.6,1.15);
% ---- right: u-integral ----
\begin{scope}[xshift=7.2cm]
  \draw[->, black] (-0.2,0) -- (5.4,0) node[right, black!70] {$u$};
  \draw[->, black] (0,-0.2) -- (0,3.4) node[above, black!70] {$y$};
  % plot 0.5*sqrt(u) with u scaled by 0.5 for width (u from 1 to 9 -> 0.5 to 4.5)
  \fill[acc!13, domain=1:9, samples=60, smooth]
    plot ({\x*0.5}, {0.5*sqrt(\x)}) -- (4.5,0) -- (0.5,0) -- cycle;
  \draw[black, very thick, domain=0.2:9.4, samples=80, smooth] plot ({\x*0.5}, {0.5*sqrt(\x)});
  \draw[black] (0.5,0.08) -- (0.5,-0.08);
  \draw[black] (4.5,0.08) -- (4.5,-0.08);
  \node[black!70, anchor=north, font=\footnotesize] at (0.5,-0.12) {$1$};
  \node[black!70, anchor=north, font=\footnotesize] at (4.5,-0.12) {$9$};
  \node[black, anchor=south west, font=\footnotesize] at (3.1,1.7) {$\tfrac12\sqrt{u}$};
\end{scope}
\end{tikzpicture}
$$

Changing the limits amounts to remapping the interval of integration: $u = 2x + 1$
carries $[0, 4]$ in $x$ to $[1, 9]$ in $u$.

$$
% caption: The substitution $u = 2x+1$ remaps the interval of integration, sending
% each $x$ in $[0,4]$ to $u$ in $[1,9]$; the limits transform with the variable.
\begin{tikzpicture}[scale=1.0, >=stealth]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (0,1.4) -- (4.9,1.4);
\foreach \x/\lab in {0/0, 1/1, 2/2, 3/3, 4/4}
  \draw[black] (\x*1.1,1.32) -- (\x*1.1,1.48) node[above, black!70, font=\footnotesize] {$\lab$};
\node[black!70, anchor=east, font=\footnotesize] at (-0.15,1.4) {$x$};
\draw[black, thick] (0,0) -- (4.9,0);
\foreach \u/\pos in {1/0, 3/1, 5/2, 7/3, 9/4}
  \draw[black] (\pos*1.1,-0.08) -- (\pos*1.1,0.08) node[below, black!70, font=\footnotesize] {$\u$};
\node[black!70, anchor=east, font=\footnotesize] at (-0.15,0) {$u$};
\draw[->, acc] (0,1.26) -- (0,0.14);
\draw[->, acc] (4.4,1.26) -- (4.4,0.14);
\node[acc, font=\footnotesize] at (2.9,0.72) {$u = 2x+1$};
\end{tikzpicture}
$$

The $u$-limits may run "backwards" when $g$ decreases.

> **Worked example.** Evaluate $\int_1^2 \dfrac{\d x}{(3 - 5x)^2}$.
>
> Let $u = 3 - 5x$, so $\d u = -5\,\d x$. The limits become $x = 1 \mapsto u = -2$
> and $x = 2 \mapsto u = -7$:
> $$
> \int_1^2 \frac{\d x}{(3-5x)^2} = -\tfrac15\int_{-2}^{-7} u^{-2}\,\d u = -\tfrac15\Bigl[-\tfrac1u\Bigr]_{-2}^{-7} = \tfrac15\parens{\tfrac1{-7} - \tfrac1{-2}} = \frac{1}{14}.
> $$
> The $u$-limits run from $-2$ down to $-7$; the sign conventions from the
> definition handle the ordering, and no reversal is needed.

> **Worked example.** Evaluate $\int_1^2 x(x^2 - 1)^3\,\d x$ by changing the limits.
>
> Let $u = x^2 - 1$, so $\d u = 2x\,\d x$ and $x\,\d x = \tfrac12\,\d u$. The limits
> transform as $x = 1 \mapsto u = 0$ and $x = 2 \mapsto u = 3$:
> $$
> \int_1^2 x(x^2 - 1)^3\,\d x = \tfrac12\int_0^3 u^3\,\d u = \tfrac12\Bigl[\tfrac14 u^4\Bigr]_0^3 = \tfrac18\cdot 81 = \frac{81}{8}.
> $$

## Symmetry shortcuts

Substitution applied to a symmetric integrand over a symmetric interval $[-a, a]$
produces two shortcuts worth memorizing. Recall that $f$ is **even** if
$f(-x) = f(x)$ (graph symmetric about the $y$-axis) and **odd** if $f(-x) = -f(x)$
(graph symmetric about the origin).

> **Theorem (Integrals of symmetric functions).** Let $f$ be continuous on
> $[-a, a]$.
> $$
> \text{$f$ even:}\quad \int_{-a}^{a} f(x)\,\d x = 2\int_0^a f(x)\,\d x,
> \qquad
> \text{$f$ odd:}\quad \int_{-a}^{a} f(x)\,\d x = 0.
> $$

The proof splits the integral at $0$ and substitutes $u = -x$ in the piece over
$[-a, 0]$. That substitution flips the interval to $[0, a]$ and turns $f(x)$ into
$f(-u)$; even symmetry makes the two halves equal and they add, odd symmetry makes
them opposite and they cancel. Geometrically, an even function has matching areas on
both sides of the axis, and an odd function has a positive region on one side exactly
cancelled by a negative region on the other.

$$
% caption: Left, an even integrand — the two halves have equal area, so the whole
% is twice the right half. Right, an odd integrand — the halves are equal in size
% and opposite in sign, so they cancel to zero.
\begin{tikzpicture}[scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\definecolor{neg}{HTML}{B5651D}
% ---- even ----
\begin{scope}
  \draw[->, black] (-2.6,0) -- (2.6,0) node[right, black!70] {$x$};
  \draw[->, black] (0,-0.3) -- (0,2.9) node[above, black!70] {$y$};
  \fill[acc!13, domain=-2:2, samples=60, smooth] plot (\x, {2.3 - 0.42*\x*\x}) -- (2,0) -- (-2,0) -- cycle;
  \draw[black, very thick, domain=-2.35:2.35, samples=70, smooth] plot (\x, {2.3 - 0.42*\x*\x});
  \draw[black] (-2,0.08) -- (-2,-0.08) node[below, black!70, font=\footnotesize] {-$a$};
  \draw[black] (2,0.08) -- (2,-0.08) node[below, black!70, font=\footnotesize] {$a$};
  \node[acc, font=\footnotesize] at (-1.0,0.75) {$+$};
  \node[acc, font=\footnotesize] at (1.0,0.75) {$+$};
  \node[black!70, anchor=north, font=\footnotesize] at (0,-0.85) {even: areas add};
\end{scope}
% ---- odd ----
\begin{scope}[xshift=7cm]
  \draw[->, black] (-2.6,0) -- (2.6,0) node[right, black!70] {$x$};
  \draw[->, black] (0,-1.7) -- (0,1.7) node[above, black!70] {$y$};
  \begin{scope}
    \clip (0,0) rectangle (2,1.6);
    \fill[acc!13, domain=-2:2, samples=60, smooth] plot (\x, {0.62*\x - 0.06*\x*\x*\x}) -- (2,0) -- (-2,0) -- cycle;
  \end{scope}
  \begin{scope}
    \clip (-2,-1.6) rectangle (0,0);
    \fill[neg!16, domain=-2:2, samples=60, smooth] plot (\x, {0.62*\x - 0.06*\x*\x*\x}) -- (2,0) -- (-2,0) -- cycle;
  \end{scope}
  \draw[black, very thick, domain=-2.35:2.35, samples=70, smooth] plot (\x, {0.62*\x - 0.06*\x*\x*\x});
  \draw[black] (-2,0.08) -- (-2,-0.08) node[below, black!70, font=\footnotesize] {-$a$};
  \draw[black] (2,0.08) -- (2,-0.08) node[above, black!70, font=\footnotesize] {$a$};
  \node[acc, font=\footnotesize] at (1.15,0.35) {$+$};
  \node[neg, font=\footnotesize] at (-1.15,-0.35) {-};
  \node[black!70, anchor=north, font=\footnotesize] at (0,-1.85) {odd: areas cancel};
\end{scope}
\end{tikzpicture}
$$

> **Worked example.** Evaluate $\int_{-2}^{2}(x^6 + 1)\,\d x$.
>
> The integrand $x^6 + 1$ is even, so the interval folds in half:
> $$
> \int_{-2}^{2}(x^6 + 1)\,\d x = 2\int_0^2 (x^6 + 1)\,\d x = 2\Bigl[\tfrac17 x^7 + x\Bigr]_0^2 = 2\parens{\tfrac{128}{7} + 2} = \frac{284}{7}.
> $$

> **Worked example.** Evaluate $\displaystyle\int_{-1}^{1} \frac{\tan x}{1 + x^2 + x^4}\,\d x$.
>
> The integrand is odd, since $\tan x$ is odd and $1 + x^2 + x^4$ is even. Over the
> symmetric interval the two halves cancel:
> $$
> \int_{-1}^{1} \frac{\tan x}{1 + x^2 + x^4}\,\d x = 0,
> $$
> with no computation at all.

Symmetry is worth a glance whenever the interval is centered at the origin: it can
turn a hard integral into a trivial one.
