U-Substitution in Integrals: A Step-by-Step Guide

Some integrals look impossible until you notice they're the chain rule wearing a disguise. Here's how to spot the pattern, pick the right substitution, and never lose track of your bounds again.

By Petrus Sheya

August 2, 2026 · 6 min read

Why does 2xcos(x2)dx\int 2x\cos(x^2)\, dx look impossible, when every piece of it, 2x2x and cos\cos, is something you already know how to integrate?

You know cos(x)dx=sin(x)+C\int \cos(x)\, dx = \sin(x) + C. You know 2xdx=x2+C\int 2x\, dx = x^2 + C. But multiply 2x2x and cos(x2)\cos(x^2) together and none of your rules seem to apply anymore. The x2x^2 trapped inside the cosine breaks everything.

Here's the good news. This integral isn't a new kind of problem. It's a rule you already know, the chain rule, hiding in reverse.


This "impossible" integral is just the chain rule wearing a disguise

Remember the chain rule for derivatives. If FF and gg are functions, then:

ddx[F(g(x))]=F(g(x))g(x)\frac{d}{dx}\big[F(g(x))\big] = F'(g(x)) \cdot g'(x)

Now let F(u)=sin(u)F(u) = \sin(u) and g(x)=x2g(x) = x^2. Then F(u)=cos(u)F'(u) = \cos(u), so:

ddx[sin(x2)]=cos(x2)2x\frac{d}{dx}\big[\sin(x^2)\big] = \cos(x^2) \cdot 2x

Look at that closely. It's exactly 2xcos(x2)2x\cos(x^2), our original integrand. The function we couldn't integrate is the derivative of sin(x2)\sin(x^2), we just didn't recognize it yet.

Visualizer 01

The Chain Rule, Run Backward

The white curve is sin(x²). Its slope at every point equals 2x·cos(x²), the integrand we started with. Drag x and watch the orange tangent line track the integrand exactly.

xsin(x²)x = 1.10
Integrand: 2x·cos(x²)0.7766
Measured slope of sin(x²)0.7766
Difference6.71e-7

Drag the point and watch the tangent line. At every single value of xx, the slope of sin(x2)\sin(x^2) matches 2xcos(x2)2x\cos(x^2) exactly. That's the whole secret behind u-substitution: it's a way to spot a disguised derivative and undo it.


So what do we actually substitute?

Once we see the pattern f(g(x))g(x)f(g(x)) \cdot g'(x), we give the inner function a new name. We write:

u=g(x)u = g(x)

Differentiating both sides with respect to xx gives dudx=g(x)\dfrac{du}{dx} = g'(x), which we usually rearrange into:

du=g(x)dxdu = g'(x)\, dx

For our example, u=x2u = x^2, so du=2xdxdu = 2x\, dx. Now look at the original integral again:

2xducos(x2)cos(u)dx=cos(u)du\int \underbrace{2x}_{du}\, \underbrace{\cos(x^2)}_{\cos(u)}\, dx = \int \cos(u)\, du

Every xx is gone. What's left is trivial: cos(u)du=sin(u)+C\int \cos(u)\, du = \sin(u) + C. Swap uu back for x2x^2 and we get sin(x2)+C\sin(x^2) + C, exactly the antiderivative we already guessed above.


Why are we even allowed to swap dx for du?

It looks like we just deleted dxdx and wrote dudu in its place, which feels a little too easy. But dxdx and dudu aren't interchangeable by fiat. They're connected by a stretch factor, and that stretch factor is g(x)g'(x).

Picture the xx-axis as a rubber ruler. The function gg grabs that ruler and stretches it, unevenly, into a new ruler marked in units of uu. A tiny step of width dxdx on the original ruler doesn't land as a step of the same width on the new one. It stretches or compresses by however fast gg is changing at that point, which is exactly g(x)g'(x).

Visualizer 02

Stretching the Ruler

The same width dx on the x-ruler lands as a wider or narrower slice on the u-ruler below it, because u = x² stretches unevenly. That stretch factor is g'(x), and du = g'(x)·dx is just its name.

0.20.40.60.81.01.21.41.61.82.02.2x-ruler012345u-ruler (u = x²)
dx (fixed window)0.12
Actual Δu0.2544
Predicted g'(x)·dx = 2x·dx0.2400

Slide the window along the x-ruler and watch the matching window on the u-ruler below it. Near x=0.2x = 0.2, where gg is barely changing, the two windows are almost the same size. Near x=2x = 2, where g(x)=x2g(x) = x^2 is climbing fast, the u-window balloons. That difference in size is g(x)g'(x), and it's the reason du=g(x)dxdu = g'(x)\, dx isn't a trick. It's just unit conversion between two rulers.


