Calculus/Integration techniques/Trigonometric Integrals

When the integrand is primarily or exclusively based on trigonometric functions, the following techniques are useful.

Powers of Sine and Cosine
We will give a general method to solve generally integrands of the form $$\cos^m(x)\cdot\sin^n(x)$$. First let us work through an example.


 * $$\int\cos^3(x)\sin^2(x)dx$$

Notice that the integrand contains an odd power of cos. So rewrite it as


 * $$\int\cos^2(x)\sin^2(x)\cos(x)dx$$

We can solve this by making the substitution $$u=\sin(x)$$ so $$du=\cos(x)dx$$. Then we can write the whole integrand in terms of $$u$$ by using the identity
 * $$\cos^2(x)=1-\sin^2(x)=1-u^2$$.

So


 * $$\int\cos^3(x)\sin^2(x)dx$$
 * $$=\int\cos^2(x)\sin^2(x)\cos(x)dx$$
 * $$=\int (1-u^2)u^2du$$
 * $$=\int u^2du-\int u^4du$$
 * $$=\frac{u^3}{3}+\frac{u^5}{5}+C$$
 * $$=\frac{\sin^3(x)}{3}-\frac{\sin^5(x)}{5}+C$$
 * }
 * $$=\int u^2du-\int u^4du$$
 * $$=\frac{u^3}{3}+\frac{u^5}{5}+C$$
 * $$=\frac{\sin^3(x)}{3}-\frac{\sin^5(x)}{5}+C$$
 * }
 * $$=\frac{\sin^3(x)}{3}-\frac{\sin^5(x)}{5}+C$$
 * }
 * $$=\frac{\sin^3(x)}{3}-\frac{\sin^5(x)}{5}+C$$
 * }

This method works whenever there is an odd power of sine or cosine.

 To evaluate $$\int\cos^m(x)\sin^n(x)dx$$ when either $$m$$ or $$n$$ is odd.
 * If $$m$$ is odd substitute $$u=\sin(x)$$ and use the identity $$\cos^2(x)=1-\sin^2(x)=1-u^2$$.
 * If $$n$$ is odd substitute $$u=\cos(x)$$ and use the identity $$\sin^2(x)=1-\cos^2(x)=1-u^2$$.

Example
Find $$\int\limits_0^\frac{\pi}{2} \cos^{40}(x)\sin^3(x)dx$$.

As there is an odd power of $$\sin$$ we let $$u=\cos(x)$$ so $$du=-\sin(x)dx$$. Notice that when $$x=0$$ we have $$u=\cos(0)=1$$ and when $$x=\frac{\pi}{2}$$ we have $$u=\cos(\tfrac{\pi}{2})=0$$.



(u^{40}-u^{42})du$$
 * $$\int\limits_0^\frac{\pi}{2} \cos^{40}(x)\sin^3(x)dx$$
 * $$=\int\limits_0^\frac{\pi}{2} \cos^{40}(x)\sin^2(x)\sin(x)dx$$
 * $$=-\int\limits_1^0 u^{40}(1-u^2)du$$
 * $$=\int\limits_0^1 u^{40}(2-u^2)du$$
 * $$=\int\limits_0^5
 * $$=\int\limits_0^1 u^{40}(2-u^2)du$$
 * $$=\int\limits_0^5
 * $$=\int\limits_0^1 u^{40}(2-u^2)du$$
 * $$=\int\limits_0^5
 * $$=\int\limits_0^5
 * $$=\int\limits_0^5
 * $$=\left(\frac{u^{41}}{41}-\frac{u^{43}}{43}\right)\Bigg|_0^1$$
 * $$=\frac{1}{41}-\frac{1}{43}$$
 * }
 * $$=\frac{1}{41}-\frac{1}{43}$$
 * }
 * $$=\frac{1}{41}-\frac{1}{43}$$
 * }

When both $$m$$ and $$n$$ are even, things get a little more complicated.

 To evaluate $$\int\cos^m(x)\sin^n(x)dx$$ when both $$m$$ and $$n$$ are even.

Use the identities $$\sin^2(x)=\frac{1-\cos(2x)}{2}$$ and $$\cos^2(x)=\frac{1+\cos(2x)}{2}$$.

Example
Find $$\int\sin^2(x)\cos^4(x)dx$$.

As $$\sin^2(x)=\frac{1-\cos(2x)}{2}$$ and $$\cos^2(x)=\frac{1+\cos(2x)}{2}$$ we have
 * $$\int\sin^2(x)\cos^4(x)dx=\int\left(\frac{1-\cos(2x)}{2}\right)\left(\frac{1+\cos(2x)}{2}\right)^2dx$$

and expanding, the integrand becomes
 * $$\frac{1}{8}\int\left(1-\cos^2(2x)+\cos(2x)-\cos^3(2x)\right)dx$$

Using the multiple angle identities




 * $$I$$
 * $$=\frac{1}{8}\left(\int 1dx-\int\cos^2(2x)dx+\int\cos(2x)dx-\int\cos^3(2x)dx\right)$$
 * $$=\frac{1}{8}\left(x-\frac{1}{2}\int\Big(1+\cos(4x)\Big)dx+\frac{\sin(2x)}{2}-\int\cos^2(2x)\cos(2x)dx\right)$$
 * TODO: CORRECT FORMULA$$=\frac{1}{164}\left(x+\sin(2x)+\int\cos(4x)dx-2\int\Big(1-\sin^2(2x)\Big)\cos(2x)dx\right)$$
 * }
 * TODO: CORRECT FORMULA$$=\frac{1}{164}\left(x+\sin(2x)+\int\cos(4x)dx-2\int\Big(1-\sin^2(2x)\Big)\cos(2x)dx\right)$$
 * }
 * TODO: CORRECT FORMULA$$=\frac{1}{164}\left(x+\sin(2x)+\int\cos(4x)dx-2\int\Big(1-\sin^2(2x)\Big)\cos(2x)dx\right)$$
 * }

