5.4 Integration by Substitution

The integrals encountered so far—whether indefinite or definite—have been the simplest kind, since the antiderivatives had known formulas. For example, \(\int \cos\,x\;\dx = \sin\,x + C\). What if the integral were \(\int \cos\,2x\;\dx\) instead? No formula has been discussed yet for this integral, and the answer is not \(\sin\,2x + C\), since the derivative of \(\sin\,2x\) is \(2 \cos\,2x\), not \(\cos\,2x\). But dividing \(\sin\,2x\) by 2 first and then taking the derivative would yield \(\cos\,2x\), so that \(\int \cos\,2x\;\dx = \frac{1}{2}\sin\,2x + C\).

Evaluating an integral in such a manner is often done when the function is not too complicated, as the one above. Usually it will not be quite that simple, and so a general technique called substitution is needed. The idea behind substitution is to replace part of the function being integrated by a new variable—typically \(u\)—so that a complicated function of \(x\) is now a simpler function of \(u\) that you know how to integrate.

Example 5.16

Evaluate \(\displaystyle\int\,\cos\,2x~\dx\) by substitution.

Solution: The \(2x\) in the cosine function is what makes this integral unknown, so replace it by \(u\): let \(u = 2x\). The integral is now

\[ \int\,\cos\,u~\dx \]

which is a problem because the point of doing substitution is to eliminate all references to the variable \(x\), including in the infinitesimal \(\dx\). The entire integral needs to be in terms of \(u\) and \(\du\), but the \(\dx\) is still there. So put \(\dx\) in terms of \(\du\):

\[ u ~=~ 2x \quad\Rightarrow\quad \du ~=~ 2 \dx \quad\Rightarrow\quad \dx ~=~ \frac{1}{2} \du \]

The integral now becomes

\[ \int\,\cos\,u~ \left(\frac{1}{2}\du\right) ~=~ \frac{1}{2} \int\,\cos\,u~\du ~=~ \frac{1}{2} \sin\,u ~+~ C \]

by the formula already known, just with the letter \(u\) as the variable instead of \(x\). The original integral was in terms of \(x\), so the final answer—for an indefinite integral—should also be in terms of \(x\). Thus, the final step is to substitute back into the answer what \(u\) equals in terms of \(x\), namely \(2x\):

\[ \int\,\cos\,2x~\dx ~=~ \frac{1}{2} \sin\,u ~+~ C ~=~ \frac{1}{2} \sin\,2x ~+~ C \]

If the procedure in the above example seems similar to making a substitution when using the Chain Rule to take a derivative, that is because it is similar: you are basically doing the same thing only in reverse. Just as for differentiation, it is not always obvious what part of the function is the best candidate for substitution when performing integration. There is one obvious rule: never make the substitution \(u = x\), because that changes nothing.

Example 5.17

Evaluate \(\displaystyle\int\,e^{-3x}~\dx\).

Solution: The \(-3x\) in the exponential function is what makes this integral unknown, so make the substitution \(u = -3x\), which means that \(\du = -3\dx\), and so \(\dx = -\frac{1}{3}\du\). Thus:

\[ \int\,e^{-3x}~\dx ~=~ \int\,e^{u}~\left(-\frac{1}{3}\du\right) ~=~ -\frac{1}{3}\,\int\,e^{u}~\du ~=~ -\frac{1}{3}\,e^u ~+~ C ~=~ -\frac{1}{3}\,e^{-3x} ~+~ C \]

The above example can be generalized as follows:

Theorem 5.16

\[ \int\,e^{ax}~\dx ~=~ \frac{1}{a}\,e^{ax} ~+~ C \quad\text{for any constant $a \ne 0$} \]

Example 5.17 was the special case with \(a = -3\).

Example 5.18

Evaluate \(\displaystyle\int\,(1 + 4x)^5~\dx\).

Solution: You might be tempted to make the substitution \(u = 4x\), but that would then require finding the integral of \((1+u)^5\), for which there is not yet any formula. But there is a formula for the integral of \(u^5\). Hence, let \(u = 1 + 4x\), so that \(\du = 4\dx ~\Rightarrow~ \dx = \frac{1}{4}\du\). Thus:

\[ \int\,(1 + 4x)^5~\dx ~=~ \frac{1}{4}\,\int\,u^5~\du ~=~ \frac{1}{4}\,\frac{u^6}{6} ~+~ C ~=~ \frac{1}{24}\,(1 + 4x)^6 ~+~ C \]

Example 5.19

Evaluate \(\displaystyle\int\,2x\,e^{x^2}~\dx\).

Solution: It might be unclear whether you should make the substitution \(u = 2x\) or \(u = x^2\), but the hint here is that the derivative of the \(x^2\) inside the exponential function is \(2x\), which appears outside the exponential function. Indeed, you could check that letting \(u = 2x\) would result in an integral no simpler than the current one (namely, \(\frac{1}{2}\,\int\,u\,e^{u^2/4}~\du\)). So let \(u = x^2\), which means \(\du = 2x\,\dx\). Thus:

\[ \int\,2x\,e^{x^2}~\dx ~=~ \int\,e^{u}~\du ~=~ e^u ~+~ C ~=~ e^{x^2} ~+~ C \]

Example 5.20

Evaluate \(\displaystyle\int\,x\,\sqrt{1 + 3x^2}~\dx\).

Solution: Note that the derivative of the \(1+3x^2\) term inside the square root function is \(6x\), which is almost the function \(x\) outside the square root—all that is missing is the constant multiple \(6\). That is a hint to let \(u = 1+3x^2\). Notice also that \(\du = 6x\,\dx ~\Rightarrow~ x\,\dx = \frac{1}{6}\du\), and \(x\,\dx\) is the remaining part of the integral outside the square root. Thus:

\[ \int\,x\,\sqrt{1 + 3x^2}~\dx ~=~ \frac{1}{6}\,\int\,\sqrt{u}~\du ~=~ \frac{1}{6}\,\frac{u^{3/2}}{3/2} ~+~ C ~=~ \frac{1}{9}\,(1+3x^2)^{3/2} ~+~ C \]

Example 5.21

Evaluate \(\displaystyle\int\,\dfrac{x^2~\dx}{\sqrt{x^3 + 9}}\).

Solution: Let \(u = x^3 + 9\), so that \(\du = 3x^2\,\dx ~\Rightarrow~ x^2\,\dx = \frac{1}{3}\du\). Thus:

\[ \int\,\dfrac{x^2~\dx}{\sqrt{x^3 + 9}} ~=~ \int\,\dfrac{\frac{1}{3}\,\du}{\sqrt{u}} ~=~ \frac{1}{3}\,\int\,u^{-1/2}~\du ~=~ \frac{1}{3}\,\frac{u^{1/2}}{1/2} ~+~ C ~=~ \frac{2}{3}\,\sqrt{x^3 + 9} ~+~ C \]

Example 5.22

Evaluate \(\displaystyle\int\,\dfrac{2x~\dx}{x^2 - 1}\).

Solution: Notice that the numerator \(2x\) in the function is exactly the derivative of the denominator \(x^2 - 1\). That is a hint to substitute on the denominator so that the integral is the natural logarithm function. Let \(u = x^2 - 1\), so that \(\du = 2x\,\dx\). Thus:

\[ \int\,\dfrac{2x~\dx}{x^2 - 1} ~=~ \int\,\dfrac{\du}{u} ~=~ \ln\,\abs{u} ~+~ C ~=~ \ln\,\abs{x^2 - 1} ~+~ C \]

Example 5.23

Evaluate \(\displaystyle\int\,\tan\,x~\dx\).

Solution: Notice that \(\tan\,x = \frac{\sin\,x}{\cos\,x}\) and that the numerator \(\sin\,x\) is almost the derivative of the denominator \(\cos\,x\); all that is missing is a negative sign. That is a hint to substitute on the denominator: \(u = \cos\,x\), so that \(\du = -\sin\,x\;\dx ~\Rightarrow~ \sin\,x\;\dx = -\du\). Thus:

\begin{align*} \int\,\tan\,x~\dx ~&=~ \int\,\frac{\sin\,x}{\cos\,x}~\dx\\[6pt] &=~ \int\,\frac{-\du}{u} ~=~ -\ln\,\abs{u} ~+~ C ~=~ -\ln\,\abs{\cos\,x} ~+~ C ~=~ \ln\,\abs{\cos\,x}^{-1} ~+~ C ~=~ \ln\,\abs{\sec\,x} ~+~ C \end{align*}