How do you know which piece to call u?

Look for a function trapped inside another function, a composition. Then check whether its derivative, or something close to it, is sitting elsewhere in the integrand, ready to cancel.

A few patterns to watch for:

  • Trig function wrapped around a polynomial, like cos(x2)\cos(x^2): let uu be the polynomial.
  • Something raised to a power, like (x3+1)5(x^3 + 1)^5: let uu be the base.
  • An exponent that's itself a function, like ex3e^{x^3}: let uu be the exponent.

The test is always the same. After you substitute, does every remaining xx disappear, replaced entirely by uu? If yes, you picked well. If stray xx's are still hanging around, you picked the wrong piece.

Visualizer 03

Pick Your u for ∫ 3x² e^(x³) dx

Three ways to name u. Only one leaves the integral fully rewritten in terms of u with nothing left over.

∫ 3x² e^(x³) dxPick a candidate above to see what happens to the integral.
Chosen unone yet
Verdict-

Try all three buttons. Only u=x3u = x^3 leaves nothing behind. u=x2u = x^2 leaves a stray xx with nowhere to go. And u=ex3u = e^{x^3} technically "works," but it just renames the entire integrand as uu without simplifying anything, so you learn nothing from it.


Definite integrals need new boundaries too

Substitution changes more than the function inside the integral. If you're integrating from x=ax = a to x=bx = b, those bounds were measured on the xx-ruler. Once you switch to the uu-ruler, you need bounds measured on that ruler instead.

The rule is simple: convert the bounds using the same substitution you already picked.

x=a    u=g(a),x=b    u=g(b)x = a \implies u = g(a), \qquad x = b \implies u = g(b)

For our running example, u=x2u = x^2, so an integral from x=0x = 0 to x=bx = b becomes an integral from u=0u = 0 to u=b2u = b^2.

Visualizer 04

Bounds Have to Move Too

Same area, two different rulers. When x runs from 0 to b, u = x² runs from 0 to b². Swap the bounds along with the variable and the two shaded regions stay equal.

x-space: ∫₀ᵇ 2x·cos(x²) dxu-space: ∫₀^(b²) cos(u) du
Upper bound in u (b²)2.250
Area in x-space0.7781
Area in u-space0.7781

Move the slider and watch both shaded regions. The orange area is computed entirely in xx, the green area entirely in uu, with completely different bounds and a completely different curve underneath. They still come out equal every time, because they're measuring the exact same accumulated quantity, just on two different rulers.


Two quick examples to lock it in

Example 1: xx2+1dx\int x\sqrt{x^2+1}\, dx

Let u=x2+1u = x^2 + 1, so du=2xdxdu = 2x\, dx, which means xdx=12dux\, dx = \frac{1}{2} du. The integral becomes 12udu=13u3/2+C=13(x2+1)3/2+C\frac{1}{2}\int \sqrt{u}\, du = \frac{1}{3}u^{3/2} + C = \frac{1}{3}(x^2+1)^{3/2} + C.

Example 2: lnxxdx\int \frac{\ln x}{x}\, dx

Let u=lnxu = \ln x, so du=1xdxdu = \frac{1}{x} dx. The integral becomes udu=12u2+C=12(lnx)2+C\int u\, du = \frac{1}{2}u^2 + C = \frac{1}{2}(\ln x)^2 + C.

Notice the shape both times: something composed inside a function, and its derivative sitting right next to it, just waiting to become dudu.


The mistakes that actually trip people up

Forgetting to convert dxdx all the way is the biggest one. If a stray xx survives after substitution, the integral isn't done, it's stuck, and no amount of algebra rescues it. Go back and pick a different uu.

For definite integrals, forgetting to swap the bounds is the second biggest. If you substitute the function but leave the original xx-bounds in place, you'll compute a number that has nothing to do with the actual area. Either convert the bounds to uu, or substitute back to xx before plugging in the original bounds. Just don't mix the two.

And don't forget the +C+C. Once you swap back from uu to xx, that constant of integration comes along for the ride just like always.


U-substitution isn't a separate topic from differentiation. It's the chain rule, read from right to left. Whenever you see a function tangled inside another function, with the inner function's derivative loitering nearby, rename the inner function uu, rewrite dxdx in terms of dudu, and let the composition collapse into something you already know how to integrate. Convert the bounds if you're working with a definite integral, and you're done.