# Trig Tricks

Trig functions and functions built from trigonometric functions are of tremendous importance as they are used to describe periodic behavior. This document describes several techniques for finding antiderivatives of certain combinations of trigonometric functions. In addition to the basic facts that $\int \sin(x) \, dx = -\cos(x) \: \text{ and } \int \cos(x) \, = \sin(x),$ we’ll see plenty of trig identities and $$u$$-substitution.

## Trig integrals and $$u$$-substitution

Often, $$u$$-substitution can help solve an integral involving sines and cosines. Perhaps the simplest example is

Example: Evaluate $\displaystyle \int\sin(x)\cos(x)\,dx.$

Solution: Let $$u=\sin(x)$$. Then $$du = \cos(x)\,dx$$. Thus $\int \sin(x) \cos(x) \, dx = \int u \, du = \frac{1}{2} u^2 + C = \frac{1}{2} \sin^2(x) + C.\Box$ How easy was that?!

## Integrals of the form $$\int \sin^m x\cos^n x\ dx$$

Now, we’ll generalize that last example and consider integrals of the form $\int \sin^mx\cos^nx\ dx,$ where $$m,n$$ are nonnegative integers. Our strategy for evaluating these integrals is to use the fundamental Pythagorean identity $\cos^2x+\sin^2x=1$ to convert high powers of one trigonometric function into the other, leaving a single sine or cosine term in the integrand. We summarize the general technique as follows:

Technique for integrals involving powers of sine and cosine

Consider $$\int \sin^mx\cos^nx\ dx$$, where $$m,n$$ are nonnegative integers.

1. If $$m$$ is odd, then $$m=2k+1$$ for some integer $$k$$. Rewrite $\sin^mx = \sin^{2k+1}x = \sin^{2k}x\sin x = (\sin^2x)^k\sin x = (1-\cos^2x)^k\sin x.$ Then $\int \sin^mx\cos^nx\ dx = \int (1-\cos^2x)^k\sin x\cos^nx\ dx = -\int (1-u^2)^ku^n\ du,$ where $$u = \cos x$$ and $$du = -\sin x\ dx$$.

2. If $$n$$ is odd, then using substitutions similar to that outlined above we have $\int \sin^mx\cos^nx\ dx = \int u^m(1-u^2)^k\ du,$ where $$u = \sin x$$ and $$du = \cos x\ dx$$.

3. If both $$m$$ and $$n$$ are even, use the power–reducing identities $\cos^2x = \frac{1+\cos (2x)}{2} \quad \text{and}\quad \sin^2x = \frac{1-\cos(2x)}2$ to reduce the degree of the integrand. Expand the result and apply the principles the same principles again.

Example Evaluate $\int\sin^5x\cos^8x\ dx.$ Solution: The power of the sine term is odd, so we rewrite $$\sin^5x$$ as $\sin^5x = \sin^4x\sin x = (\sin^2x)^2\sin x = (1-\cos^2x)^2\sin x.$ Our integral is now $$\int (1-\cos^2x)^2\cos^8x\sin x\ dx$$. Let $$u = \cos x$$, hence $$du = -\sin x\ dx$$. Making the substitution and expanding the integrand gives \begin{aligned} \int (1-\cos^2)^2\cos^8x\sin x\ dx &= -\int (1-u^2)^2u^8\ du \\ & = -\int \big(1-2u^2+u^4\big)u^8\ du \\ &= -\int \big(u^8-2u^{10}+u^{12}\big)\ du.\end{aligned} This final integral is not difficult to evaluate, giving \begin{aligned} -\int \big(u^8-2u^{10}+u^{12}\big)\ du &= -\frac19u^9 + \frac2{11}u^{11} - \frac1{13}u^{13} + C \\ &=-\frac19\cos^9 x + \frac2{11}\cos^{11} x - \frac1{13}\cos^{13} x + C.\Box\end{aligned}

Example: Evaluate $\int\sin^5x\cos^9x\ dx.$

Solution: The powers of both the sine and cosine terms are odd, therefore we can apply our technique to either power. We choose to work with the power of the cosine term since the previous example used the sine term’s power.

We rewrite $$\cos^9x$$ as \begin{aligned} \cos^9 x &= \cos^8x\cos x \\ &= (\cos^2x)^4\cos x \\ &= (1-\sin^2x)^4\cos x \\ &= (1-4\sin^2x+6\sin^4x-4\sin^6x+\sin^8x)\cos x.\end{aligned}

We rewrite the integral as $\int\sin^5x\cos^9x\ dx = \int\sin^5x\big(1-4\sin^2x+6\sin^4x-4\sin^6x+\sin^8x\big)\cos x\ dx.$

Now substitute and integrate, using $$u = \sin x$$ and $$du = \cos x\ dx$$.

