$$\def\ans#1{\bbox[border:1px solid green,6pt]{#1}}$$

# Trigonometric Integrals

In this section, we'll see how to integrate functions that are the product of multiple trig functions. Again (and I can't believe I keep saying this), remember that we're not going to learn a new method of integration; instead, we'll see how to manipulate these trig functions (using identities) to get them into a form that we can integrate using u-substitution.

To do so, we'll have to start with a refresher on the specific identities that will be useful to us for the problems that we'll do. I should mention here that we're going to focus on two forms: powers of sine and cosine multiplied together, like $\int \sin^3 x \ \cos^4 x \ dx$ and powers of secant and tangent multiplied together, like $\int \sec^2 x \ \tan^2 x \ dx.$ Therefore, the identities that we'll need are the ones that relate $$\sin$$ to $$\cos$$, and $$\sec$$ to $$\tan$$.

Before we do that, though, let's do a simple example that doesn't need the use of any identities; it is a simple u-substitution, but we have to recognize that.

Evaluate $$\displaystyle\int \tan x \ dx$$.

#### Solution

The way to handle this one is to write the tangent as the quotient of the sine and cosine functions.

$\int \tan x \ dx = \int \dfrac{\sin x}{\cos x} \ dx$

Then, letting $$u=\cos x$$ and $$du = -\sin x \ dx$$, \begin{align} &\int \dfrac{\sin x}{\cos x} \ dx = -\int \dfrac{1}{u} \ du = -\ln u + C = \ans{-\ln|\cos x| + C} \end{align}

## Trig Identities

The first identity is the most famous trigonometric identity of all: the Pythagorean identity. $\sin^2 x + \cos^2 x = 1.$ Then, remembering that $$\sec x = 1/\cos x$$ and $$\tan x = \sin x/\cos x$$, we can divide each term in the Pythagorean identity by $$\cos x$$ to get the following identity relating $$\sec$$ to $$\tan$$: $\tan^2 x + 1 = \sec^2 x.$

We also need the half-angle formulas: \begin{align} \sin^2 x &= \dfrac{1}{2} \bigg(1-\cos(2x)\bigg)\\ \\ \cos^2 x &= \dfrac{1}{2} \bigg(1+\cos(2x)\bigg) \end{align}

Finally, to aid in the use of u-substitution, we need to remember a few trig derivatives. At this point, the derivatives of $$\sin$$ and $$\cos$$ should be second nature, but you may have forgotten the derivatives of $$\sec$$ and $$\tan$$: \begin{align} \dfrac{d}{dx} [\tan x] &= \sec^2 x\\ \\ \dfrac{d}{dx} [\sec x] &= \sec x \ \tan x \end{align} These can be derived by rewriting each in terms of sine and cosine, and using the quotient rule (omitted here).

With these four identities and these derivatives, we're ready to tackle some problems.

## Evaluate $$\int \sin^m x \ \cos^n x \ dx$$

Start with a simple example that can be immediately evaluated using u-substitution: $\int (1-\cos^2 x) \ \sin x \ dx.$ If we let $$u=\cos x$$, then $$du = -\sin x \ dx$$, so we can write the integral as $\int -(1-u^2) \ du = \int -1+u^2 \ du = -u+\dfrac{1}{3}u^3 + C = -\cos x + \dfrac{1}{3}\cos^3 x + C.$

Now try this one: $\int \sin^3 x \ dx.$ Notice that if we rearrange the terms in the Pythagorean Identity, we can use the fact that $$\sin^2 x = 1-\cos^2 x$$ to rewrite this integral: $\int \sin^3 x \ dx = \int \sin^2 x \cdot \sin x \ dx = \int (1-\cos^2 x) \ \sin x \ dx$ This, of course, is what we started with in the first example.

Let's do another (similar) example, and then we'll point out the general process for this type of integral.

Evaluate $$\displaystyle\int \sin^2 x \ \cos^3 x \ dx$$.

