13. Integration Techniques#

13.1. Integration by Substitution#

This is the reverse of the chain rule. It gives us a way of changing the variable in an integral. The theorem itself looks a little confusing, but with some examples its use should become clear.

Theorem 13.1 (Integration by Substitution)

Let \(u=u(x)\) be a function of \(x\). Then we have

\[ \int f(u(x))dx = \int f(u)\frac{dx}{du}du \]

Remarks:

  1. In the above formula, \(f(u)\) is \(f(u(x))\) expressed in terms of \(u\) only, \(\frac{dx}{du}\) is the derivative of \(x\) with respect to~\(u\) and the \(du\) appearing means that the right hand integral is performed with respect to \(u\).

  2. A good way to remember the formula is that we are substituting

    \[ dx=\frac{dx}{du}du \]

    so “the \(du\)’s cancel”.

  3. Substitution works for integrating a function of a function; the chain rule works for differentiating a function of a function. So you can always check your answer by using the chain rule.

  4. Not every integral of a function of a function can be found by using substitution. In fact, there are integrals for which there is no easy way to find the answer. The standard example is \(\displaystyle\int e^{-x^2} dx\). This integral is very important for probability theory (Gauss distribution) and while one can work out \(\displaystyle\int_a^b e^{-x^2}dx\) for any values of \(a\) and \(b\), there is no known function \(f(x)\) with \(f(x) = \int e^{-x^2}dx\).

Let’s look at an example.

Example 13.1

Find \(\displaystyle I = \int (7x +5)^9 dx\).

Solution.
Until now, to do this we would have had to expand out the bracket and work term by term; now we will use integration by substitution.

We note that \((7x+5)^9\) is a function of a function and the inner function is \(u = 7x +5\). Then \(\frac{du}{dx} = 7\) and so \(\frac{dx}{du}=\frac{1}{\frac{du}{dx}}=\frac{1}{7}\). We substitute these into our integral \(I\) to get

\[\begin{align*} I = \int (7x +5)^9 dx &= \int u^9\frac{dx}{du}~du\\ &= \int u^9.\frac{1}{7}~du\\ &= \frac 17 .\frac 1{10} u^{10} + C\\ &= \frac 1{70} u^{10} + C. \end{align*}\]

To finish, we must express the answer in terms of \(x\), so we substitute back to get

\[ I=\frac 1{70} u^{10} + C=\frac 1{70} (7x+5)^{10} + C. \]

