Skip to main content
Mathematics LibreTexts

5.4: Integration by Substitution

  • Page ID
    139456
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The integrals encountered so far—whether indefinite or definite—have been the simplest kind, since the antiderivatives were given by 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 \(\PageIndex{1}\): subst1

    Add text here.

    Solution

    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 \nonumber \]

    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 \nonumber \]

    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 \nonumber \]

    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 \nonumber \]

    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 \(\PageIndex{1}\): subst2

    Add text here.

    Solution

    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 \nonumber \]

    The above example can be generalized as follows:

    Example

    Example \(\PageIndex{1}\): subst2

    Add text here.

    Solution

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

    Example \(\PageIndex{1}\): subst3

    Add text here.

    Solution

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst4

    Add text here.

    Solution

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst5

    Add text here.

    Solution

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst6

    Add text here.

    Solution

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst7

    Add text here.

    Solution

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst8

    Add text here.

    Solution

    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{aligned} \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{aligned} \nonumber \]

    Example \(\PageIndex{1}\): subst9

    Add text here.

    Solution

    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 \nonumber \]

    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 \nonumber \]

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

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst10

    Add text here.

    Solution

    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 \nonumber \]

    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 \(\PageIndex{1}\): subst11

    Add text here.

    Solution

    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 \nonumber \]

    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:

    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 \nonumber \]

    Example \(\PageIndex{1}\): subst12

    Add text here.

    Solution

    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{aligned} 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{aligned} \nonumber \]

    [sec5dot4]

    For Exercises 1-24 evaluate the given integral.

    3

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

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

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

    3

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

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

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

    3

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

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

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

    3

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

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

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

    3

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

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

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

    3

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

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

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

    3

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

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

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

    3

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

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

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

    Evaluate the indefinite integral

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

    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.

    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}\)

    [[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\).

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

    Example \(\PageIndex{1}\): subst9

    Add text here.

    Solution

    .) [[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)~. \nonumber \]

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


    This page titled 5.4: Integration by Substitution is shared under a GNU General Public License 3.0 license and was authored, remixed, and/or curated by Michael Corral.

    • Was this article helpful?