# Integration by Substitution

The idea of integration by substitution is to perform a change of variables in order to transform a complicated into one which is simpler to integrate. We usually perform a substitution on integrals of chains and so integration by substitution is often thought of as the reverse process to the chain rule.

## The Steps of Integration by Substitution

Recall from the further integration page that the integral of $\cos(kx)$ is $\frac{1}{k}\sin(kx)+c$. We use this to illustrate how to perform the steps of integration by substitution on the integral $\int_0^{\frac{\pi}{6}}\cos(3x)dx$.

1. Choose $u$. Choose $u=f(x)$ the function of $x$ which you would like to replace. Change all $x$ terms in the integrand for $u$ terms. For this example, we choose $u=3x$.
2. Replace $dx$.  Using your choice of $u$, find an expression for $\frac{du}{dx}$. Rearrange this to find an expression for $dx$. In the example above, $u=3x$ and so $\frac{du}{dx}=3$. It follows that $dx=\frac{1}{3}du$.
3. Change the Limits.  Of course, if it is a indefinite integral then you may skip this step as there are no limits. However, definite integrals have limits that we must also change. The limits on the original integral are $x$-limits and so we must change them to $u$-limits. Since $u=3x$, if $x=0$ then $u=0$ and if $x=\frac{\pi}{6}$ then $u=\frac{\pi}{2}$.
4. Integrate.  We may now perform the integration:

$\int_0^{\frac{\pi}{6}}\cos(3x)dx\rightarrow \int_0^{\frac{\pi}{2}}\cos(u)\times\frac{1}{3}du=\frac{1}{3}\int_0^{\frac{\pi}{2}}\cos(u) du=\frac{1}{3}\left[\sin(u)\right]_0^{\frac{\pi}{2}}=\frac{1}{3}\left[\sin\left(\frac{\pi}{2}\right)-\sin(0)\right]=\frac{1}{3}$

Note that we transformed the integral to one that we could integrate immediately. Recall that we saw how to integrate $\cos(3x)$ by inspection in further integration. It is also possible to integrate functions of a linear variable (such as $2x+1$) by inspection or by using substitution – see Example 1.

We can use integration by substitution for more complicated functions. Consider $\int\frac{2x}{1+x^2}dx$. By choosing the substitution $u=1+x^2$, we have $\frac{du}{dx}=2x$ and so $dx=\frac{1}{2x}du$. There are no limits to change and the integral becomes $\int \frac{2x}{u}\times\frac{1}{2x}du$.  Normally we would have to deal with the additional $x$ terms but in this case we can see that the derivative cancels. The integral becomes $\int\frac{1}{u}du=\ln\vert u\vert+c=\ln\vert 1+x^2\vert +c$. Notice that for definite integrals we must change the function back to being in terms of $x$. We can differentiate $\ln\vert 1+x^2\vert +c$ to check the above integral. We use the chain rule to get $\frac{2x}{1+x^2}$ as expected. This is why integration by substitution can be thought of as the reverse of chain rule differentiation. In other integrals, the derivative will also cancel if we can see a multiple of the derivative in the integrand – see Example 2.  If there is still a function, even after cancelling any derivatives, this function of $x$ will also have to be replaced for a function of $u$ – see Example 3.

## Integrals of the form $\int\frac{f'(x)}{f(x)}dx$

Some schools (or other institutions) like to teach the following as separate from integration by substitution along with the reverse chain rule as seen above:

$\int\frac{f'(x)}{f(x)}dx=\ln\vert f(x)\vert dx+c$

This states that if we integrate a fraction where a function is the denominator and its derivative is the numerator then the result will be the natural log of that function (+c). We can show this using integration by substitution as follows:

1. Choose $u=f(x)$.
2. The derivative is given by $\frac{du}{dx}=f'(x)$ and so $dx=\frac{1}{f'(x)}du$.
3. There are no limits to replace in this case.
4. The integral becomes: $\int\frac{f'(x)}{f(x)}dx=\int\frac{f'(x)}{u}\times\frac{1}{f'(x)}du=\int \frac{1}{u}du=\ln\vert u\vert +c=\ln\vert f(x)\vert +c$.
Notice how the derivative cancelled in a very similar way to the example above.  This is simply another application of integration by substitution. See Example 4.

## Integrating curves defined parametrically

We can also consider parametric integration to be another application of integration by substitution. Suppose we are given the parametric equations $x=f(t)$ and $y=g(t)$ (see more on parametric equations). Any integral of the form $\int^{x_2}_{x_1} y\, dx$ can be written in terms of parameter $t$:

1. The integrand is simply $y$ which can be written as $g(t)$.
2. This is not a function of $x$ but we can obtain an expression for $dx$ by differentiating $f(t)$ with respect to $t$, and so $dx=\frac{dx}{dt}\times dt=f'(t)dt$.
3. The $x$-limits can be changed to $t$-limits using the equation $x=f(t)$.
4. The integral is transformed as follows: $\int_{x_1}^{x_2} y\,dx\rightarrow \int^{t_2}_{t_1}y\frac{dx}{dt}dt=\int_{t_1}^{t_2}g(t)f'(t)dt$.

See Example 5.

## Examples of Integration by Substitution

1. Integrate $e^{2x-5}$ by inspection.
2. Integrate $\frac{1}{3-7x}$ using substitution.

Find $\int 4\tan(\theta)\sec^5(\theta)d\theta$.

Find $\int_0^1 2x\sqrt{4-3x}\,dx$.

Find $\int \frac{2\cos(2x)}{\sin(2x)+1}dx$.

The integrand in this integral is of the form $\frac{f'(x)}{f(x)}$ where $f(x)=\sin(2x)+1$. Hence, the integral will be $\ln\vert \sin(2x)+1\vert+c$. We can check this with integration by substitution. Let $u=\sin(2x)+1$, and so $\frac{du}{dx}=2\cos(2x)$. It follows that $dx=\frac{1}{2\cos(2x)}du$ and the integral becomes:

$\begin{array}{l}\int \frac{2\cos(2x)}{\sin(2x)+1}dx&\rightarrow& \int \frac{2\cos(2x)}{u}\times \frac{1}{2\cos(2x)}du\\&=&\int \frac{1}{u}du\\&=&\ln\vert u\vert +c\\&=&\ln\vert \sin(2x)+1\vert +c\end{array}$

Find $\int_0^2 y\, dx$ given the parametric equations $x=2t$ and $y=\frac{3}{2+t}$ for $t\geq 0$.