#### Solution

Let's take a look at the example above and see what we can gather. To do the u-substitution, we needed to have a single $$\sin x$$ to serve as $$du$$. However, for this one, if we split off a single $$\sin$$, there will be a leftover $$\sin$$ that we can't replace using the Pythagorean Indentity. Instead, if we split off a $$\cos$$, there will be a $$\cos^2$$ left in the integral, and we can replace that with $$1-\sin^2 x$$, meaning that everything will be written in terms of $$\sin$$, except for that single $$\cos$$, so we can let $$u=\sin x$$.

$\int \sin^2 x \ \cos^3 x \ dx = \int \sin^2 x \ \cos^2 x \ \cos x \ dx = \int \sin^2 x (1-\sin^2 x) \cos x \ dx$ $u = \sin x \longrightarrow du = \cos x \ dx$ \begin{align} &\int \sin^2 x (1-\sin^2 x) \cos x \ dx\\ &= \int u^2 (1-u^2) \ du = \int u^2 - u^4 \ du\\ &= \dfrac{1}{3}u^3 - \dfrac{1}{5}u^5 + C = \ans{\dfrac{1}{3}\sin^3 x - \dfrac{1}{5}\sin^5 x + C} \end{align}

These two examples illustrate the process: the basic idea is to write the integral so that there is either a single sine or a single cosine, and everything else should be written in terms of the other one. That way, the single sine or cosine can be taken care of by $$du$$.

The key, of course, is splitting the single sine or cosine off from an odd number of them.

### Process: integrating $$\int \sin^m x \ \cos^n x \ dx$$

1. If $$m$$ is odd, split off one $$\sin x$$ and use $$\sin^2 x = 1-\cos^2 x$$ to rewrite everything else in terms of $$\cos x$$. Then let $$u=\cos x$$ and $$du = -\sin x \ dx$$.
2. If $$n$$ is odd, split off one $$\cos x$$ and use $$\cos^2 x = 1-\sin^2 x$$ to rewrite everything else in terms of $$\sin x$$. Then let $$u=\sin x$$ and $$du = \cos x \ dx$$.
3. If both $$m$$ and $$n$$ are even, use the half-angle identities to write the integral in terms of $$\cos kx$$.

## Evaluate $$\int \tan^m x \ \sec^n x \ dx$$

We'll illustrate this with an example, taking a few clues from the earlier examples.

Evaluate $$\displaystyle\int \tan^6 x \ \sec^4 x \ dx$$.

#### Solution

Like we did earlier, we want to split something off that is the derivative of either $$\sec x$$ or $$\tan x$$. For instance, in this case, we'll split off $$\sec^2 x$$, which is the derivative of $$\tan x$$. Therefore, we want everything else to be written in terms of $$\tan x$$. $\int \tan^6 x \ \sec^4 x \ dx = \int \tan^6 x \ \sec^2 x \ \sec^2 x \ dx = \int \tan^6 x \ (\tan^2 x + 1) \ \sec^2 x \ dx$ $u = \tan x \longrightarrow du = \sec^2 x \ dx$ \begin{align} &\int \tan^6 x \ (\tan^2 x + 1) \ \sec^2 x \ dx\\ &= \int u^6(u^2+1) \ du = \int u^8 + u^6 \ du\\ &= \dfrac{1}{9}u^9 + \dfrac{1}{7}u^7 + C = \ans{\dfrac{1}{9}\tan^9 x + \dfrac{1}{7}\tan^7 x + C} \end{align}

### Process: integrating $$\int \tan^m x \ \sec^n x \ dx$$

1. If $$m$$ is odd, split off $$\sec x \ \tan x$$ and use $$\tan^2 x = \sec^2 x - 1$$ to rewrite everything else in terms of $$\sec x$$. Then let $$u=\sec x$$ and $$du = \sec x \ \tan x \ dx$$.
2. If $$n$$ is even, split off $$\sec^2 x$$ and use $$\sec^2 x = \tan^2 x + 1$$ to rewrite everything else in terms of $$\tan x$$. Then let $$u=\tan x$$ and $$du = \sec^2 x \ dx$$.
3. Otherwise, try writing everything in terms of $$\sin$$ and $$\cos$$.

