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.
By the PracticeCalculus team Published 7 min read
On this page
- What is u-substitution?
- The u-substitution method in five steps
- How to choose u
- Worked example 1: the basic pattern
- Worked example 2: adjusting a constant
- Worked example 3: a logarithm answer
- Worked example 4: when x is left over
- Worked example: a log in the numerator
- Always check by differentiating
- U-substitution with definite integrals: changing the bounds
- When u-substitution fails
- Common u-substitution mistakes
- Quick reference
- Build the habit with practice
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
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:
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
- Choose u. Pick an inside function g(x).
- Find du. Differentiate: du = g'(x)\,dx.
- Rewrite everything in u. Replace g(x) with u and g'(x)\,dx with du. No x may remain.
- Integrate the new, simpler integral.
- 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.
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:
Step 4. \tfrac12\cdot\frac{u^5}{5} = \frac{u^5}{10} + C.
Step 5.
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:
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.
Integrate each power:
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.
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
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:
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.
There is no need to substitute back, because the new bounds already belong to u.
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.
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.
- A rational function with a factored denominator. \int \frac{1}{x^2-1}\,dx is handled by partial fractions.
- A square root of a quadratic with no matching derivative. \int \sqrt{4 - x^2}\,dx calls for 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
- Forgetting to replace dx. Writing \int \cos u\,dx is mixing variables. The dx must become du (with any needed constant).
- Ignoring a constant factor. In example 2, dropping the \tfrac12 gives \frac{(x^2+3)^5}{5}, which is twice too big.
- Using the old bounds. In example 5, evaluating \left[\frac{u^4}{4}\right]_0^1 gives \tfrac14 instead of \tfrac{15}{4}.
- Not substituting back. For indefinite integrals the final answer must be in x.
- Dropping +C on indefinite integrals.
- 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.
Practice it now
U-substitution
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson