Integration Technique #1: Substitution

1. Try integrating
(1)$\displaystyle \int^{2}_{0}x\cos(x^{2}+1)\,\mathrm{d}x=$???
It’s kind of hard, so we try to do something very clever: use the chain rule.

2. Recall the chain rule states, if $f(x)$ and $g(x)$ are differentiable functions, then
(2)$\displaystyle \frac{\mathrm{d}(f(g(x))}{\mathrm{d}x}=\frac{\mathrm{d}f(g(x))}{\mathrm{d}g(x)}\frac{\mathrm{d}g(x)}{\mathrm{d}x}$
We can apply the fundamental theorem of calculus to both sides
(3)$\displaystyle \int\frac{\mathrm{d}(f(g(x))}{\mathrm{d}x}\,\mathrm{d}x=\int\frac{\mathrm{d}f(g(x))}{\mathrm{d}g(x)}\frac{\mathrm{d}g(x)}{\mathrm{d}x}\,\mathrm{d}x$
The left hand side becomes
(4)$\displaystyle \int\frac{\mathrm{d}(f(g(x))}{\mathrm{d}x}\,\mathrm{d}x=f(g(x))+C$
But what about the right hand side of Equation (3)?

Let
(5)$\displaystyle u=g(x)$ and $\displaystyle \mathrm{d}u=\frac{\mathrm{d}g(x)}{\mathrm{d}x}\,\mathrm{d}x$
Then the right hand side of (3) becomes
(6)$\displaystyle \int\frac{\mathrm{d}f(g(x))}{\mathrm{d}g(x)}\frac{\mathrm{d}g(x)}{\mathrm{d}x}\,\mathrm{d}x=\int\frac{\mathrm{d}f(u)}{\mathrm{d}u}\,\mathrm{d}u$
Observe, we can apply the fundamental theorem of calculus to this monstrosity. We get
(7)$\displaystyle \int\frac{\mathrm{d}f(u)}{\mathrm{d}u}\,\mathrm{d}u=f(u)+C$
We set this equal to (4), since both Equations (4) and (7) are just manipulations of Equation (3). We find a nice method to perform mildly complicated integrals!

Example 1. Recall our motivating problem:
(1)$\displaystyle \int^{2}_{0}x\cos(x^{2}+1)\,\mathrm{d}x=$???
Lets let
(8)$\displaystyle u=x^{2}+1\quad$ and $\displaystyle \mathrm{d}u=\frac{\mathrm{d}(x^{2}+1)}{\mathrm{d}x}=2x$
We see we can plug these into Equation (1)
(10)$\displaystyle \displaystyle \int^{2}_{0}x\cos(x^{2}+1)\,\mathrm{d}x=\int^{x=2}_{x=0}\cos(u)\frac{\mathrm{d}u}{2}$
But we know how to integrate $\cos(u)$, we see the integral is
(11)$\displaystyle \displaystyle \int^{x=2}_{x=0}\cos(u)\frac{\mathrm{d}u}{2}=\left.\frac{\sin(u)}{2}\right|^{x=2}_{x=0}$
Now we “unroll” our substitution, plugging in $\displaystyle u=x^{2}+1\quad$ which makes (11) become
(12)$\displaystyle \displaystyle \int^{x=2}_{x=0}\cos(u)\frac{\mathrm{d}u}{2}=\left.\frac{\sin(x^{2}+1)}{2}\right|^{x=2}_{x=0}$
then we can evaluate the right hand side on the boundaries as usual.

Example 2. Lets consider a more complicated problem:
(12)$\displaystyle \int\frac{\ln(x)}{x}\mathrm{d}x=$???
We take
(13)$\displaystyle u = \ln(x)\quad$ and $\displaystyle \mathrm{d}u = \frac{\mathrm{d}x}{x}$
Thus we can rewrite (12) as
(14)$\displaystyle \int\frac{\ln(x)}{x}\mathrm{d}x=\int u\,\mathrm{d}u$
This is a trivial integral
(14′)$\displaystyle \int\frac{\ln(x)}{x}\mathrm{d}x=\frac{u^{2}}{2}+C$
and we “unroll” the substitution obtaining
(15)$\displaystyle \int\frac{\ln(x)}{x}\mathrm{d}x=\frac{\bigl(\ln(x)\bigr)^{2}}{2}+C$
where $C$ is a constant of integration.

Example 3 [Math.SE]. Evaluate
(16)$\displaystyle \int \frac{\sin(x)}{3\cos^{3}(x)+\sin^{2}(x)\cos(x)} \mathrm{d}x$.

Solution. We recall the trigonometric identity
(17)$\displaystyle \sin^{2}(x)=1-\cos^{2}(x)$
which makes our integral become
(18)$\displaystyle \int \frac{\sin(x)}{3\cos^{3}(x)+\sin^{2}(x)\cos(x)} \mathrm{d}x=\int \frac{\sin(x)}{3\cos^{3}(x)+\bigl(1-\cos^{2}(x)\bigr)\cos(x)} \mathrm{d}x$.
Now we pick
(19)$\displaystyle u = \cos(x)$ and $\displaystyle \mathrm{d}u = -\sin(x)\,\mathrm{d}x$.
Our integral (18) becomes
(20)$\displaystyle \int \frac{\sin(x)}{3\cos^{3}(x)+\bigl(1-\cos^{2}(x)\bigr)\cos(x)} \mathrm{d}x=\int \frac{-\mathrm{d}u}{3u^{3}+\bigl(1-u^{2}\bigr)u}$.
Now we do the following trick:
(21)\displaystyle \begin{aligned}\frac{2u}{2u^{2}+1}-\frac{1}{u} &=\frac{2u^{2}}{u(2u^{2}+1)}-\frac{2u^{2}+1}{u(2u^{2}+1)}\\ &=\frac{2u^{2}-(2u^{2}+1)}{u(2u^{2}+1)}\\ &=\frac{-1}{u(2u^{2}+1)}\end{aligned}
Thus our integral (20) simplifies to
(22)$\displaystyle \int \frac{-\mathrm{d}u}{3u^{3}+\bigl(1-u^{2}\bigr)u} = \int\left(\frac{2u}{2u^{2}+1}-\frac{1}{u}\right)\mathrm{d}u$.
But these are two easy integrals! We see that
(23)$\displaystyle \int\frac{1}{u}\,\mathrm{d}u = \ln(u)+C$
where $C$ is a constant of integration.

The other integral
(24)$\displaystyle \int\frac{2u}{2u^{2}+1}\mathrm{d}u$
requires another substitution, namely,
(25)$\displaystyle v=u^{2}$ and $\displaystyle\mathrm{d}v=2u\,\mathrm{d}u$
So (24) becomes
(26)\displaystyle \begin{aligned}\int\frac{u}{u^{2}+1}\mathrm{d}u&=\int\frac{\mathrm{d}v}{2v+1}\\ &=\ln(2v+1)+C'\\ &=\ln(2u^{2}+1)+C'\end{aligned}
where we simply unroll the substitution.

Now we see that
(27)$\displaystyle \int\left(\frac{2u}{2u^{2}+1}-\frac{1}{u}\right)\mathrm{d}u = \ln(2u^{2}+1)-\ln(u)+C$.
WARNING: the constant of integration $C$ in (27) is different than in (23). We just are sloppy/lazy and use the same letter.

But we’re not done yet! We still have to plug in $u=\cos(x)$. So we have
(28)$\displaystyle \ln(2u^{2}+1)-\ln(u)+C=\ln\bigl(2\cos^{2}(x)+1\bigr)-\ln\bigl(\cos(x)\bigr)+C$.
Thus we have
(29)$\displaystyle \int \frac{\sin(x)}{3\cos^{3}(x)+\sin^{2}(x)\cos(x)} \mathrm{d}x=\ln\bigl(2\cos^{2}(x)+1\bigr)-\ln\bigl(\cos(x)\bigr)+C$.
This concludes our example.

Exercise 1. Calculate $\displaystyle\int \frac{1}{\sqrt{2-x^2}} \,\mathrm{d}x =$ ???

Exercise 2 [Math.SE]. Calculate $\displaystyle\int\frac{1}{(1-x^{2})^{3/2}}\,\mathrm{d}x$

Exercise 3 [Math.SE]. Calculate $\displaystyle\int \frac{x^{3}}{(x^{2} + 1)^{1/3}}\,\mathrm{d}x$

Exercise 4. Calculate $\displaystyle\int \frac {\mathrm{d}x}{x^{2}\sqrt{4-x^2}}=$ ???

Exercise 5. Evaluate $\displaystyle\int x\ln(1+x)\,\mathrm{d}x$.

Exercise 6. Compute $\displaystyle\int \frac{\mathrm{d}u}{u \sqrt{5-u^2}}$

Exercise 7. Calculate $\displaystyle\int\mathrm{e}^{\cos(t)}\sin(2t)\,\mathrm{d}t$

Exercise 8. Consider $\displaystyle\int\frac{\mathrm{e}^{\arctan(x)}}{1+x^2}\,\mathrm{d}x =$ ???

Exercise 9 [Math.SE]. Evaluate $\displaystyle\int \sqrt{x^2 + 2x}\,\mathrm{d}x =$ ???

Exercise 10 [Very Trick!, Math.SE] . Compute $\displaystyle \int \frac{x+4}{x^2 + 2x + 5}\,\mathrm{d}x$

Exercise 11 [Math.SE]. Calculate the indefinite integral $\displaystyle\int\frac {x^{2}}{x^{6} + 9}\,\mathrm{d}x$

Exercise 12. Compute $\displaystyle \int\sec(\theta)\,\mathrm{d}\theta$. [Hint: multiply by $1=f(\theta)/f(\theta)$ where $f(\theta)$ is some function involving only secant and tangent of $\theta$.]

Exercise 13. Find $\displaystyle\int\sqrt{1-x^{2}}\,\mathrm{d}x$.