Example 5.24

Evaluate \(\displaystyle\int\,\sec\,x~\dx\).

Solution: Notice that

\[ \int\,\sec\,x~\dx ~=~ \int\,\frac{\sec\,x~(\sec\,x ~+~ \tan\,x)}{\sec\,x ~+~ \tan\,x}~\dx ~=~ \int\,\frac{\sec\,x\;\tan\,x ~+~ \sec^2 x}{\sec\,x ~+~ \tan\,x}~\dx \]

and that the numerator in the last integral is the derivative of the denominator: let \(u = \sec\,x ~+~ \tan\,x\), so that \(\du = (\sec\,x\;\tan\,x ~+~ \sec^2 x)\,\dx\). Thus:

\[ \int\,\sec\,x~\dx ~=~ \int\,\frac{\du}{u} ~=~ \ln\,\abs{u} ~+~ C ~=~ \ln\,\abs{\sec\,x ~+~ \tan\,x} ~+~ C \]

The following formulas are straightforward consequences of substitution and the derivatives of inverse trigonometric functions discussed in Section 2.2:

Theorem 5.17

For any constant \(a > 0\):

\begin{align} \int\,\frac{\dx}{\sqrt{a^2 - x^2}} ~&=~ \sin^{-1}\left(\frac{x}{a}\right) ~+~ C \quad\text{(if $\abs{x} < a$)}\tag{5.3}\\ \int\,\frac{\dx}{a^2 + x^2} ~&=~ \frac{1}{a}\,\tan^{-1}\left(\frac{x}{a}\right) ~+~ C\tag{5.4}\\ \int\,\frac{\dx}{\abs{x}\,\sqrt{x^2 - a^2}} ~&=~ \frac{1}{a}\,\sec^{-1}\left(\frac{x}{a}\right) ~+~ C \quad\text{(if $\abs{x} > a$)} \tag{5.5}\end{align}

For example, to prove the second formula, recall that \(\ddx\left(\tan^{-1}x\right) ~=~ \frac{1}{1 + x^2}\). Make the substitution \(u = x/a\), so that \(x = au\) and \(\dx= a\,\du\). Thus:

\[ \int\,\frac{\dx}{a^2 + x^2} ~=~ \int\,\frac{a\,\du}{a^2 + a^2 u^2} ~=~ \frac{1}{a}\,\int\,\frac{\du}{1 + u^2} ~=~ \frac{1}{a}\,\tan^{-1}u ~+~ C ~=~ \frac{1}{a}\,\tan^{-1}\left(\frac{x}{a}\right) ~+~ C \quad\checkmark \]

Example 5.25

Evaluate \(\displaystyle\int\,\dfrac{\dx}{\sqrt{4 - 9x^2}}\).

Solution: The \(4 - 9x^2\) inside the square root is almost of the form \(a^2 - x^2\), except for the 9. The goal is to have \(u^2 = 9x^2\), so let \(u = 3x\), which means that \(\dx = \frac{1}{3}\,\du\) and \(u^2 = 9x^2\). Thus,

\[ \int\,\dfrac{\dx}{\sqrt{4 - 9x^2}} ~=~ \frac{1}{3}\,\int\,\dfrac{\du}{\sqrt{4 - u^2}} ~=~ \frac{1}{3}\,\sin^{-1}\left(\frac{u}{2}\right) ~+~ C ~=~ \frac{1}{3}\,\sin^{-1}\left(\frac{3x}{2}\right) ~+~ C \]

by Formula (5.2) with \(a = 2\).


To use substitution with definite integrals, follow the same procedure as with indefinite integrals but add one extra step: replace the limits of integration \(x=a\) and \(x=b\) in the original integral \(\int_a^b f(x)\,\dx\) by \(u = g(a)\) and \(u= g(b)\), respectively, in the new integral involving \(u\), where \(u=g(x)\) is your substitution.

Example 5.26

Evaluate \(\displaystyle\int_1^2\,(2x+1)^3~\dx\).

Solution: Let \(u = g(x) = 2x+1\), which means that \(\dx = \frac{1}{2}\,\du\). The upper limit of integration \(x=2\) becomes \(u=g(2)=2(2)+1=5\) in the new \(u\)-based integral, while the lower limit of integration \(x=1\) becomes \(u=g(1)=2(1)+1=3\). Thus:

