Unit 2, chapter 5

Substitution for a hidden inner variable

How u-substitution runs the chain rule in reverse, turning an inner function and its derivative into a new variable with the differential du and changed bounds, and when the substitution must be one-to-one.

  • Chapter 5
  • Substitution, integration by parts and trigonometric identities

What is the exact value of ∫0π/22xcos⁡(x2) dx\int_0^{\sqrt{\pi/2}} 2x\cos(x^2)\,dx? The function cos⁡(x2)\cos(x^2) on its own has no antiderivative built from elementary functions, but here it is multiplied by 2x2x, the derivative of the expression x2x^2 inside the cosine. This page shows how that pairing lets a new variable u=x2u = x^2 absorb the whole factor 2x dx2x\,dx, how the bounds move with the variable, why the change of variable is legitimate on this interval, and why the integral equals 11.

Key terms

Inner function

Definition In a composition f(g(x))f(g(x)), the function gg is the inner function and ff is the outer function. The value g(x)g(x) is computed first and then used as the input of ff. For substitution the inner function is the natural candidate for the new variable u=g(x)u = g(x), and the integrand is ready for the substitution rule when the remaining factor is g′(x)g'(x) or a constant multiple of it.

In plain words Look for an expression that sits inside another function, such as the input of a cosine, the base of a power or the exponent of ee. Differentiate that expression and look for the result among the other factors.

Example In 2xcos⁡(x2)2x\cos(x^2) the inner function is x2x^2, the outer function is cosine, and the derivative 2x2x of the inner function is exactly the other factor. In xcos⁡(x2)x\cos(x^2) the factor xx is half of that derivative, which is still enough, because x dx=12 dux\,dx = \tfrac12\,du. In cos⁡(x2)\cos(x^2) alone the derivative of the inside is missing, and this function has no elementary antiderivative at all.

Chain rule in reverse

Definition Let gg be differentiable on an interval II, and let FF be an antiderivative of ff on an interval that contains every value g(x)g(x) with xx in II. The chain rule gives

ddxF(g(x))=F′(g(x)) g′(x)=f(g(x)) g′(x),\begin{aligned} \frac{d}{dx}F(g(x)) &= F'(g(x))\,g'(x) \\[0.4em] &= f(g(x))\,g'(x), \end{aligned}

so F(g(x))F(g(x)) is an antiderivative of f(g(x)) g′(x)f(g(x))\,g'(x) on II, and

∫f(g(x)) g′(x) dx=F(g(x))+C.\begin{aligned} &\int f(g(x))\,g'(x)\,dx \\[0.4em] &\quad = F(g(x)) + C. \end{aligned}

In plain words Every chain rule derivative has the shape of an outer derivative, evaluated at the inside, times the derivative of the inside. An integrand with that shape can be integrated by recognizing which function was differentiated.

Example Since

ddxsin⁡(x2)=cos⁡(x2)⋅2x,\frac{d}{dx}\sin(x^2) = \cos(x^2)\cdot 2x,

it follows that ∫2xcos⁡(x2) dx=sin⁡(x2)+C\int 2x\cos(x^2)\,dx = \sin(x^2) + C on the whole real line. In the same way ∫cos⁡x esin⁡x dx=esin⁡x+C\int \cos x\,e^{\sin x}\,dx = e^{\sin x} + C. Differentiating the answer and getting the integrand back is the check that the reversal was done correctly.

Differential du

Definition For u=g(x)u = g(x) with gg differentiable, the differential of uu is du=g′(x) dxdu = g'(x)\,dx. In a substitution the whole product g′(x) dxg'(x)\,dx is replaced by dudu, and a constant multiple is handled the same way, c g′(x) dx=c duc\,g'(x)\,dx = c\,du. The notation records the linear part of the exact change of uu,

Δu=g(x+Δx)−g(x)=g′(x) Δx+ε Δx,\begin{aligned} \Delta u &= g(x + \Delta x) - g(x) \\[0.4em] &= g'(x)\,\Delta x + \varepsilon\,\Delta x, \end{aligned}

where ε→0\varepsilon \to 0 as Δx→0\Delta x \to 0.

In plain words When gg is increasing, a thin strip of width Δx\Delta x at position xx corresponds to a strip on the uu-axis whose width is close to g′(x) Δxg'(x)\,\Delta x. The factor g′(x)g'(x) in the integrand measures this stretching, so it is absorbed into dudu rather than dropped.

Example For u=x2u = x^2 the differential is du=2x dxdu = 2x\,dx, and the exact change is

Δu=(x+Δx)2−x2=2x Δx+(Δx)2.\begin{aligned} \Delta u &= (x + \Delta x)^2 - x^2 \\[0.4em] &= 2x\,\Delta x + (\Delta x)^2. \end{aligned}