If we differentiate \(F(x) = \frac 1{70} (7x+5)^{10} + C\) we use the chain rule and get \(F'(x) = \frac 1{70}\times 7 \times 10(7x+5)^9 = (7x+5)^9\) as required.

Example 13.2

Find \(\displaystyle I = \int x^2 (x^3 + 4)^\frac 53 dx\).

Solution.
Again, we have a function of a function together with a product to integrate, \(f(x) = x^2(x^3 +4)^\frac 53\) where the inner function is \(u = x^3 +4\). Then \(\frac{du}{dx} = 3x^2\) and we see that \(\frac{du}{dx} = 3x^2\) is nearly the other factor in our function \(f(x)\). Now, by the inverse function rule, \(\frac{dx}{du} = \frac{1}{3x^2}\) which cancels the \(x\)’s in the other factor.

Then, using integration by substitution, we get

\[\begin{align*} I =\int x^2 (x^3 + 4)^\frac 53~dx &= \int x^2 u^\frac 53\frac{dx}{du}~du\\ &= \int x^2 u^{\frac 53}\frac{1}{3x^2}~du\\ &= \frac 13 \int u^{\frac 53}~du\\ &= \frac 13 .\frac 38 u^{\frac 83} + C\\ &= \frac 18 (x^3 +4)^\frac 83 + C. \end{align*}\]

(Remember that the answer should always be given in terms of \(x\), not \(u\).)

Again, differentiating \(F(x)= \frac 18 (x^3 +4)^\frac 83 + C\) using the chain rule gives \(F'(x) = \frac 18 \times 3x^2 \times \frac 83(x^3+4)^\frac 53 = f(x)\).

Example 13.3

Find \(I = \displaystyle \int \sin x \sqrt{\cos x} dx\).

Solution.
The function of a function is the \(\sqrt{\cos x}\) factor so we let \(u = \cos x\) which gives \(\frac{du}{dx} = -\sin x\) and thus \(\frac{dx}{du} = - \frac{1}{\sin x}\). Then, using integration by substitution we get

\[\begin{align*} I = \displaystyle \int \sin x \sqrt{\cos x} dx &= \int \sin x \sqrt{~u~}.\frac{-1}{\sin x}~du\\ &= - \int \sqrt{~u~} du\\ &= - \int u^{\frac 12} du\\ &= -\frac 23 u^{\frac 32} + C\\ &= - \frac 23 (\cos x)^\frac 32 + C. \end{align*}\]

13.2. Definite Integrals and Substitution#

Care must be taken when using integration by substitution with definite integrals: the limits must be changed. When we have definite integral, convention allows us to write \(\displaystyle \int_a^b f(x)dx\) for \(\displaystyle\int_{x=a}^{x=b} f(x)dx\). This cuts down on writing. We illustrate how to deal with the limits with some examples.

Example 13.4

Find \(\displaystyle I = \int _0^1 \frac 1{(1+2x)^3} dx\).

Solution.
Let \(u = 1+ 2x\) so that \(\frac{du}{dx} = 2\) and \(\frac{dx}{du} = \frac{1}{2}\). But when we change the ‘\(dx\)’ of the integral into the ‘\(du\)’, our limits needs to change from \(x\)-limits into \(u\)-limits. So the next step is to calculate the new limits in terms of \(u\).

Now, when \(x=0\) (the lower limit) we have \(u =1+2\times0=1\). Similarly, when \(x=1\) we have \(u =1+2\times1=3\). Thus, after substituting for \(u\) are integral is between \(u=1\) and \(u=3\). We get

\[\begin{align*} I=\int _0^1 \frac 1{(1+2x)^3} dx &= \int_1^3 \frac{1}{u^3} .\frac{1}{2}~du\\ && \mbox{the '$dx$' changes to '$du$' and so do the limits}\\ &= \frac{1}{2} \int_1^3 u^{-3}~du\\ &= \frac 12 \left[- \frac 12 u^{-2}\right]_1^3\\ &= \frac 12 \left(-\frac{1}{2}(3^{-2}) - (-\frac{1}{2}(1^{-2}))\right)\\ &= - \frac 14 \left(\frac 19 - 1\right)\\ &= - \frac 14 \left(- \frac 89\right)\\ &= \frac 29. \end{align*}\]

Remark: When calculating a definite integral it is not necessary to substitute back to get things in terms of \(x\) — changing the limits has already taken this into account.

Example 13.5

Find \(\displaystyle I = \int_0^{\frac \pi 2} \cos x \sec^2(\sin x)dx\).

Solution.
Let \(u = \sin x\) so that \(\frac{du}{dx} = \cos x\) and so \(\frac{dx}{du} = \frac{1}{\cos x}\). For the limits, if \(x = 0\) then \(u = \sin 0 = 0\) and if \(x = \frac \pi 2\) then \(u=\sin (\frac{\pi}{2}) = 1\). Thus

\[\begin{align*} I=\int_0^{\frac \pi 2} \cos x \sec^2(\sin x)dx &= \int_0^1 \cos x \sec^2(u).\frac{1}{\cos x}~du\\ &= \int_0^1 \sec^2(u) du\\ &= \left[ \tan u \right]_0^1\\ &= \tan 1 -\tan 0\\ &= \tan 1. \end{align*}\]

13.3. Integration using Partial Fractions#

13.3.1. Important Examples#

Partial fractions are a very practical tool to find integrals where the function to integrate is a quotient of two polynomials.

Recall that we have three types of possible terms:

\[ \frac{A}{ax+b}, \hspace{3em} \frac{A}{(ax+b)^n}, \hspace{2em} \text{ and } \hspace{2em} \frac{Ax+B}{ax^2+bx+ C}, \]

where \(ax^2+bx+ C\) is a quadratic which doesn’t factorise. Here are examples of integrals of these types. They are dealt with by substitution.

Example 13.6

Find \(\displaystyle I = \int \frac 1{2x+3}dx\).

Solution.
Let \(u = 2x +1\) so that \(\frac{du}{dx} = 2\) and \(\frac{dx}{du} = \frac{1}{2}\). Thus

\[\begin{align*} I =\int \frac 1{2x+3}dx &= \int \frac{1}{u}.\frac{1}2~du\\ &= \frac 12 \int u^{-1} du\\ &= \frac 12 \ln |u| + C\\ &= \frac 12 \ln|2x+3| + C. \end{align*}\]

Example 13.7

Find \(\displaystyle \int \frac 3{(2x-5)^6}dx\).

Solution.
Let \(u = 2x-5\) so that \(\frac{du}{dx} = 2\) and \(\frac {dx}{du} = \frac 12\). The

\[\begin{align*} \int \frac 3{(2x-5)^6} dx &= \frac 32 \int u^{-6} du\\ &= \frac 32\left(\frac{1}{-5}\right)u^{-5} + C\\ &= - \frac{3}{10}(2x-5)^{-5} + C. \end{align*}\]

Example 13.8

Find \(\displaystyle I = \int \frac{4x + 5}{x^2+1} dx\).

Solution.
We note that we can write

\[ I = \int \left(\frac{4x}{x^2 +1}+\frac{5}{x^2+1}\right)~dx=\int \frac{4x}{x^2 +1}~dx + \int \frac{5}{x^2+1}~dx \]

and solve each of the integrals separately.

Let \(\displaystyle I_1 = \int \frac {4x}{x^2 +1} dx\). To evaluate this, we use substitution where \(u = x^2 +1\) to get \(\frac{du}{dx} = 2x\) so that \(\frac{dx}{du} =\frac{1}{2x}\). Then

\[\begin{align*} I_1 =\int \frac {4x}{x^2 +1} dx &= \int \frac{4x}{u}.\frac{1}{2x}~du\\ &= 2 \int u^{-1} du\\ &= 2 \ln |u|+ C_1\\ &= 2 \ln |x^2 + 1| + C_1\\ \end{align*}\]

Note that since \(x^2 + 1 \geq 1\) for all \(x\in \mathbb{R}\) we have \(\ln |x^2+1|=\ln (x^2+1)\) so that we can write \(I_1\) more simply as

\[ \displaystyle I_1=2 \ln (x^2 + 1) + C. \]

For the second integral, write \(I_2=\int \frac{5}{x^2+1}~dx\) and recall that \(\displaystyle\int \frac 1{1+x^2} dx = \tan^{-1} x + C\) is a standard integral. So we get

\[\begin{align*} I_2 =\int \frac{5}{x^2+1}~dx&= 5 \int \frac 1{x^2+1}~dx=5 \tan^{-1} x + C_2. \end{align*}\]

Thus

\[ I = I_1 + I_2 = 2 \ln (x^2+1) + 5 \tan^{-1} x + C, \]

where \(c=c_1+ C_2\).

13.3.2. Integration using Partial Fractions#

Now we deal with general integrals where the function to integrate is the quotient of two polynomials. Note that sometimes you can just use substitution for these, but partial fractions always works.

Example 13.9

Find \(\displaystyle I = \int \frac{4x + 5}{(x-1)(2x+3)} dx\).

Solution.
I first check if I can do substitution: The denominator is \(2x^2 -x -3\) and the derivative of this is not a multiple of the numerator, so substitution will not work here.

We simplify \(I\) by expressing \(\frac{4x + 5}{(x-1)(2x+3)}\) in partial fractions.

Noting that the fraction is bottom heavy, we write

\[ \frac{4x + 5}{(x-1)(2x+3)} = \frac A{x-1} + \frac B{2x+3} \]

for some real numbers \(A\) and \(B\). Multiplying through we get

\[ 4x + 5 = A(2x+3) + B(x-1). \]

Putting \(x = 1\) gives \( 9 = 5A\) so that \(\displaystyle A = \frac 95\).

Putting \(\displaystyle x = -\frac 32\) gives \(\displaystyle -1 = -\frac 52 B\) so that \(\displaystyle B = \frac {2}{5}\).

Thus we have

\[ \frac{4x + 5}{(x-1)(2x+3)} = \frac {9}{5(x-1)} + \frac 2{5(2x+3)} \]

and hence

\[\begin{align*} I &= \int \left(\frac {9}{5(x-1)} + \frac 2{5(2x+3)}\right)~dx\\ &= \frac 95 \int \frac{1}{x-1}~dx + \frac 25 \int \frac{1}{2x+3} dx. \end{align*}\]

Let \(\displaystyle I_1=\frac 95 \int \frac{1}{x-1} dx\) and \(\displaystyle I_2=\frac 25 \int \frac{1}{2x+3} dx\). We have seen integrals like these before and have used integration by substitution to solve them. To evaluate \(I_1\) let \(u = x-1\). Then \(\frac{du}{dx} = 1\) so that \(\frac{dx}{du}=1\). Thus

\[\begin{align*} I_1 &= \frac 95 \int \frac{1}{x-1} dx\\ &= \frac 95 \int \frac{1}{u}.\frac{dx}{du}du\\ &= \frac 95 \int \frac{1}{u}du\\ &= \frac 95 \ln|u|+ C_1\\ &= \frac 95 \ln|x-1| + C_1. \end{align*}\]

To evaluate \(I_2\) let \(u = 2x+3\). Then \(\frac{du}{dx} = 2\) so that \(\frac{dx}{du} = \frac{1}{2}\). Thus

\[\begin{align*} I_2 &= \frac 25 \int \frac{1}{2x+3} dx\\ &= \frac 25 \int \frac{1}{u}.\frac{dx}{du}du\\ &= \frac 25 \int \frac{1}{u}.\frac{1}{2}du\\ &= \frac 15 \ln|u| + C_2\\ &= \frac 15 \ln|2x+3| + C_2. \end{align*}\]

Hence, putting these together, we get

\[ I = I_1+I_2 = \frac 95 \ln |x+1| + \frac 15 \ln|2x+3| + C \]

where \(c=c_1+ C_2\).

Example 13.10

Find \(\displaystyle I = \int \frac{x^2 + x - 7}{(x^2+1)(x-3)} dx\).

Solution.
The denominator is \(x^3 -3x^2 +x -3\) and its derivative is not a multiple of the numerator, so we need partial fractions.

Noting that the fraction is bottom heavy and that \(x^2+1\) doesn’t factorise (over the real numbers), we write

\[ \frac{x^2 + x -7}{(x^2+1)(x-3)} = \frac{Ax + B}{x^2+1} + \frac C{x-3} \]

so that

\[ x^2 + x-7 =(Ax + B)(x-3) + C(x^2+1). \]

Putting \(x = 3\) gives \(5 = 10 C\) so that \(C = \frac 1{2}\).

Comparing coefficients of \(x^2\) gives us that \( 1 = A + C\) so that \(A = \frac 12\).

Looking at the constant terms gives \(-7 = -3B + C\) so that \(B = (7+ \frac 12 )/3 = \frac{15}{6} = \frac 52\).

Thus

\[\begin{align*} \frac{x^2 + x -7}{(x^2+1)(x-3)} &= \frac {\frac12 x + \frac 52}{x^2+1} + \frac {\frac 12}{x-3}\\ &= \frac{x+5}{2(x^2+1)} + \frac 1{2(x-3)}. \end{align*}\]

Hence

\[\begin{align*} I &= \int \left(\frac{x+5}{2(x^2+1)} + \frac 1{2(x-3)}\right)dx\\ &= \underbrace{\frac 12 \int \frac{x}{x^2+1}dx}_{I_1} + \underbrace{\frac 52 \int \frac {1}{x^2+1}dx}_{I_2} + \underbrace{\frac 12\int \frac 1{x-3}dx}_{I_3}. \end{align*}\]

Let \(I_1, I_2\) and \(I_3\) be as shown. For \(I_1\), let \(u = x^2 + 1\) so that \(\frac{du}{dx} = 2x\) and \(\frac{dx}{du} = \frac{1}{2x}\). Then

\[\begin{align*} I_1 = uv - \int \frac{du}{dx} v~dx &= \frac 12 \int \frac{x}{u}.\frac{dx}{du}~du\\ &= \frac 12 \int \frac{x}{u}.\frac{1}{2x}~du\\ &=\frac 14 \int \frac{1}{u}~du\\ &=\frac 14 \ln|u| + C\\ &=\frac 14 \ln (x^2 +1) + C \end{align*}\]

as \(x^2+1 > 0\) for all \(x \in \mathbb{R}\).

We can evaluate \(I_2\) as a standard integral without the need for a substitution.

\[ I_2 = \frac 52 \int \frac{1}{x^2 +1}dx = \frac 52 \tan^{-1}x + c. \]

For \(I_3\), let \(u = x-3\) so that \(\frac{du}{dx} = 1\) and \(\frac{dx}{du} = 1\). Then

\[\begin{align*} I_3 &= \frac 12 \int \frac{1}{u}.\frac{dx}{du}~du\\ &= \frac 12 \int \frac{1}{u}~du\\ &= \frac 12 \ln|u| + C\\ &= \frac 12 \ln|x-3| + C. \end{align*}\]

Putting these together we get

\[ I = I_1 + I_2 + I_ 3 = \frac 14 \ln (x^2 +1) + \frac 52 \tan^{-1}x + \frac 12 \ln|x-3| + C \]

since \(x^2+1>0\) for all \(x\in \mathbb{R}\).

13.4. Integration by Parts#

Integration by parts is essentially the reverse of the product rule for differentiation. Recall that the product rule says

\[ \frac{d}{dx}(uv) = v\frac{du}{dx} + u\frac{dv}{dx}. \]

If we integrate this equation we get

\[ \displaystyle\int \frac{d}{dx}(uv)~dx = \int \left(v\frac{du}{dx} + u \frac{dv}{dx}\right)dx \]

and so, remembering that integration is the reverse to differentiation, we have

\[ uv =\int v\frac{du}{dx}~dx + \int u \frac{dv}{dx}dx. \]

Rearranging this gives us the equation

\[ \displaystyle\int u \frac{dv}{dx} dx = uv -\int \frac{du}{dx} v dx. \]

This is a useful result, as we will see later on. It is referred to as “integration by parts”.

Theorem 13.2 (Integration by Parts)

Let \(u\) and \(v\) be functions of \(x\). Then

\[ \int u \frac{dv}{dx} dx = uv - \int\frac{du}{dx}vdx. \]

or, in another notation

\[ \int uv' dx = uv - \int u'v dx. \]

We illustrate how to use this result with an example.

Example 13.11

Find \(\displaystyle \int x \sin x dx\).

Solution.
We use integration by parts, letting \(u = x\) and \(\frac{dv}{dx} =\sin x\). Then \(\frac{du}{dx} = 1\) and to find \(v\) we integrate:

\[ v = \int \sin xdx=-\cos x. \]

(Note that any function which differentiates to give \(\sin x\) works for \(v\), so we can omit the constant). Using the integration by parts formula gives

\[\begin{align*} \int x \sin x dx &= uv - \int \frac{du}{dx} v dx\\ &= x\cdot(-\cos x) - \int 1\cdot(-\cos x) dx\\ &= -x\cos x + \int \cos x dx\\ &= -x\cos x + \sin x + C\\ &= \sin x - x\cos x + C. \end{align*}\]

Note that we can check our answer by differentiating:

\[ \frac{d}{dx}(\sin x - x\cos x + C)= \cos x -(1.\cos x + x\cdot(-\sin x)) = x\sin x, \]

as expected.

Remark 13.1

When using integration by parts to integrate something of the form \(\displaystyle \int x^n f(x) dx\) (where \(n\) is a positive integer) we normally let \(u = x^n\) and \(\frac{dv}{dx}=f(x)\). This ensures that the integral gets simpler to evaluate. One exception is if \(\ln x\) is involved, as we will see later.

Example 13.12

Find \(I = \displaystyle \int x e^x dx\).

Solution.
We use integration by parts with \(u = x\) and \(\frac{dv}{dx} = e^x\). Then \(\frac{du}{dx} = 1\) and \(v = e^x\). Thus

\[\begin{align*} I=uv - \int \frac{du}{dx} v~dx &= xe^x - \int 1.e^x dx\\ &= xe^x - e^x + C\\ &= e^x(x-1) + C. \end{align*}\]

Again, we can check the answer by differentiating:

\[ \frac{d}{dx}(e^x(x-1)) = (x-1)e^x + e^x.1 = xe^x, \]

as expected.

Sometimes it is necessary to use integration by parts more than once. The following is one such example.

Example 13.13

Find \(\displaystyle I = \int x^2 \sin x dx\).

Solution.
We integrate by parts letting \(u = x^2\) and \(\frac{dv}{dx} = \sin x\) so that \(\frac{du}{dx} = 2x\) and \(v = - \cos x\). Then

\[\begin{align*} I = uv - \int \frac{du}{dx} v~dx &= x^2(-\cos x) - \int 2x(-\cos x) dx\\ &= -x^2 \cos x +2 \int x\cos x dx. \end{align*}\]

We now have to find \(\displaystyle \int x\cos x dx\), which we do using integration by parts. Put \(u=x\) and \(\frac{dv}{dx}=\cos x\). Then \(\frac{du}{dx}=1\) and \(v=\sin x\) and we get

\[\begin{align*} \int x\cos x dx = uv - \int v\frac{du}{dx}~dx &= x\sin x - \int 1.\sin x~dx\\ &= x\sin x - (-\cos x) + C\\ &= x\sin x+\cos x + C. \end{align*}\]

Hence

\[\begin{align*} I &= -x^2 \cos x +2 \int x\cos x dx\\ &= -x^2\cos x + 2(x\sin x +\cos x + C)\\ &= 2\cos x + 2x\sin x - x^2\cos x + C', \end{align*}\]

where \(c'=2c\).

Once again, we can check the answer using differentiation; this is left as an exercise.

We are yet to use integration by parts to solve definite integrals.

Example 13.14

Find \(\displaystyle I = \int_1^2 x^2 e^x dx\).

Solution.
Note that this is a definite integral. When evaluating definite integrals using integration by parts it is necessary to put limits on each term in the answer, as demonstrated below.

Let \(u = x^2\) and \(\frac{dv}{dx} = e^x\). Then \(\frac{du}{dx} = 2x\) and \(v = e^x\). Thus, using integration by parts and the result from earlier that \(\displaystyle \int xe^x dx =e^x(x-1) + C\), we get

\[\begin{align*} I = \int_1^2 x^2 e^x dx &= [uv]_1^2-\int_1^2 \frac{du}{dx} v~dx\\ &= \left[ x^2 e^x\right]_1^2 - \int_1^2 2x.e^xdx\\ &= (4e^2 - e) - \left[ 2e^x(x-1) \right]_1^2\\ &= 4e^2 - e -2\left(e^2\times 1 - e\times 0\right)\\ &= 4e^2 - e - 2e^2\\ &= 2e^2 - e. \end{align*}\]

Sometimes there is only one option for \(u\) and \(v\) available, namely when we don’t know how to integrate one of the factors in the product.

Example 13.15

Find \(\displaystyle I = \int x \ln x dx\).

Solution.
As we do not know how to integrate \(\ln x\) at the moment, we will have to choose \(u = \ln x\) and \(\frac{dv}{dx} = x\) for integration by parts. Then \(\frac{du}{dx} = \frac 1x\) and \(v = \frac 12 x^2\) and so

\[\begin{align*} I = \int x \ln x dx &= uv - \int \frac{du}{dx} v~dx\\ &= \ln x.\frac 12 x^2 - \int \frac 1x.\frac 12 x^2 dx\\ &= \frac 12 x^2\ln x - \frac 12 \int x dx\\ &= \frac 12 x^2\ln x - \frac 14 x^2 + C. \end{align*}\]

Differentiating to check:

\[ \frac{d}{dx}\left(\frac 12 x^2\ln x - \frac 14 x^2 + C\right) = \frac 12\left(2x \ln x + x^2 \frac 1x\right) - \frac 12 x = x\ln x + \frac 12 x - \frac 12 x = x\ln x, \]

as expected.

13.5. Tricks using Integration by Parts#

There are a couple of tricks using integration by parts that can help with otherwise difficult integrals. The first trick is to create a product out of something that doesn’t look like one at first glance.

Example 13.16

Find \(\displaystyle I = \int \ln x dx\).

Solution.
The trick here is to write \(\ln x=1.\ln x\). Then we can put \(u=\ln x\) and \(\frac{dv}{dx}=1\) and use integration by parts. We have \(\frac{du}{dx}=\frac{1}{x}\) and \(v=x\) so our formula gives

\[\begin{align*} I = \int 1.\ln x dx &= x \ln x - \int \frac 1x.x dx\\ &= x\ln x - \int 1 dx\\ &= x\ln x - x + C. \end{align*}\]

Differentiating to check:

\[ \frac{d}{dx}\left(x\ln x - x + C\right)=1.\ln x + x.\frac{1}{x} - 1 = \ln x, \]

as expected.

Example 13.17

Find \(\displaystyle I = \int \sin^{-1} x dx\).

Solution.
We know how to differentiate \(\sin^{-1} x\) so we try the same trick by setting \(u = \sin^{-1} x\) and \(\frac{dy}{dx} = 1\). Then \(\frac{du}{dx} = \frac{1}{\sqrt{1-x^2}}\) and \(v = x\). Thus using integration by parts gives

\[\begin{align*} I = \int 1.\sin^{-1} x~dx &= x\sin^{-1} x - \int \frac 1{\sqrt{1-x^2}}. x~dx\\ &= x \sin^{-1} x - \int x(1-x^2)^{-\frac 12} dx. \end{align*}\]

Now, we can solve \(\displaystyle \int x (1-x^2)^{-\frac 12}\) by substitution. Indeed, let \(u = 1-x^2\). Then \(\frac{du}{dx} = -2x\) so that \(\frac{dx}{du}=-\frac{1}{2x}\). Hence

\[\begin{align*} \int x(1-x^2)^{-\frac 12} dx &= \int x u^{-\frac{1}{2}}.\frac {dx}{du}~du\\ &= \int x u^{-\frac{1}{2}}.\frac {-1}{2x}~du\\ &= - \frac 12 \int u^{-\frac 12} du\\ &= - u^{\frac{1}{2}}+ C\\ &= - (1-x^2)^\frac 12+ C. \end{align*}\]

Thus we get

\[ I = x \sin^{-1} x - \int x(1-x^2)^{-\frac 12} dx = x\sin^{-1} x + (1-x^2)^\frac 12+ C. \]

That is, \(\displaystyle \int \sin^{-1} x dx = x\sin^{-1} x + (1-x^2)^\frac 12+ C\).

Checking the answer by differentiating:

\[ \frac{d}{dx}\left(x\sin^{-1} x + (1-x^2)^\frac 12+ C\right) = 1.\sin^{-1} x + x. \frac{1}{\sqrt{1-x^2}} + \frac 12 \frac{-2x}{\sqrt{1-x^2}} = \sin^{-1} x. \]

Another helpful trick is to use integration by parts a couple of times to end up with our original integral. This often occurs when a trigonometric functions, such as \(\sin x\) or \(\cos x\), is coupled with \(e^x\). Here’s a typical example.

Example 13.18

Find \(\displaystyle I= \int e^x \sin x dx\).

Solution.
We use integration by parts with \(u = e^x\) and \(\frac{dv}{dx} = \sin x\). Then \(\frac{du}{dx} = e^x\) and \(v = -\cos x\). Hence

\[\begin{align*} I= uv-\int \frac{du}{dx} v~dx &= e^x\cdot(-\cos x) - \int e^x\cdot(-\cos x) dx\\ &=-e^x\cos x + \int e^x\cos xdx. \end{align*}\]

We now have to integrate \(\displaystyle \int e^x\cos x dx\), which will again require integration by parts. Let \(u = e^x\) and \(\frac{dv}{dx} = \cos x\) so that \(\frac{du}{dx} = e^x\) and \(v = \sin x\). Then

\[ \int e^x \cos x dx = e^x\sin x - \int e^x \sin x dx. \]

Thus

\[\begin{align*} I &= -e^x\cos x + \int e^x\cos x~dx\\ &= -e^x \cos x + e^x \sin x - \int e^x \sin x dx \end{align*}\]

But \(\displaystyle \int e^x \sin x dx = I\) so that

\[ I= -e^x \cos x + e^x \sin x - I \]

and hence

\[ 2I = e^x(\sin x - \cos x)+ C. \]

(Note that we have introduced a constant of integration at this stage as \(I\) is an indefinite integral and so requires one.)

This gives us our result:

\[ \int e^x \sin x dx = \frac 12 e^x(\sin x - \cos x) + C. \]

Note

If you got at the end to \(0 = 0\) you choose in the second integration by parts \(u\) and \(v\) so that they counter exactly the bit you did in the first part!

13.6. Trigonometric Powers#

We have two ‘types’ of trigonometric powers, odd and even.

We first consider the odd powers. Odd powers work by splitting one power off, using \(\sin^2 x + \cos^2 x =1\) and substitution.

Here are two examples.

Example 13.19

Find \(\displaystyle I = \int \sin^3 x dx\).

Solution.
With an odd power we take out a factor of \(\sin x\) and write \(\sin^3 x = \sin^2 x(\sin x) = (1-\cos^2x)(\sin x)\). Thus we get

\[ I = \int (1-\cos^2 x)(\sin x)~dx. \]

We integrate this with the substitution \(u= \cos x\). Then \(\frac{du}{dx} = -\sin x\) so that \(\frac{dx}{du} = -\frac{1}{\sin x}\) and

\[\begin{align*} I = \int (1-\cos^2 x)(\sin x) dx &= \int (1-u^2)\sin x\frac{dx}{du}~du\\ &= \int (1-u^2)\sin x\frac{-1}{\sin x}~du\\ &= - \int (1-u^2) du\\ &= -u + \frac 13 u^3 + C\\ &= -\cos x + \frac 13 \cos^3 x + C. \end{align*}\]

Example 13.20

Find \(\displaystyle I = \int \cos^5 x dx\).

Solution.
We approach this similarly to the above, taking out a factor of \(\cos x\) to get

\[\begin{align*} I &= \int (\cos^4 x)\cos x dx\\ &= \int (\cos^2 x)^2 \cos xdx\\ &= \int (1-\sin^2 x)^2 \cos xdx. \end{align*}\]

We let \(u = \sin x\) so that \(\frac{du}{dx} = \cos x\) and \(\frac{dx}{du} = \frac{1}{\cos x}\). Hence

\[\begin{align*} I&= \int (1-u^2)^2 \cos x \frac{dx}{du}~du\\ &= \int (1-2u^2 +u^4)\cos x\frac{1}{\cos x}~du\\ &= \int (1-2u^2 +u^4)~du\\ &= u - \frac 23 u^3 + \frac 15 u^5 + C\\ &= \sin x - \frac 23 \sin^3 x + \frac 15 \sin^5 x + C. \end{align*}\]

This looks a little surprising. We’ll differentiate the right-hand side to check:\

\[\begin{align*} \frac{d}{dx}\left(\sin x - \frac 23 \sin^3 x + \frac 15 \sin^5 x + C\right) &= \cos x - \frac 23 (3\sin^2 x)\cos x + \frac 15(5\sin^4 x)\cos x\\ &= \cos x(1- 2\sin^2 x + \sin^4 x)\\ &= \cos x(1-\sin^2 x)^2\\ &= \cos x(\cos^2 x)^2\\ &= \cos^5 x, \end{align*}\]

as hoped.

For the even powers, we need the double angle formula for \(\cos x\):

\[ \cos (2x) = \cos^2 x - \sin^2 x. \]

Example 13.21

Find (i) \(\displaystyle \int \sin^2 x dx\) and (ii) \(\displaystyle \int \cos^2 x dx\).

Solution.
(i) We are looking at \(\displaystyle \int \sin^2 xdx\). Now, the equation \(\sin^2x + \cos^2 x=1\) rearranges to give

\[ \sin^2 x = 1-\cos^2 x. \]

But from \(\cos^2 x -\sin^2 x = \cos(2x)\) we get \(\cos^2 x=\cos(2x)+\sin^2 x\) and substituting this gives

\[ \sin^2 x=1-(\cos(2x)+\sin^2 x). \]

Hence \(2\sin^2 x = 1-\cos(2x)\) and so

\[ \sin^2 x = \frac{1}2 (1-\cos (2x)). \]

Putting this into our integral gives

\[\begin{align*} \int \sin^2 x dx &= \int \frac 12 (1-\cos (2x))dx\\ &= \frac{1}{2} \int 1dx - \frac 12 \int \cos (2x)dx\\ &= \frac{1}{2} x - \frac 12 \int \cos (u).\frac{1}{2}~du\quad\mbox{(putting $u=2x$, so $\frac{dx}{du}=\frac{1}{2}$)}\\ &= \frac{1}{2} x - \frac 14 \sin(u)+ C\\ &= \frac{1}{2} x - \frac 14 \sin(2x)+ C. \end{align*}\]

(ii) We employ a similar method as above. From \(\cos^2 x - \sin^2 x = \cos(2x)\) we get

\[ \cos^2 x = \cos(2x)+ \sin^2 x. \]

But \(\sin^2 x + \cos^2 x = 1\) so we get \(\sin^2 x = 1 - \cos^2 x\) and hence

\[ \cos^2 x = \cos(2x)+ (1 - \cos^2 x). \]

Rearranging gives \(2\cos^2 x = \cos(2x)+1\) and we arrive at

\[ \cos^2 x = \frac12(\cos (2x)+1). \]

Thus, putting this into our integral,

\[\begin{align*} \int \cos^2 x dx &= \int \frac 12(\cos (2x) + 1) dx\\ &= \frac 12 \int \cos(2x) dx + \frac 12 \int dx\\ &= \frac 14 \sin(2x) + \frac 12 x + C\quad\mbox{(using $u=2x$, or by inspection).}\\ \end{align*}\]

As an aside, note that our results above give

\[ \int \sin^2 dx + \int \cos^2dx= \frac{1}{2} x - \frac 14 \sin(2x)+ \frac 14 \sin(2x) + \frac 12 x + C = x+ C \]

for some constant \(c\). This is a sign that we’ve calculated them correctly, because the identity \(\sin^2 x + \cos^2 x=1\) gives

\[ \int \sin^2 dx + \int \cos^2dx = \int (\sin^2 x + \cos^2 x) dx = \int 1dx = x+ C. \]