# Calculus: Integrals IV

## u-Substitution

Integrating simple functions that are known to be the derivatives of other simple functions is easy - it's requires little more than a good memory. But what about more complicated functions? Not all functions are easy to integrate, and some can't be integrated at all. But just as there are more intricate differentiation techniques like the product rule and the chain rule, so, too are there more intricate integration techniques. In fact, these integration techniques are obtained by "undoing" those very differentiation techniques, and they are the focus of the following section.

The integration counterpart to the chain rule is the $u$-substitution method. The idea is to substitute some new variable $u$ for a more complicated term involving $x$. Likewise, the $dx$ term of the integral must also be replaced by a corresponding $du$ term. If done correctly, the new integral in terms of $u$ and $du$ should be simpler to solve and allow the use of one of the basic integration techniques. Remember that the chain rule differentiates the outside function, then multiplies it by the derivative of the inside function. Since the $u$-substitution method is "undoing" this, the trick is to look for a function inside another function, which is in turn multiplied by the derivative of the inside function. An example is worth a thousand theorems. Let's evaluate the following integral:

$$\displaystyle\int 2x\cos\left(x^2\right) \, dx$$

Notice that while we might know the integrals of $2x$, $x^2$, or $\cos(x)$, we don't know the integral of their combination in the integral shown here. But notice that $2x$ is the derivative of $x^2$. Furthermore, $x^2$ is inside another function, namely $\cos$, which is in turn multiplied by $2x$. Let's make the following substitution:

Let $u = x^2$ such that $\dfrac{du}{dx} = 2x$. Then $du = 2x \, dx$. Substituting back into the original equation gives us the following:

$$\displaystyle\int 2x\cos\left(x^2\right) \, dx = \displaystyle\int \cos(u) \, du$$

Look at that! That's easier to integrate. The integral of cosine is sine plus the the arbitrary constant:

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

Now all we have to do is substitute $x$ back in:

$$\sin(u) + C = \sin\left(x^2\right) + C$$

And now just to put a bow on it:

$$\displaystyle\int 2x\cos\left(x^2\right) \, dx = \sin\left(x^2\right) + C$$

If this is still confusing, try reading it again. Alternatively, staring at the page is also often helpful. If those fail, doing more practice problems should help. Remember, the trick is to find a function and its derivative used in the right way. Apply a bit of substitution jiggery-pokery, and bada bing bada boom you've got your integral solved.

## Problems

1. Evaluate: $\displaystyle\int \cos(x)\sin^2(x) \, dx$

$\displaystyle\int \cos(x)\sin^2(x) \, dx$

Let $u = \sin(x)$ such that $\dfrac{du}{dx} = \cos(x)$. Then $du = \cos(x) \, dx$. Now substitute back into the original equation:

$\displaystyle\int \cos(x)\sin^2(x) \, dx = \displaystyle\int u^2 \, du \\ \displaystyle\int \cos(x)\sin^2(x) \, dx = \dfrac{1}{3} u^3 + c \\ \displaystyle\int \cos(x)\sin^2(x) \, dx = \dfrac{1}{3} \sin^3(x) + c \\$

2. Evaluate: $\displaystyle\int (1+x)^{100} \, dx$

$\displaystyle\int (1+x)^{100} \, dx\\$

Let $u = 1+x$   such that   $\dfrac{du}{dx} = 1$. Then $dx = du$. Now substitute back into the original equation:

$\displaystyle\int (1+x)^{100} \, dx = \int u^{100} \, du \\ \displaystyle\int (1+x)^{100} \, dx = \dfrac{1}{101}u^{101} + c\\ \displaystyle\int (1+x)^{100} \, dx = \dfrac{1}{101}(1+x)^{101} + c\\$

3. Evaluate: $\displaystyle\int \dfrac{3x}{x^2+8} \, dx$

$\displaystyle\int \dfrac{3x}{x^2+8} \, dx$

Let $u = x^2 + 8$ such that $\dfrac{du}{dx} = 2x$. Then $dx = \dfrac{du}{2x}$. Now substitute back into the original equation:

$\displaystyle\int \dfrac{3x}{x^2+8} \, dx = \displaystyle\int \dfrac{3x}{u} \dfrac{du}{2x} \\ \displaystyle\int \dfrac{3x}{x^2+8} \, dx = \dfrac{3}{2}\displaystyle\int \dfrac{1}{u} \, du \\ \displaystyle\int \dfrac{3x}{x^2+8} \, dx = \dfrac{3}{2}\ln|u| + c \\ \displaystyle\int \dfrac{3x}{x^2+8} \, dx = \dfrac{3}{2}\ln\left|x^2+8\right| + c \\$