At x=1x = 1 with Δx=0.1\Delta x = 0.1 the exact change is 0.210.21 and the linear part 2x Δx2x\,\Delta x is 0.20.2. The extra term (Δx)2(\Delta x)^2 shrinks faster than Δx\Delta x, so it disappears in the limit of thin strips. In the integral the group 2x dx2x\,dx becomes dudu and cos⁡(x2)\cos(x^2) becomes cos⁡u\cos u, so 2xcos⁡(x2) dx2x\cos(x^2)\,dx becomes cos⁡u du\cos u\,du. Replacing only x2x^2 by uu and leaving 2x dx2x\,dx in place would mix two variables in one integral.

U-substitution

Definition Let gg be continuously differentiable on [a,b][a, b], and let ff be continuous on an interval that contains every value g(x)g(x) with a≤x≤ba \le x \le b. Then

∫abf(g(x)) g′(x) dx=∫g(a)g(b)f(u) du.\begin{aligned} &\int_a^b f(g(x))\,g'(x)\,dx \\[0.4em] &\quad = \int_{g(a)}^{g(b)} f(u)\,du. \end{aligned}

To use it, set u=g(x)u = g(x), replace g′(x) dxg'(x)\,dx by dudu, and replace the bounds aa and bb by g(a)g(a) and g(b)g(b). The rule holds as stated even when g(b)<g(a)g(b) < g(a) and even when gg is not one-to-one. Because ff is continuous it has an antiderivative FF, and the fundamental theorem, applied to F(g(x))F(g(x)) on the left and to F(u)F(u) on the right, makes both sides equal to F(g(b))−F(g(a))F(g(b)) - F(g(a)).

In plain words Rename the inner expression as a new coordinate. Its derivative, together with dxdx, becomes the width dudu of a strip in the new coordinate, and the endpoints move to where the inner function sends them. Both integrals describe the same accumulated total in different coordinates.

Example For the integral of this page take u=x2u = x^2, so du=2x dxdu = 2x\,dx. The function x2x^2 is continuously differentiable, and cosine is continuous on [0,π/2][0, \pi/2]. The bounds x=0x = 0 and x=π/2x = \sqrt{\pi/2} become u=0u = 0 and u=π/2u = \pi/2, and

∫0π/22xcos⁡(x2) dx=∫0π/2cos⁡u du=sin⁡π2−sin⁡0=1.\begin{aligned} &\int_0^{\sqrt{\pi/2}} 2x\cos(x^2)\,dx \\[0.4em] &\quad = \int_0^{\pi/2} \cos u\,du \\[0.4em] &\quad = \sin\frac{\pi}{2} - \sin 0 = 1. \end{aligned}

Differentiating sin⁡(x2)\sin(x^2) returns 2xcos⁡(x2)2x\cos(x^2), which confirms the antiderivative in the original variable. The size is plausible too. On [0,π/2][0, \pi/2] the cosine lies between 00 and 11, so its integral lies between 00 and π/2≈1.571\pi/2 \approx 1.571, and the original integrand is nonnegative on its interval because 2x2x and cos⁡(x2)\cos(x^2) both are.

Changing the bounds

Definition The bounds of a definite integral are values of its variable of integration. When u=g(x)u = g(x) and xx runs from aa to bb, the new integral runs from u=g(a)u = g(a) to u=g(b)u = g(b), in that order even when g(a)>g(b)g(a) > g(b). The alternative is to find an antiderivative in uu, substitute u=g(x)u = g(x) back, and evaluate at the original bounds aa and bb. Both routes give the same number.

In plain words The new limits are the old endpoints written in the new coordinate. An integrand in uu with bounds in xx answers a different question.

Example For u=x2u = x^2 the endpoints x=0x = 0 and x=π/2x = \sqrt{\pi/2} map to u=0u = 0 and u=π/2u = \pi/2. Returning to xx instead gives the antiderivative sin⁡(x2)\sin(x^2) and the same value, sin⁡(π/2)−sin⁡0=1\sin(\pi/2) - \sin 0 = 1. Keeping the old bounds with the new integrand would give

∫0π/2cos⁡u du=sin⁡(π/2)≈0.950,\begin{aligned} \int_0^{\sqrt{\pi/2}} \cos u\,du &= \sin\bigl(\sqrt{\pi/2}\bigr) \\[0.4em] &\approx 0.950, \end{aligned}

which is wrong, even though it looks reasonable.

One-to-one substitution

Definition A substitution u=g(x)u = g(x) is one-to-one on [a,b][a, b] when different points of [a,b][a, b] give different values of uu. For a continuous gg this means that gg is strictly increasing or strictly decreasing on [a,b][a, b], so every uu between g(a)g(a) and g(b)g(b) comes from exactly one xx, written x=g−1(u)x = g^{-1}(u). The substitution rule above does not require this, because the integrand already contains the whole factor g′(x) dxg'(x)\,dx. It is required when part of the integrand must be rewritten through x=g−1(u)x = g^{-1}(u), since one formula for xx in terms of uu then has to hold on the whole interval. When gg is not one-to-one, split the interval into pieces on which it is.

In plain words If the integrand already has the shape f(g(x)) g′(x)f(g(x))\,g'(x), substitute without further checks. If you have to solve u=g(x)u = g(x) for xx, make sure each value of uu comes from only one xx.