## Examples

Evaluate $$\displaystyle\int \cos^5 (\pi x) \ dx$$.

#### Solution

Split off one cosine, then rewrite everything in terms of sine: \begin{align} &\int \cos^5 (\pi x) \ dx = \int \cos^4 (\pi x) \ \cos (\pi x) \ dx\\ &= \int \cos^2 (\pi x) \ \cos^2 (\pi x) \ \cos (\pi x) \ dx\\ &= \int (1-\sin^2 (\pi x)) (1-\sin^2 (\pi x)) \cos (\pi x) \ dx \end{align}

Then, letting $$u=\sin (\pi x)$$, we find that $$du = \pi \cos (\pi x)$$, so $$1/\pi du = \cos (\pi x)$$. \begin{align} &\int (1-\sin^2 (\pi x)) (1-\sin^2 (\pi x)) \cos (\pi x) \ dx\\ &= \int \dfrac{1}{\pi} (1-u^2)(1-u^2) \ du\\ &= \dfrac{1}{\pi} \int 1-2u^2 + u^4 \ du = \dfrac{1}{\pi}\left(u-\dfrac{2}{3}u^3+\dfrac{1}{5}u^5+C\right)\\ &= \ans{\dfrac{1}{\pi}\sin(\pi x) - \dfrac{2}{3\pi}\sin^3(\pi x) + \dfrac{1}{5\pi}\sin^5 (\pi x) + C} \end{align}

#### Try it yourself:

(click on the problem to show/hide the answer)

$$\displaystyle\int \sin^3 x \ \cos^2 x \ dx$$
$$-\dfrac{1}{3}\cos^3 x + \dfrac{1}{5}\cos^5 x + C$$

Evaluate $$\displaystyle\int \cos^2 x \ dx.$$

#### Solution

Here's an example where we only have even powers, so we have to use a half-angle identity. Remember that $\cos^2 x = \dfrac{1}{2}\bigg(1+\cos(2x)\bigg),$ so we can rewrite the integral as $\int \dfrac{1}{2}\bigg(1+\cos(2x)\bigg) \ dx = \int \dfrac{1}{2} + \dfrac{1}{2}\cos(2x) \ dx.$ Now, to integrate $$\cos (2x)$$, use u-substitution with $$u=2x$$. Notice that, thus, the integral of $$\cos (2x)$$ is $$\sin(2x)/2$$. $\int \dfrac{1}{2} + \dfrac{1}{2}\cos(2x) \ dx = \ans{\dfrac{1}{2}x + \dfrac{1}{4}\sin (2x) + C}$

Evaluate $$\displaystyle\int \sin^2 x \ \cos^2 x \ dx.$$

#### Solution

For this one, use both half-angle identitites. $\int \sin^2 x \ \cos^2 x \ dx = \int \dfrac{1}{2}\bigg(1-\cos(2x)\bigg) \cdot \dfrac{1}{2}\bigg(1+\cos(2x)\bigg) \ dx = \int \dfrac{1}{4}\bigg(1-\cos^2 (2x)\bigg) \ dx$ Notice that we have to use a half-angle identity again: \begin{align} &\int \dfrac{1}{4}-\dfrac{1}{4}\cos^2 (2x) \ dx\\ &= \int \dfrac{1}{4} - \dfrac{1}{4} \cdot \dfrac{1}{2}\bigg(1+\cos (4x)\bigg) \ dx\\ &= \int \dfrac{1}{4} - \dfrac{1}{8} - \dfrac{1}{8}\cos (4x) \ dx\\ &= \ans{\dfrac{1}{8}x - \dfrac{1}{32}\sin (4x) + C} \end{align}