4. Integrate with respect to $x$: $\dfrac{dy}{dx} = (6x^2+2)(2x^3+2x+\pi)^{7}$

$\displaystyle\int\dfrac{dy}{dx} \, dx = \int (6x^2+2)(2x^3+2x+\pi)^{7} \, dx\\ y = \int (6x^2+2)(2x^3+2x+\pi)^{7} \, dx \\$

Let $u = 2x^3 + 2x + \pi$   such that   $\dfrac{du}{dx} = 6x^2+2$. Then $dx = \dfrac{du}{6x+2}$. Now substitute back into the original equation:

$y = \displaystyle\int (6x^2+2)u^{7} \dfrac{du}{6x^2+2} \\ y = \displaystyle\int u^{7} \, du \\ y = \dfrac{1}{8}u^{8} + c\\ y = \dfrac{1}{8}(2x^3+2x+\pi)^{8} + c\\$

5. Show that $\displaystyle\int a^x \, dx = \dfrac{1}{\ln(a)}a^x + c$ where $a > 0$.

$\displaystyle\int a^x \, dx = \displaystyle\int e^{\ln(a)x} \, dx$

Let $u = \ln(a)x$ such that $\dfrac{du}{dx} = \ln(a)$. Then $dx = \dfrac{du}{\ln(a)}$. Now substitute back into the original equation:

$\displaystyle\int a^x \, dx = \displaystyle\int e^{u} \dfrac{du}{\ln(a)} \\ \displaystyle\int a^x \, dx = \dfrac{1}{\ln(a)}\displaystyle\int e^{u} \, du \\ \displaystyle\int a^x \, dx = \dfrac{1}{\ln(a)}e^u + c \\ \displaystyle\int a^x \, dx = \dfrac{1}{\ln(a)}e^{\ln(a)x} + c \\ \displaystyle\int a^x \, dx = \dfrac{1}{\ln(a)}a^{x} + c \\$

6. Evaluate: $\displaystyle\int (10x+1)^5 \, dx$

$\displaystyle\int (10x+1)^5 \, dx$

Let $u = 10x+1$ such that $\dfrac{du}{dx} = 10$. Then $dx = \dfrac{du}{10}$. Now substitute back into the original equation:

$\displaystyle\int (10x+1)^5 \, dx = \displaystyle\int \dfrac{1}{10}u^5 \, du \\ \displaystyle\int (10x+1)^5 \, dx = \dfrac{1}{10}\displaystyle\int u^5 \, du \\ \displaystyle\int (10x+1)^5 \, dx = \dfrac{1}{10}\left(\dfrac{1}{6}u^6 + c\right) \\ \displaystyle\int (10x+1)^5 \, dx = \dfrac{1}{60}u^6 + c \\ \displaystyle\int (10x+1)^5 \, dx = \dfrac{1}{60}(10x+1)^6 + c \\$

7. Evaluate: $\displaystyle\int 8x\sin(4x^2) \, dx$

$\displaystyle\int 8x\sin\left(4x^2\right) \, dx$

Let $u = 4x^x$ such that $\dfrac{du}{dx} = 8x$. Then $dx = \dfrac{du}{8x}$. Now substitute back into the original equation:

$\displaystyle\int 8x\sin(4x^2) \, dx = \displaystyle\int \sin(u) \, du \\ \displaystyle\int 8x\sin(4x^2) \, dx = -\cos(u) + c \\ \displaystyle\int 8x\sin(4x^2) \, dx = -\cos\left(4x^2\right) + c \\$

8. Evaluate: $\displaystyle\int \dfrac{4x}{1+x^2} \, dx$

$\displaystyle\int \dfrac{4x}{1+x^2} \, dx$

Let $u = 1+x^2$ such that $\dfrac{du}{dx} = 2x$. Then $dx = \dfrac{du}{2x}$. Now substitute back into the original equation.

$\displaystyle\int \dfrac{4x}{1+x^2} \, dx = \displaystyle\int \dfrac{2}{u} \, du \\ \displaystyle\int \dfrac{4x}{1+x^2} \, dx = 2\displaystyle\int \dfrac{1}{u} \, du \\ \displaystyle\int \dfrac{4x}{1+x^2} \, dx = 2\ln|u| + c \\ \displaystyle\int \dfrac{4x}{1+x^2} \, dx = 2\ln\left|1+x^2\right| + c \\$
9. Evaluate: $\displaystyle\int \sin^2(x)\cos(x) \, dx$