\[ \int_1^2\,(2x+1)^3~\dx ~=~ \frac{1}{2}\,\int_3^5\,u^3~\du ~=~ \frac{1}{8}\,u^4~\Biggr|_3^{5} ~=~ \frac{1}{8}\,(5^4 - 3^4) ~=~ 68 \]

Note that you could have put everything back in terms of \(x\) at the end, but there was no need to since you would get the same numerical answer.


The following property of definite integrals comes in handy for evaluating certain types of definite integrals:

Theorem 5.18

For any constant \(a\),

\begin{equation} \int_0^a \,f(x)~\dx ~=~ \int_0^a \,f(a-x)~\dx ~. \tag{5.6}\end{equation}

This is simple to prove, using the substitution \(u = a - x\), so \(x = a - u\) and \(\dx = -\du\), while \(x=0\) becomes \(u=a\) and \(x=a\) becomes \(u=0\) in the limits of integration:

\[\int_0^a \,f(x)\;\dx ~=~ -\int_a^0 \,f(a-u)\;\du ~=~ \int_0^a \,f(a-u)\;\du ~=~ \int_0^a \,f(a-x)\;\dx \quad\checkmark\]

Example 5.27

Evaluate \(\displaystyle\int_0^{\pi}\,\dfrac{x\;\sin\,x}{1 + \cos^2 x}~\dx\).

Solution: Let \(I = \displaystyle\int_0^{\pi}\,\dfrac{x\;\sin\,x}{1 + \cos^2 x}~\dx\). Then by the above property (with \(a = \pi\)):

\begin{align*} I ~&=~ \int_0^{\pi}\,\frac{(\pi - x)\;\sin\,(\pi - x)}{1 + \cos^2 (\pi -x)}~\dx ~=~ \int_0^{\pi}\,\frac{(\pi - x)\;\sin\,x}{1 + \cos^2 x}~\dx ~=~ \pi\,\int_0^{\pi}\,\frac{\sin\,x}{1 + \cos^2 x}~\dx ~-~ \int_0^{\pi}\,\dfrac{x\;\sin\,x}{1 + \cos^2 x}~\dx\\[4pt] I ~&=~ \pi\,\int_0^{\pi}\,\frac{\sin\,x}{1 + \cos^2 x}~\dx ~-~ I\\[4pt] 2I ~&=~ \pi\,\int_0^{\pi}\,\frac{\sin\,x}{1 + \cos^2 x}~\dx ~=~ -\pi\,\tan^{-1} (\cos\,x)~\Biggr|_{0}^{\pi} ~=~ -\pi\,\left(-\frac{\pi}{4} - \frac{\pi}{4}\right) ~=~ \frac{\pi^2}{2}\\[4pt] I ~&=~ \frac{\pi^2}{4} \end{align*}

Exercises

A

For Exercises 1-24 evaluate the given integral.

