Integration by Substitution

Integration by substitution (also called u-substitution) is the first technique most students learn after the basic table of integrals. It turns a complicated integral into a simple one by changing the variable. You can follow along with the integral calculator, which shows the solution step by step. For the big picture of how this method fits with the others, see How to Solve Integrals Step by Step.

The Idea: The Chain Rule in Reverse

Recall the chain rule: if F'(u) = f(u), then

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

Read from right to left, this says that an integrand of the form f(g(x))\,g'(x) has an antiderivative F(g(x)):

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

So the method works when the integrand contains a function g(x) and, as a factor, its derivative g'(x) (up to a constant). We replace g(x) with u and g'(x)\,dx with du. The result is an integral in u alone.

The Algorithm in 4 Steps

  1. Choose u = g(x). Usually this is the “inside” of a composite function.
  2. Compute du = g'(x)\,dx. Solve for dx, or for the whole combination such as x\,dx, if needed.
  3. Rewrite and integrate. Replace everything in the integral with u and du. No x should remain. Then integrate with respect to u.
  4. Return to x. Substitute u = g(x) back and add + C. Check by differentiating.

How to Choose u

What you see in the integrand Try Why it works
A function raised to a power, (ax+b)^n u = ax+b du = a\,dx
e^{g(x)} multiplied by g'(x) u = g(x) Leaves \int e^u\,du
\dfrac{g'(x)}{g(x)} u = g(x) Leaves \int \dfrac{du}{u} = \ln|u| + C
\sin(g(x)) or \cos(g(x)) times g'(x) u = g(x) Leaves a basic trig integral
\sin^n x\cos x or \cos^n x\sin x u = \sin x or u = \cos x The other factor becomes du (up to sign)
\sqrt{ax+b} u = \sqrt{ax+b} Removes the root (see below)

A good test: after choosing u, differentiate it. If du (up to a constant factor) appears in the integrand, the substitution will work. If not, try a different u or a different method.

Example 1: \int 2x\cos(x^2)\,dx

The inside function is x^2, and its derivative 2x is sitting right there as a factor.

Step 1. Let u = x^2.

Step 2. Then du = 2x\,dx.

Step 3. The integral becomes

\int \cos(u)\,du = \sin(u) + C.

Step 4. Substitute back:

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

Check: \dfrac{d}{dx}\sin(x^2) = \cos(x^2)\cdot 2x. ✓

You can check this step by step in the integral calculator by entering 2*x*cos(x^2).

A note on constants: if the integrand were x\cos(x^2) without the 2, then du = 2x\,dx gives x\,dx = \tfrac12\,du, and the answer would be \tfrac12\sin(x^2) + C. A missing constant factor is fine. A missing variable factor is not.

Example 2: A Definite Integral with New Limits

Evaluate

\int_0^{\pi/2} \sin x\,\cos^3 x\,dx.

Here \cos x is the inside function, and \sin x\,dx is almost its differential.

Substitute. Let u = \cos x. Then du = -\sin x\,dx, so \sin x\,dx = -du.

Change the limits. The limits are values of x, so they must be converted to values of u:

Rewrite and integrate.

\int_0^{\pi/2} \sin x\,\cos^3 x\,dx = \int_1^0 u^3\,(-du) = \int_0^1 u^3\,du = \left[\frac{u^4}{4}\right]_0^1 = \frac14.

The minus sign was absorbed by swapping the limits: \int_1^0 (-u^3)\,du = \int_0^1 u^3\,du.

Check without changing limits. An antiderivative in x is -\dfrac{\cos^4 x}{4}. Evaluating:

-\frac{\cos^4(\pi/2)}{4} + \frac{\cos^4 0}{4} = 0 + \frac14 = \frac14. \;✓

This is the rule for definite integrals:

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

Once you convert the limits, you never need to go back to x.

To verify, open this example in the integral calculator (sin(x)*cos(x)^3 from 0 to pi/2).

Substitution for Irrational Functions

Square roots can often be removed by making the root itself the new variable. For \sqrt{ax+b}, set

u = \sqrt{ax+b}, \qquad x = \frac{u^2 - b}{a}, \qquad dx = \frac{2u}{a}\,du.

Note that this time du is not already in the integrand. We solve for x and dx and substitute them in as well.

Example: \displaystyle\int \frac{dx}{1+\sqrt{x}}

Let u = \sqrt{x}. Then x = u^2 and dx = 2u\,du:

\int \frac{2u}{1+u}\,du.

The numerator has the same degree as the denominator, so rewrite it: \dfrac{2u}{1+u} = 2 - \dfrac{2}{1+u}. Then

\int \left(2 - \frac{2}{1+u}\right)du = 2u - 2\ln|1+u| + C.

Return to x (since 1 + \sqrt{x} > 0, the absolute value can be dropped):

\int \frac{dx}{1+\sqrt{x}} = 2\sqrt{x} - 2\ln\left(1+\sqrt{x}\right) + C.

Check:

\frac{d}{dx}\left[2\sqrt{x} - 2\ln(1+\sqrt{x})\right] = \frac{1}{\sqrt{x}} - \frac{2}{1+\sqrt{x}}\cdot\frac{1}{2\sqrt{x}} = \frac{(1+\sqrt{x}) - 1}{\sqrt{x}\,(1+\sqrt{x})} = \frac{1}{1+\sqrt{x}}. \;✓

Common Mistakes

When Substitution Is Not Enough

Substitution handles integrands where an inside function and its derivative appear together. It does not help with a product like x\cos x, where no choice of u leaves a simpler integral. For products of that kind, use Integration by Parts. If you are unsure which technique fits, How to Choose an Integration Method gives a decision guide, and the overview in How to Solve Integrals Step by Step puts all methods in one workflow.