$\displaystyle\int \sin^2(x)\cos(x) \, dx$

Let $u = \sin(x)$ such that $\dfrac{du}{dx} = \cos(x)$. Then $dx = \dfrac{du}{\cos(x)}$. Now substitute back into the original equation:

$\displaystyle\int \sin^2(x)\cos(x) \, dx = \int u^2\cos(x)\dfrac{1}{\cos(x)}du \\ \displaystyle\int \sin^2(x)\cos(x) \, dx = \int u^2du \\ \displaystyle\int \sin^2(x)\cos(x) \, dx = \dfrac{1}{3}u^3 + c \\ \displaystyle\int \sin^2(x)\cos(x) \, dx = \dfrac{1}{3}\sin^3(x) + c \\$

10. Evaluate: $\displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx$

$\displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx = \dfrac{1}{2} \displaystyle\int xe^{-x^2} \, dx$

Let $u = -x^2$ such that $\dfrac{du}{dx} = -2x$. Then $dx = \dfrac{-du}{2x}$. Now substitute back into the original equation:

$\displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx = \dfrac{1}{2}\displaystyle\int \left(-xe^u \dfrac{du}{2x} \right) \\ \displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx = \dfrac{1}{2}\displaystyle\int -\dfrac{1}{2}e^u \, du \\ \displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx = \dfrac{-1}{4}\displaystyle\int e^u \, du \\ \displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx = \dfrac{-1}{4} e^u + c \\ \displaystyle\int \dfrac{1}{2}xe^{-x^2} \, dx = \dfrac{-1}{4} e^{-x^2} + c \\$

11. Evaluate: $\displaystyle\int \dfrac{\ln(x)}{x} \, dx$

$\displaystyle\int \dfrac{\ln(x)}{x} \, dx$

Let $u = \ln(x)$ such that $\dfrac{du}{dx} = \dfrac{1}{x}$. Then $dx = x \, du$. Now substitute back into the original equation:

$\displaystyle\int \dfrac{\ln(x)}{x} \, dx = \displaystyle\int \dfrac{u}{x} x \, du \\ \displaystyle\int \dfrac{\ln(x)}{x} \, dx = \displaystyle\int u \, du \\ \displaystyle\int \dfrac{\ln(x)}{x} \, dx = \dfrac{1}{2}u^2 + c \\ \displaystyle\int \dfrac{\ln(x)}{x} \, dx = \ln^2(x) + c \\$

12. Evaluate: $\displaystyle\int \tan(x) \, dx$

$\displaystyle\int \tan(x) \, dx = \displaystyle\int \dfrac{\sin(x)}{\cos(x)} \, dx$

Let $u = \cos(x)$ such that $\dfrac{du}{dx} = -\sin(x)$. Then $dx = \dfrac{-du}{\sin(x)}$. Now substitute back into the original equation:

$\displaystyle\int \tan(x) \, dx = \displaystyle\int \dfrac{\sin(x)}{u} \dfrac{du}{-\sin(x)} \\ \displaystyle\int \tan(x) \, dx = -\displaystyle\int \dfrac{1}{u} \, du \\ \displaystyle\int \tan(x) \, dx = -\ln|u| + c \\ \displaystyle\int \tan(x) \, dx = -\ln|\cos(x)| + c \\$

13. Evaluate: $\displaystyle\int \sin^3(x) \, dx$.

$\displaystyle\int \sin^3(x) \, dx = \displaystyle\int \sin(x)\sin^2(x) \, dx \\ \displaystyle\int \sin^3(x) \, dx = \displaystyle\int \sin(x)\left(1-\cos^2(x)\right) \, dx \\$

Let $u = \cos(x)$ such that $\dfrac{du}{dx}=-\sin(x)$. Then $dx = \dfrac{-du}{\sin(x)}$. Now substitute back into the original equation:

$\displaystyle\int \sin^3(x) \, dx = \displaystyle\int (1-u^2)\sin(x)\dfrac{-du}{\sin(x)} \\ \displaystyle\int \sin^3(x) \, dx = \displaystyle\int u^2 - 1 \, du \\ \displaystyle\int \sin^3(x) \, dx = \dfrac{1}{3}u^3 - u + c \\ \displaystyle\int \sin^3(x) \, dx = \dfrac{1}{3}\cos^3(x) - \cos(x) + c \\$