$$\int\sin^5x\big(1-4\sin^2x+6\sin^4x-4\sin^6x+\sin^8x\big)\cos x\ dx =$$ -.8 \begin{aligned} \int u^5(1-4u^2+6u^4-4u^6+u^8)\ du &= \int\big(u^5-4u^7+6u^9-4u^{11}+u^{13}\big)\ du \\ &= \frac16u^6-\frac12u^8+\frac35u^{10}-\frac13u^{12}+\frac{1}{14}u^{14}+C\\ &= \frac16\sin^6 x-\frac12\sin^8 x+\frac35\sin^{10} x+\ldots\\ &\phantom{=}-\frac13\sin^{12} x+\frac{1}{14}\sin^{14} x+C.\Box\end{aligned}

## Definite integrals of trig powers

It is often the case that definite integrals involving trig functions are quite easy to compute, if we can use the symmetry involved. The reason that the definite integral of any function of the form $$\cos(mx)$$ or $$\sin(nx)$$ is zero, if we integrate over a full period. In symbols, $\int_a^{a+\pi/m} \cos(mx) \, dx = 0 \: \text{ and } \: \int_a^{a+\pi/n} \sin(nx) \, dx = 0.$ This is illustrated for the sine in figure 1.

The same is true if we raise the sine to an odd power, since that preserves the symmetry, though it does distort the graph. This is illustrated in figure 2.

Of course, the same is true for the cosine, since it’s just a shifted copy of the sine. I wonder what happens if we raise one of these graphs to an *even* power?

Here’s an example where computing the definite integral is much quicker than computing the indefinite integral:

Example: Evaluate $\int_0^{\pi}\cos^4x\sin^2x\ dx.$ Solution: The powers of sine and cosine are both even, so we employ the power–reducing formulas and algebra as follows. \begin{aligned} \int_0^{\pi} \cos^4x\sin^2x\ dx &= \int_0^{\pi}\left(\frac{1+\cos(2x)}{2}\right)^2\left(\frac{1-\cos(2x)}2\right)\ dx \\ &= \int_0^{\pi}\frac{1+2\cos(2x)+\cos^2(2x)}4\cdot\frac{1-\cos(2x)}2\ dx\\ &= \frac{1}{8}\int_0^{\pi} \big(1+\cos(2x)-\cos^2(2x)-\cos^3(2x)\big)\ dx \\ &= \frac{1}{8}\int_0^{\pi} \big(1-\cos^2(2x)\big)\ dx \\ &= \frac{1}{8}\int_0^{\pi} \big(1-\frac{1}{2}(1+\cos(2x))\big)\ dx \\ &= \frac{1}{8}\int_0^{\pi} \big(1-\frac{1}{2}\big)\ dx = \frac{\pi}{16}.\end{aligned}

Note that we’ve used the facts that $\int_0^{\pi} \cos(2x) \, dx = 0 \: \text{ and } \: \int_0^{\pi} \cos^3(2x) \, dx = 0$ to drop to integrals.$$\Box$$

If this seems like a lot, you might examine the computation of the indefinite integral in Apex Calculus. Be sure to hit the "Solution" button to see the nastiness!

## Trigonometric Polynomials and their products

Linear combinations of the functions $$\cos(mx)$$ and $$\sin(nx)$$ that we saw in the last section are called trigonometric polynomials. They are of tremendous importance in applications involving Fourier series including the study of heat transfer and wave propagation. Integrals involving their products arise often in that context - i.e. integrals of the form $\int\sin(mx)\sin(nx)\ dx,\quad \int \cos(mx)\cos(nx)\ dx \quad \text{and}\quad\int \sin(mx)\cos(nx)\ dx.$ These are best approached by first applying the Product to Sum Formulae, namely \begin{aligned} \sin(mx)\sin(nx) &= \frac12\Big[\cos\big((m-n)x\big)-\cos\big((m+n)x\big)\Big] \\ \cos(mx)\cos(nx) &= \frac12\Big[\cos\big((m-n)x\big)+\cos\big((m+n)x\big)\Big] \\ \sin(mx)\cos(nx) &= \frac12\Big[\sin\big((m-n)x\big)+\sin\big((m+n)x\big)\Big]\end{aligned}

Example: Evaluate $$\int\sin(5x)\cos(2x)\ dx$$.

Solution: The application of the formula and subsequent integration are straightforward: \begin{aligned} \int\sin(5x)\cos(2x)\ dx &= \int \frac12\Big[\sin(3x)+\sin(7x)\Big]\ dx \\ &= -\frac16\cos(3x) - \frac1{14}\cos(7x) + C.\Box\end{aligned}

## Exercises

Evaluate the following integrals:

1. $$\displaystyle \int \sin^3 x\cos x\ dx$$

2. $$\displaystyle \int_0^{2\pi} \sin^3 x\cos^2 x\ dx$$

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

4. $$\displaystyle \int \sin(5x)\cos(3x)\ dx$$

5. $$\displaystyle \int_0^{\pi} \sin(3x)\sin(7x)\ dx$$

1.
2.
3.
4.