Example On [0,π/2][0, \sqrt{\pi/2}] every xx is nonnegative, so x2x^2 is strictly increasing and the substitution is one-to-one. Its derivative 2x2x is zero at the endpoint x=0x = 0, which does no harm, because the rule replaces the product 2x dx2x\,dx by dudu and never divides by 2x2x. On [−1,1][-1, 1] the same substitution is not one-to-one, yet the rule still applies directly and gives

∫−112xcos⁡(x2) dx=∫11cos⁡u du=0,\begin{aligned} &\int_{-1}^{1} 2x\cos(x^2)\,dx \\[0.4em] &\quad = \int_1^1 \cos u\,du = 0, \end{aligned}

which is correct, because the integrand is an odd function.

Check yourself

  1. Evaluate the integral
∫01x(x2+1)3 dx.\int_0^1 x(x^2+1)^3\,dx.
Show the answer

The inner function is x2+1x^2 + 1, with derivative 2x2x, and the integrand contains half of it. With u=x2+1u = x^2 + 1 we have du=2x dxdu = 2x\,dx, so x dx=12 dux\,dx = \tfrac12\,du. The bounds x=0x = 0 and x=1x = 1 become u=1u = 1 and u=2u = 2, and

∫01x(x2+1)3 dx=12∫12u3 du=12⋅24−144=158.\begin{aligned} &\int_0^1 x(x^2+1)^3\,dx \\[0.4em] &\quad = \frac12\int_1^2 u^3\,du \\[0.4em] &\quad = \frac12\cdot\frac{2^4 - 1^4}{4} = \frac{15}{8}. \end{aligned}

As a check, the derivative of 18(x2+1)4\tfrac18(x^2+1)^4 is x(x2+1)3x(x^2+1)^3, and its values at 11 and 00 are 22 and 18\tfrac18, whose difference is 158\tfrac{15}{8}.

  1. Evaluate the integral below. A classmate gets −13-\tfrac13. Where can the sign go wrong?
∫0π/2sin⁡xcos⁡2x dx\int_0^{\pi/2} \sin x\cos^2 x\,dx
Show the answer

Take u=cos⁡xu = \cos x, so du=−sin⁡x dxdu = -\sin x\,dx and sin⁡x dx=−du\sin x\,dx = -du. The bounds x=0x = 0 and x=π/2x = \pi/2 become u=1u = 1 and u=0u = 0, in decreasing order, which the rule allows. Then

∫0π/2sin⁡xcos⁡2x dx=∫10u2 (−du)=∫01u2 du=13.\begin{aligned} &\int_0^{\pi/2} \sin x\cos^2 x\,dx \\[0.4em] &\quad = \int_1^0 u^2\,(-du) \\[0.4em] &\quad = \int_0^1 u^2\,du = \frac13. \end{aligned}

There are two sign changes, the minus in du=−sin⁡x dxdu = -\sin x\,dx and the reversed bounds, and they cancel. Dropping either one alone gives −13-\tfrac13. That answer cannot be right, because sin⁡xcos⁡2x≥0\sin x\cos^2 x \ge 0 on [0,π/2][0, \pi/2], so the integral is positive.

  1. A student evaluates the integral below by setting u=x2u = x^2, writing x=ux = \sqrt{u} and dx=du/(2u)dx = du/(2\sqrt{u}). Both bounds become u=1u = 1, so the student answers 00. What went wrong, and what is the correct value?
∫−11x2 dx\int_{-1}^{1} x^2\,dx
Show the answer

The integrand x2 dxx^2\,dx does not contain the factor 2x dx2x\,dx, so the student had to solve for xx. The formula x=ux = \sqrt{u} holds only for x≥0x \ge 0. On [−1,1][-1, 1] the substitution u=x2u = x^2 is not one-to-one, since every uu in (0,1](0, 1] comes from two values of xx, and on [−1,0][-1, 0] the correct formula is x=−ux = -\sqrt{u}, with dx=−du/(2u)dx = -du/(2\sqrt{u}).

Split the interval at 00. On [0,1][0, 1] the bounds become 00 and 11, and on [−1,0][-1, 0] they become 11 and 00, so

∫01x2 dx=∫01u2 du=13,∫−10x2 dx=∫10(−u2) du=∫01u2 du=13.\begin{aligned} \int_0^1 x^2\,dx &= \int_0^1 \frac{\sqrt{u}}{2}\,du = \frac13, \\[0.4em] \int_{-1}^0 x^2\,dx &= \int_1^0 \Bigl(-\frac{\sqrt{u}}{2}\Bigr)\,du \\[0.4em] &= \int_0^1 \frac{\sqrt{u}}{2}\,du = \frac13. \end{aligned}

Here u/(2u)=u/2u/(2\sqrt{u}) = \sqrt{u}/2 for u>0u > 0. The total is 23\tfrac23, which agrees with the power rule, [x3/3]−11=13+13\bigl[x^3/3\bigr]_{-1}^{1} = \tfrac13 + \tfrac13. The answer 00 was impossible from the start, since x2x^2 is positive except at x=0x = 0.

How this lesson connects

It also uses the chain rule and the derivative of sine.