3

  1. \(\displaystyle\int \left(3 \cos\,5x ~+~ 4 \sin\,5x\right)\;\dx \vphantom{\dfrac{e^{2x}}{2}}\)

  2. \(\displaystyle\int \dfrac{e^{2x} ~+~ e^{-2x}}{2}\;\dx\)

  3. \(\displaystyle\int \left(x e^{-x^2} ~+~ x^2 \cos\,x^3\right)\;\dx \vphantom{\dfrac{e^{2x}}{2}}\)

    3

  4. \(\displaystyle\int \dfrac{x ~-~ 2}{x^2 ~-~ 4x ~+~ 9}\;\dx \vphantom{\dfrac{e^{3x}}{e^{3x}}}\)

  5. \(\displaystyle\int \dfrac{e^{x}}{1 ~+~ e^{x}}\;\dx\)

  6. \(\displaystyle\int \dfrac{1}{1 ~+~ e^x}\;\dx \vphantom{\dfrac{e^{3x}}{e^{3x}}}\)

    3

  7. \(\displaystyle\int x\,\sqrt{x+4}\;\dx\)

  8. \(\displaystyle\int \cos^2x\;\dx\)

  9. \(\displaystyle\int \tan^2x\;\dx\)

    3

  10. \(\displaystyle\int \dfrac{3}{\sqrt{4 ~-~ 25x^2}}\;\dx\)

  11. \(\displaystyle\int \dfrac{3}{4 ~+~ 25x^2}\;\dx\)

  12. \(\displaystyle\int \sin^2x\;\cos^3x\;\dx\)

    3

  13. \(\displaystyle\int_{0}^{1}~(2x+1)^3 ~\dx\)

  14. \(\displaystyle\int_{0}^{1}~(2x-1)^3 ~\dx\)

  15. \(\displaystyle\int_{0}^{8}~x\,\sqrt{1+x} ~\dx\)

    3

  16. \(\displaystyle\int_{0}^{\pi/2}~4\,\sin\,(x/2) ~\dx\)

  17. \(\displaystyle\int_{0}^{\pi/4}~4\,\sin\,x~\cos\;x ~\dx\)

  18. \(\displaystyle\int_{0}^{\sqrt{\pi}}~5x\,\cos\,(x^2) ~\dx\)

    3

  19. \(\displaystyle\int_{-2}^{-1}~\dfrac{x}{(x^2 + 2)^3} ~\dx\)

  20. \(\displaystyle\int_{-\ln\;3}^{\ln\;3}~\dfrac{e^x}{e^x + 4} ~\dx\)

  21. \(\displaystyle\int_{1}^{3}~\dfrac{\dx}{\sqrt{x}\;(x+1)}\)

    3

  22. \(\displaystyle\int_{-1}^{1}~\dfrac{x^2 ~\dx}{\sqrt{x^3 + 9}}\)

  23. \(\displaystyle\int_{1}^{2}~\dfrac{\vphantom{x^2}\dx}{x^2 - 6x + 9}\)

  24. \(\displaystyle\int_{-3}^{3}~\dfrac{x^5 ~\dx}{e^{x^2}}\)

  25. Evaluate the indefinite integral

    \[\displaystyle\int \sin\,x \; \cos\,x \;\dx\]

    three different ways:

    1. Use the substitution \(u = \sin\,x\).

    2. Use the substitution \(u = \cos\,x\).

    3. Use the trigonometric identity \(2\sin\,x \; \cos\,x ~=~ \sin\,2x\).

    4. Are the three answers from parts (a)-(c) actually different? Explain.

  26. For all positive constants \(L\), show the following:

    1. \(~\displaystyle\int_{0}^{L}~\left( 1 ~-~ \frac{x}{L} \right)^2 ~\dx ~=~ \frac{L}{3}\)

    2. \(~\displaystyle\int_{-L/2}^{L/2}~\left( \frac{1}{2} ~-~ \frac{x}{L} \right)^2 ~\dx ~=~ \frac{L}{3}\)

    3. \(~\displaystyle\int_{0}^{L}~\left( 1 ~-~ \frac{x}{L} \right)^3 ~\left( \frac{x}{L} \right)^2 ~\dx ~=~ \frac{L}{60}\)

B

  1. Recall from trigonometry that \(~\sin^2 \;x ~=~ \frac{1}{2}\,(1 ~-~ \cos\;2x)~\) for all \(x\).

    1. Use the Fundamental Theorem of Calculus to evaluate \(~\displaystyle\int_{0}^{\pi}~\sin^2\,x~\dx~\).

    2. Approximate the integral from part (a) by dividing the interval \(\ival{0}{\pi}\) into \(n=2\) subintervals of equal length, \(\ival{0}{\pi/2}\) and \(\ival{\pi/2}{\pi}\), and finding the exact value of the sum of the areas of the rectangles whose heights are determined at the right endpoints of the subintervals.

    3. Repeat part (b) with \(n=3\).

    4. Repeat part (b) with \(n=4\).

    5. Repeat part (b) with \(n=6\).

  2. Show that \(\int \csc\,x\;\dx \;=\; -\ln\,\abs{\csc\,x \;+\; \cot\,x} \;+\; C\). (Hint: See Example 5.24.)

C

  1. Use the property \(\int_0^a \,f(x)~\dx ~=~ \int_0^a \,f(a-x)~\dx\) to show that

    \[ \displaystyle\int_0^{\pi/2}\,\dfrac{\sin^2 x}{\sin\,x + \cos\,x}~\dx ~=~ \dfrac{1}{\sqrt{2}}\,\ln\,\left(\sqrt{2} + 1\right)~. \]

    (Hint: Use Exercise 28 and the sine addition formula.)