The Substitution Rule
The chain rule is the most used rule of differentiation, and the Substitution Rule is the chain rule run backwards. It turns integrals like into table integrals by renaming the "inside" of a composition. This lesson proves the rule for indefinite and definite integrals, shows how to choose , and proves the symmetry shortcuts for even and odd functions. The survey version is Substitution.
The rule
Substitution Rule. If is differentiable with range an interval and is continuous on , then
.
Proof. Let be an antiderivative of (it exists by FTC Part 1). The chain rule gives . So is the left side; it is also with , the right side. ∎
The notation is bookkeeping: it reminds you that the factor must be present (up to a constant) before you substitute.
How to choose u
Look for a composite whose inner derivative also appears as a factor.
| Integral | Result | ||
|---|---|---|---|
| (so ) |
The last row shows a second trick: when a leftover remains, solve for and rewrite everything in .
import sympy as sp
x = sp.symbols('x', positive=True)
for f in [x**2 * (x**3 + 1)**5, sp.exp(x) / (1 + sp.exp(2*x)), x * sp.sqrt(x - 3)]:
F = sp.integrate(f, x, manual=True) # manual=True: use hand-style rules like substitution
print(f"∫ {f} dx = {sp.factor(F)}")
print(" check F' - f =", sp.simplify(sp.diff(F, x) - f))∫ x**2*(x**3 + 1)**5 dx = x**3*(x**3 + 2)*(x**6 + x**3 + 1)*(x**6 + 3*x**3 + 3)/18
check F' - f = 0
∫ exp(x)/(exp(2*x) + 1) dx = atan(exp(x))
check F' - f = 0
∫ x*sqrt(x - 3) dx = 2*(x - 3)**(3/2)*(x + 2)/5
check F' - f = 0
The first answer differs from the table's by the constant (expand both to see it), because SymPy expanded before integrating; the third is the table's answer factored, . Different-looking antiderivatives are fine; the check is what counts.
Definite integrals: change the limits
Substitution Rule for definite integrals. If is continuous on and is continuous on the range of , then
.
Proof. With , both sides equal by FTC Part 2 (left side: is an antiderivative of the integrand). ∎
Changing the limits means you never need to go back to :
SymPy's Integral.transform performs exactly this change of variable, limits included:
import sympy as sp
x, u = sp.symbols('x u', positive=True)
I = sp.Integral(x * sp.sqrt(1 + x**2), (x, 0, 2))
J = I.transform(1 + x**2, u) # substitute u = 1 + x²
print("after substitution:", J)
print("value:", J.doit(), "≈", round(float(J.doit()), 4), " direct:", I.doit())after substitution: Integral(sqrt(u)/2, (u, 1, 5))
value: -1/3 + 5*sqrt(5)/3 ≈ 3.3934 direct: -1/3 + 5*sqrt(5)/3
Symmetry
Theorem. Let be continuous on .
- If is even (), then .
- If is odd (), then .
Proof. Split at 0 and substitute in the left half ():
For even this is , so the total is twice that. For odd it is , which cancels the right half. ∎
So without any computation: the integrand is . See also Symmetry.
import numpy as np
from scipy.integrate import quad
odd = lambda x: x**5 * np.cos(x) * np.exp(x**2 / 10)
even = lambda x: x**4 * np.cos(x)
print("odd over [-3, 3]:", round(quad(odd, -3, 3)[0], 10))
print("even over [-3, 3]:", round(quad(even, -3, 3)[0], 6), " 2 × over [0, 3]:", round(2 * quad(even, 0, 3)[0], 6))odd over [-3, 3]: 0.0
even over [-3, 3]: -72.12618 2 × over [0, 3]: -72.12618
In software
- Change of variables for probability densities. If with increasing, the density of is , the substitution rule in disguise. It is the basis of normalising flows in generative ML and of inverse-transform sampling: feeding uniform random numbers through an inverse CDF.
- Reparametrising time. Animations remap through an easing function . Integrating a quantity over the eased parameter uses .
- Numerical quadrature tricks. Substitutions such as or remove singularities or map infinite intervals to finite ones before a quadrature routine runs; SciPy's
quaddoes this internally for infinite limits.
Exercises
Exercise 1: Indefinite
Compute .
Answer
.
Solution
, : .
Exercise 2: Definite with new limits
Compute .
Answer
.
Solution
import sympy as sp
x = sp.symbols('x', positive=True)
print(sp.integrate(sp.log(x)**2 / x, (x, 1, sp.E)))1/3
Exercise 3: Back-substitution for x
Compute .
Answer
.
Solution
Exercise 4: Symmetry
Evaluate .
Answer
Solution
and are odd, so they contribute 0. is even: .
Test yourself
Which substitution handles ?
In with , what are the new limits?
- 0 and 1
- 0 and
- 1 and 0
- −1 and 1
is odd and continuous. What is ?
- 0
- It depends on