#### Try it yourself:

(click on the problem to show/hide the answer)

$$\displaystyle\int \sin^2 (2\theta) \ d\theta$$
$$\dfrac{1}{2}\theta - \dfrac{1}{8}\sin(4\theta) + C$$

Evaluate $$\displaystyle\int \tan^5 x \ \sec^7 x \ dx.$$

#### Solution

There isn't an even power of secant here, but there is an odd power of tangent, so we'll split off $$\sec x \ \tan x$$ and rewrite everything else in terms of $$\sec x$$: $\int \tan^5 x \ \sec^7 x \ dx = \int \tan^4 x \ \sec^6 x \ \sec x \ \tan x \ dx = \int (\sec^2 x - 1)(\sec^2 x - 1) \sec^6 x \ \sec x \ \tan x \ dx.$ Now, letting $$u=\sec x$$ and $$du = \sec x \ \tan x$$: \begin{align} &\int (\sec^2 x - 1)(\sec^2 x - 1) \sec^6 x \ \sec x \ \tan x \ dx\\ &= \int (u^2-1)(u^2-1) u^6 \ du = \int (u^4-2u^2+1)u^6 \ du\\ &= \int u^{10} -2u^8 + u^6 \ du\\ &= \dfrac{1}{11}u^{11} - \dfrac{2}{9}u^9 + \dfrac{1}{7}u^7 + C\\ \\ &= \ans{\dfrac{1}{11}\sec^{11} x - \dfrac{2}{9}\sec^9 x + \dfrac{1}{7}\sec^7 x + C} \end{align}

#### Try it yourself:

(click on the problem to show/hide the answer)

$$\displaystyle\int \tan^5 x \ \sec^4 x \ dx$$
$$\dfrac{1}{6} an^6 x + \dfrac{1}{8} an^8 x + C$$

Evaluate $$\displaystyle\int \sec^2 x \ \tan x \ dx.$$

Notice that, in this example, we have both an even power of secant and an odd power of tangent, so we can choose either of the two methods for integrating powers of secant and tangent.

#### Solution A

Split off the $$\sec^2 x$$ and let $$u=\tan x$$: $\int \sec^2 x \ \tan x \ dx = \int u \ du = \dfrac{1}{2}u^2 + C = \ans{\dfrac{1}{2}\tan^2 x + C}$

#### Solution B

Split off $$\sec x \ \tan x$$ and let $$u=\sec x$$: $\int \sec^2 x \ \tan x \ dx = \int \sec x \ sec x \ \tan x \ dx = \int u \ du = \dfrac{1}{2}u^2 + C = \ans{\dfrac{1}{2}\sec^2 x + C}$

Notice that we got two different-looking answers, so they must be equal: $\dfrac{1}{2}\tan^2 x + C = \dfrac{1}{2}\sec^2 x + C$ See if you can prove that these two are equal (hint: use an identity listed at the beginning of this section).

Evaluate $$\displaystyle\int \sec^6 t \ dt.$$

#### Solution

Split off $$\sec^2 x$$ and rewrite everything else in terms of $$\tan x$$: $\int \sec^6 t \ dt = \int \sec^2 t \ \sec^2 t \ sec^2 t \ dt = \int (\tan^2 t + 1)(\tan^2 t + 1) \sec^2 t \ dt.$ Then let $$u=\tan t$$ and $$du = \sec^2 t \ dt$$: \begin{align} &\int (\tan^2 t + 1)(\tan^2 t + 1) \sec^2 t \ dt\\ &= \int (u^2+1)(u^2+1) \ du = \int u^4+2u^2+1 \ du\\ &= \dfrac{1}{5}u^5 + \dfrac{2}{3}u^3 + u + C\\ \\ &= \ans{\dfrac{1}{5}\tan^5 t + \dfrac{2}{3}\tan^3 t + \tan t + C} \end{align}