then we obtain on evaluating
 * $$I=\frac{x}{16}-\frac{\sin(4x)}{64}+\frac{\sin^3(2x)}{48}+C$$

Powers of Tan and Secant
 To evaluate $$\int\tan^m(x)\sec^n(x)dx$$.
 * 1) If $$n$$ is even and $$n\ge 2$$ then substitute $$u=tan(x)$$ and use the identity $$\sec^2(x)=1+\tan^2(x)$$.
 * 2) If $$n$$ and $$m$$ are both odd then substitute $$u=\sec(x)$$ and use the identity $$\tan^2(x)=\sec^2(x)-1$$.
 * 3) If $$n$$ is odd and $$m$$ is even then use the identity $$\tan^2(x)=\sec^2(x)-1$$ and apply a reduction formula to integrate $$\sec^j(x)dx$$, using the examples below to integrate when $$j=1,2$$.

Example 1
Find $$\int\sec^2(x)dx$$.

There is an even power of $$\sec(x)$$. Substituting $$u=\tan(x)$$ gives $$du=\sec^2(x)dx$$ so

$$\int\sec^2(x)dx=\int du=u+C=\tan(x)+C.$$

Example 2
Find $$\int\tan(x)dx$$.

Let $$u=\cos(x)$$ so $$du=-\sin(x)dx$$. Then




 * $$\int\tan(x)dx$$
 * $$=\int\frac{\sin(x)}{\cos(x)}dx$$
 * $$=\int -\frac{du}{u}$$
 * $$=-\ln|u|+C$$
 * $$=-\ln\Big|\cos(x)\Big|+C$$
 * $$=\ln\Big|\sec(x)\Big|+C$$
 * }
 * $$=-\ln|u|+C$$
 * $$=-\ln\Big|\cos(x)\Big|+C$$
 * $$=\ln\Big|\sec(x)\Big|+C$$
 * }
 * $$=\ln\Big|\sec(x)\Big|+C$$
 * }
 * $$=\ln\Big|\sec(x)\Big|+C$$
 * }

Example 3
Find $$\int\sec(x)dx$$.

The trick to do this is to multiply and divide by the same thing like this:




 * $$\int\sec(x)dx$$
 * $$=\int\sec(x)\frac{\sec(x)+\tan(x)}{\sec(x)+\tan(x)}dx$$
 * $$=\int\frac{\sec^2(x)+\sec(x)\tan(x)}{\sec(x)+\tan(x)}dx$$
 * }
 * $$=\int\frac{\sec^2(x)+\sec(x)\tan(x)}{\sec(x)+\tan(x)}dx$$
 * }

Making the substitution $$u=\sec(x)+\tan(x)$$ so $$du=\sec(x)\tan(x)+\sec^2(x)dx$$ ,




 * $$\int\sec(x)dx$$
 * $$=\int\frac{du}{u}$$
 * $$=\ln|u|+C$$
 * $$\ln\Big|\sec(x)+\tan(x)\Big|+C$$
 * }
 * $$\ln\Big|\sec(x)+\tan(x)\Big|+C$$
 * }
 * $$\ln\Big|\sec(x)+\tan(x)\Big|+C$$
 * }

More trigonometric combinations
 For the integrals $$\int\sin(nx)\cos(mx)dx$$ or $$\int\sin(nx)\sin(mx)dx$$ or $$\int\cos(nx)\cos(mx)dx$$ use the identities
 * $$\sin(a)\cos(b)=\frac{\sin(a+b)+\sin(a-b)}{2}$$
 * $$\sin(a)\sin(b)=\frac{\cos(a-b)-\cos(a+b)}{2}$$
 * $$\cos(a)\cos(b)=\frac{\cos(a-b)+\cos(a+b)}{2}$$

Example 1
Find $$\int\sin(3x)\cos(5x)dx$$.

We can use the fact that $$\sin(a)\cos(b)=\frac{\sin(a+b)+\sin(a-b)}{2}$$, so
 * $$\sin(3x)\cos(5x)=\frac{\sin(8x)+\sin(-2x)}{2}$$

Now use the oddness property of $$\sin(x)$$ to simplify
 * $$\sin(3x)\cos(5x)=\frac{\sin(8x)-\sin(2x)}{2}$$

And now we can integrate


 * $$\int\sin(3x)\cos(5x)dx$$
 * $$=\int\Big(\frac{\sin(8x)-\sin(2x)}{2}\Big)dx$$
 * $$=\frac{\cos(2x)}{4}-\frac{\cos(8x)}{16}+C$$
 * }
 * $$=\frac{\cos(2x)}{4}-\frac{\cos(8x)}{16}+C$$
 * }

Example 2
Find:$$\int\sin(x)\sin(2x)dx$$.

Using the identities
 * $$\sin(x)\sin(2x)=\frac{\cos(-x)-\cos(3x)}{2}=\frac{\cos(x)-\cos(3x)}{2}$$

Then


 * $$\int\sin(x)\sin(2x)dx$$
 * $$=\frac{1}{2}\int\Big(\cos(x)-\cos(3x)\Big)dx$$
 * $$=\frac{\sin(x)}{2}-\frac{\sin(3x)}{6}+C$$
 * }
 * $$=\frac{\sin(x)}{2}-\frac{\sin(3x)}{6}+C$$
 * }