14. Evaluate: $\displaystyle\int x\sqrt{x+7} \, dx$

$\displaystyle\int x\sqrt{x+7} \, dx$

Let $u=x+7$ such that $\dfrac{du}{dx} = 1$. Then $dx = du$. Now substitute back into the original equation:

$\displaystyle\int x\sqrt{x+7} \, dx = \displaystyle\int (u-7)\sqrt{u} \, du \\ \displaystyle\int x\sqrt{x+7} \, dx = \displaystyle\int u\sqrt{u}-7\sqrt{u} \, du \\ \displaystyle\int x\sqrt{x+7} \, dx = \displaystyle\int u^{3/2}-7u^{1/2} \, du \\ \displaystyle\int x\sqrt{x+7} \, dx = \dfrac{2}{5}u^{5/2} -7\left(\dfrac{2}{3}u^{3/2}\right) + c \\ \displaystyle\int x\sqrt{x+7} \, dx = \dfrac{2}{5}u^{5/2} -\dfrac{14}{3}u^{3/2} + c \\ \displaystyle\int x\sqrt{x+7} \, dx = \dfrac{2}{5}(x+7)^{5/2} -\dfrac{14}{3}(x+7)^{3/2} + c \\$

15. Evaluate: $\displaystyle\int x^3\sqrt{4-x^2} \, dx$

$\displaystyle\int x^3\sqrt{4-x^2} \, dx$

Let $u = 4-x^2$ such that $\dfrac{du}{dx} = -2x$. Then $dx = -\dfrac{du}{2x} \, dx$. Now substitute back into the original equation:

$\displaystyle\int x^3\sqrt{4-x^2} \, dx = \displaystyle\int -\dfrac{1}{2}(u+4)\sqrt{u} \, du \\ \displaystyle\int x^3\sqrt{4-x^2} \, dx = -\dfrac{1}{2}\displaystyle\int (u+4)\sqrt{u} \, du \\ \displaystyle\int x^3\sqrt{4-x^2} \, dx = -\dfrac{1}{2}\displaystyle\int u\sqrt{u}+4\sqrt{u} \, du \\ \displaystyle\int x^3\sqrt{4-x^2} \, dx = -\dfrac{1}{2}\displaystyle\int u^{3/2}+4u^{1/2} \, du \\ \displaystyle\int x^3\sqrt{4-x^2} \, dx = -\dfrac{1}{2}\left(\dfrac{2}{5}u^{5/2}+4\left(\dfrac{2}{3}u^{3/2}\right)\right) + c \\ \displaystyle\int x^3\sqrt{4-x^2} \, dx = -\dfrac{1}{5}u^{5/2} - \dfrac{4}{3}u^{3/2} + c \\ \displaystyle\int x^3\sqrt{4-x^2} \, dx = -\dfrac{1}{5}\left(4-x^2\right)^{5/2} - \dfrac{4}{3}\left(4-x^2\right)^{3/2} + c \\$

16. Evaluate: $\displaystyle\int \sec(x) \, dx$

This integral shall be solved by trickery:

$\displaystyle\int \sec(x) \, dx = \displaystyle\int \sec(x) \dfrac{\sec(x) + \tan(x)}{\sec(x) + \tan(x)} \, dx \\ \displaystyle\int \sec(x) \, dx = \displaystyle\int \dfrac{\sec(x)(\sec(x) + \sec(x)\tan(x))}{\sec(x) + \tan(x)} \, dx \\$

Let $u = \sec(x) + \tan(x)$ such that $\dfrac{du}{dx} = \sec(x)\tan(x) + \sec^2(x) = \sec(x)(\sec(x) + \tan(x))$. Then $dx = \dfrac{du}{\sec^2(x) + \sec(x)\tan(x)}$. Now substitute back into the original equation:

$\displaystyle\int \sec(x) \, dx = \displaystyle\int \dfrac{\sec^2(x) + \sec(x)\tan(x)}{u} \, \dfrac{du}{\sec^2(x) + \sec(x)\tan(x)} \\ \displaystyle\int \sec(x) \, dx = \displaystyle\int \dfrac{1}{u} \, du \\ \displaystyle\int \sec(x) \, dx = \ln|u| + c \\ \displaystyle\int \sec(x) \, dx = \ln|\sec(x) + \tan(x)| + c \\$