Skip to main content

Section 3.2 Trigonometric Integrals

We discuss ways of computing indefinite integrals involving trigonometric functions.

Subsection 3.2.1 Products of Trigonometric Functions

We first study how to integrate functions of the form \(\sin(mx)\sin(nx)\text{,}\) \(\cos(mx)\cos(nx)\) and \(\sin(mx)\cos(nx)\text{.}\) The idea for computing such integrals is to convert the integrand, which is a product of trigonometric functions, into a sum of trigonometric functions. This can be done using trigonometric identities in Appendix A. Here we offer another way of deducing them. First, it follows from Euler’s formula that
\begin{gather} \cos(\theta) = \frac{e^{i\theta} + e^{-i\theta}}{2}, \qquad \sin(\theta) = \frac{e^{i\theta} - e^{-i\theta}}{2i} \tag{3.3} \end{gather}
For simplicity, let us write \(e_{A}\) for \(e^{iA}\text{.}\) Note that
\begin{equation*} e_Ae_B = e^{iA}e^{iB} = e^{i(A+B)} = e_{A+B}. \end{equation*}
So,
\begin{align*} \sin(A)\sin(B) & = \frac{e_A - e_{-A}}{2i}\frac{e_B-e_{-B}}{2i}\\ -4\sin(A)\sin(B) & = e_Ae_B - e_Ae_{-B} - e_{-A}e_B + e_{-A}e_{-B} \\ -4\sin(A)\sin(B) & = (e_{A+B} + e_{-(A+B)}) - (e_{A-B} + e_{-(A-B)})\\ 2 \sin(A)\sin(B) & = \frac{e_{A-B}+e_{-(A-B)}}{2} - \frac{e_{A+B}-e_{-(A+B)}}{2}\\ \sin(A)\sin(B) & = \frac{1}{2}\left( \cos(A-B) - \cos(A+B) \right) \end{align*}
Other product-to-sum formulas can be deduced similarly.

Example 3.9.

Let us compute \(\int \sin(3x)\sin(4x) dx\text{.}\) First, it follows from the above computation (with \(A = 4x\) and \(B=3x\)) that
\begin{equation*} \sin(3x)\sin(4x) = \frac{1}{2} \left( \cos(x) - \cos(7x) \right). \end{equation*}
Thus,
\begin{align*} \int \sin(3x)\sin(4x) dx &= \frac{1}{2}\left(\int\cos(x)dx - \int\cos(7x)dx\right) \\ & = \frac{1}{2}\sin(x) - \frac{1}{14}\sin(7x) + C. \end{align*}

Checkpoint 3.10.

Compute \(\int \cos(3x)\cos(4x)dx.\)
Solution.
(A.10)
\begin{align*} \int \cos(3x)\cos(4x)dx &= \frac{1}{2}\left( \int \cos(3x-4x)\ dx + \int \cos(3x+4x)\ dx \right)\\ &= \frac{1}{2}\sin(x) + \frac{1}{14}\sin(7x)+C. \end{align*}

Checkpoint 3.11.

Use an appropriate trigonometric identity to compute the integral
\begin{equation*} \int \sin(mx)\cos(nx)dx. \end{equation*}
Hint.
Solution.
\begin{align*} \int \sin(mx) &\cos(nx)dx = \int\dfrac{1}{2}(\sin(m+n)(x) + \sin(m-n)(x))dx\\ &= \begin{cases} -\dfrac{1}{2(m+n)}\cos(m+n)(x) - \dfrac{1}{2(m-n)}\cos(m-n)(x) + C & m \neq n \\ - \dfrac{1}{4m}\cos(2mx) + C. & m = n \end{cases} \end{align*}

Subsection 3.2.2 Powers of Trigonometric Functions

Consider an integral of the form
\begin{equation} \int \sin^m(x)\cos^n(x)dx \quad m,n \ge 0.\tag{3.4} \end{equation}
Because of the following relations:
\begin{equation*} \begin{cases} & \cos^2(x) + \sin^2(x) \equiv 1 \\ & d \cos(x) = -\sin(x) dx \\ & d \sin(x) = \cos(x) dx. \end{cases} \end{equation*}
the strategies for computing this kind of integrals depend on the parity of \(m\) and \(n\text{.}\) We summarize them in the following table:
Table 3.12. Summary of strategies (\(*\) stands for an arbitrary non-negative integer.)
form to be integrated strategy
\(\sin^{\text{odd}}(x)\cos^{*}(x) dx\) \(u=\cos(x)\)
\(\sin^{*}(x)\cos^{\text{odd}}(x) dx\) \(u=\sin(x)\)
\(\sin^{\text{even}}(x)\cos^{\text{even}}(x)\) use (A.14)
If either \(m\) or \(n\) is odd then the suggested strategy turns the differential form to be integrated into a form \(p(u) du\) where \(p(u)\) is a polynomial in \(u\text{.}\) This last form can be integrated easily solving the original integral. For instance,
\begin{align*} \sin^{2k+1}(x)\cos^m(x)dx &= (\sin^{2}(x))^k\cos^m(x)\sin(x)dx\\ &=-(1-u^2)^k u^m du. \end{align*}
Certainly, both \(m\) and \(n\) can be odd, then either the first or the second substitution will work.
If both \(m\) and \(n\) are even, then an application of (A.14) will halve the powers involved. Repeat the process until an odd power of either sine or cosine appears. That will bring us back to either the first or the second case. The following examples illustrate how to apply these strategies.

Example 3.13.

\(\int \sin^5(x)\cos^2(x)dx\text{.}\)\(u=\cos(x)\)
\begin{align*} \int -(1-u^2)^2 u^2 du &= \int -u^2 + 2u^4 - u^6 du\\ &= -\frac{1}{3}u^3+\frac{2}{5}u^5 - \frac{1}{7}u^7 + C\\ & = -\frac{1}{3}\cos^3 x + \frac{2}{5}\cos^5 x - \frac{1}{7}\cos^7 x + C. \end{align*}

Checkpoint 3.14.

Compute \(\int \sin^4(x)\cos^7(x)dx\)
Solution.
Making the substitution \(u = \sin(x)\text{,}\) we get
\begin{align*} \int\sin^4(u)\cos^7(x)dx &= \int u^4(\cos^2(x))^3 \cos(x)dx = \int u^4 (1-u^2)^3\ du\\ &= \frac{1}{5}u^5 - \frac{3}{7}u^7 + \frac{3}{9}u^9 - \frac{1}{11}u^{11} + C\\ & = \frac{1}{5}\sin^5 x - \frac{3}{7}\sin^7 x + \frac{1}{3}\sin^9 x - \frac{1}{11}\sin^{11} x + C. \end{align*}

Checkpoint 3.15.

Compute \(\int \sin^4(x)dx\text{.}\)
Solution.
\begin{align*} \sin^4(x) &= (\sin^2(x))^2 = \left( \frac{1-\cos(2x)}{2} \right)^2\\ &= \frac{1}{4}\left( 1 - 2\cos(2x) + \cos^2(2x) \right) \\ &= \frac{1}{4}\left( 1 - 2\cos(2x) + \frac{1+\cos(4x)}{2} \right)\\ &= \frac{3}{8} - \frac{\cos(2x)}{2} + \frac{\cos(4x)}{8} \end{align*}
\begin{align*} \int \sin^4(x)dx &= \int\frac{3}{8}dx - \int\frac{\cos(2x)}{2}dx + \int\frac{\cos(4x)}{8}dx \\ &= \frac{3x}{8} - \frac{1}{4}\sin(2x) + \frac{1}{32}\sin(4x) + C. \end{align*}

Checkpoint 3.16.

Compute \(\int \sin^2(3x)\cos^2(3x) dx\text{.}\)
Solution 1.
First, the substitution \(w = 3x\) will simplify the integral to
\begin{equation*} \int \sin^2(3x)\cos^2(3x) dx = \frac{1}{3}\int\sin^2(w)\cos^2(w) dw. \end{equation*}
According to (A.14),
\begin{align*} \int \sin^2(w)\cos^2(w)dw &= \int\frac{1-\cos(2w)}{2}\frac{1+\cos(2w)}{2} dw \\ & = \frac{1}{4} \int 1-\cos^2(2w) \end{align*}
Apply (A.14) to \(\cos^2(2w)\) and we get
\begin{align*} \frac{1}{4} \int 1-\cos^2(2w) dw & = \frac{1}{4} \int 1- \frac{1+\cos(4w)}{2} dw = \frac{1}{4}\int \frac{1}{2} - \frac{\cos(4w)}{2} dw \\ &= \frac{1}{8}\int 1 - \cos(4w) dw\\ & = \frac{1}{8} \left(w - \frac{1}{4}\sin(4w)\right) +C\\ & = \frac{3x}{8} - \frac{\sin(12x)}{32} + C \end{align*}
Putting all these together, we get
\begin{align*} \int \sin^2(3x)\cos^2(3x) dx & = \frac{1}{3}\int\sin^2(w)\cos^2(w) dw.\\ & = \frac{1}{3}\left( \frac{3x}{8} - \frac{\sin(12x)}{32}\right)+C\\ & = \frac{x}{8} - \frac{\sin(12x)}{96} + C \end{align*}
Solution 2.
\begin{align*} \sin^2(3x)\cos^2(3x) &= \left( \frac{e_{3x}-e_{-3x}}{2i} \right)^2 \left( \frac{e_{3x}+e_{-3x}}{2} \right)^2\\ &=-\frac{1}{16}[(e_{3x}-e_{-3x})(e_{3x}+e_{-3x})]^2\\ & = -\frac{1}{16}(e_{6x} -e_{-6x})^2 \\ & = \frac{1}{16}(2-(e_{12x}+e_{-12x}))\\ & = \frac{1}{8}\left(1 - \frac{e_{12x}+e_{-12x}}{2}\right) = \frac{1}{8}(1-\cos(12x)). \end{align*}
\begin{align*} \int \sin^2(3x)\cos^2(3x) dx & = \frac{1}{8} \int 1-\cos(12x) dx\\ & = \frac{x}{8} - \frac{\sin(12x)}{96} + C. \end{align*}
Next we study integrals of the form
\begin{equation} \int \tan^m(x)\sec^n(x) dx = \int \frac{\sin^{m}(x)}{\cos^{n+m}(x)} dx \quad m,n \ge 0\tag{3.5} \end{equation}
Just like before, if \(m\text{,}\) the power of tangent (equivalently the power of sine), is odd, one makes the substitution \(u=\cos(x)\) and turn the integrand into sum of negative powers of \(u\text{.}\)

Example 3.17.

\(\displaystyle \int \tan^3(x) \sec^4(x) dx = \int \dfrac{\sin^3(x)}{\cos^7(x)} dx\text{.}\)\(u=\cos(x)\text{.}\)\(du = -\sin(x)dx\)
\begin{align*} \int \frac{\sin^2(x) \sin(x)dx}{\cos^{7}(x)} & = \int \frac{-(1-u^2)du}{u^7}\\ &= \int u^{-5} - u^{-7} du\\ &= \frac{1}{6}u^{-6} - \frac{1}{4}u^{-4}+C\\ &= \frac{\sec^6(x)}{6} - \frac{\sec^4(x)}{4} +C \end{align*}
If the power of tangent is even, then one turns the integrand into a sum of powers of \(\sec(x)\) and uses the reduction formula for secant Item 3.5.3.d to handle the rest. This reduces the problem of finding the integral to integrating a single power of \(\sec(x)\) which we have found earlier (Example 2.7, see also half-angle substitution 3.2.3).

Example 3.18.

Compute \(\int\tan^2(x)\sec(x)dx.\)
Turn the integrand into powers of secant.
\begin{align*} \int \tan^2(x) \sec(x) dx &= \int (\sec^2(x)-1)\sec(x) dx\\ &= \int \sec^3(x)- \int \sec(x) dx \end{align*}
Using the reduction formula for secant, we get
\begin{equation*} \int \sec^3(x) dx = \frac{1}{2}\sec(x)\tan(x)+ \frac{1}{2} \int \sec(x) dx. \end{equation*}
So the integral becomes,
\begin{align*} & \frac{1}{2}\sec(x) \tan(x) + \frac{1}{2}\int\sec(x) dx - \int \sec(x) dx \\ &= \frac{1}{2}\left(\sec(x)\tan(x) - \int \sec(x) dx \right)\\ &=\frac{1}{2}\left( \sec(x)\tan(x) - \ln|\sec(x) + \tan(x)| \right) + C. \end{align*}
The strategies above express the integral in terms of integrals of power of secants. Even though they cover all cases, they may not be the most efficient ways in handling high even power of tangents. In those cases, the substitution \(u=\tan(x)\) leads to a simpler expression of the antiderivatives as that avoids expressing a high even power of tangent in terms of secant. Let us illustrate this point with a couple examples.

Example 3.19.

Let us compute \(\int \tan^{10}(x)\sec^2(x) dx\text{.}\) Instead of expression the integrand in terms of secant and use the secant reduction formula, let \(u = \tan(x)\text{.}\) Then \(du = \sec^2(x)dx\) and the integral turns into
\begin{gather*} \int u^{10} du = \frac{1}{11}u^{11} +C = \frac{1}{11}\tan^{11}(x) + C. \end{gather*}

Example 3.20.

Compute \(\int \tan^{8}(x)dx\text{.}\) First, turn a \(\tan^2(x)\) into \(\sec^2(x)-1\text{.}\) That is write \(\tan^{8}(x)\) as
\begin{equation*} \tan^{6}(x)(\sec^2(x) -1) = \tan^{6}\sec^2(x) - \tan^{6}(x). \end{equation*}
So, the integral becomes
\begin{align*} & \int \tan^{6}(x)\sec^{2}(x) dx - \int \tan^{6}(x) dx\\ & = \frac{1}{7}\tan^{7}(x) - \int \tan^{6}(x)dx. \end{align*}
This is just an application of the reduction formula for tangent 3.5.3.c. So by repeat applications of this reduction formula, we finally arrive to
\begin{gather*} \frac{1}{7}\tan^{7}(x) - \frac{1}{5}\tan^{5}(x) + \frac{1}{3}\tan^3(x) - \tan(x) + x + C. \end{gather*}

Checkpoint 3.21.

Compute \(\ds \int \tan^3(x)\sec^2(x) dx.\)
Hint.
\(u = \cos(x)\)\(u=\tan(x)\)
Answer.
\(u=\tan(x)\)\(\frac{\tan^4(x)}{4}+C\)\(\frac{\sec^4(x)}{4} - \frac{\sec^2(x)}{2}+C\text{.}\)\(1/4\)
Integral of the form \(\cot^m(x)\csc^n(x) dx\) can be handle similarly.

Example 3.22.

\begin{align*} \int \cot^3(x)\csc^3(x)dx &= \int \frac{\cos^3(x)}{\sin^6(x)} dx\\ &=\int \frac{1-\sin^2(x)}{\sin^6(x)} d\sin(x)\\ &=\int (1-u^2)u^{-6} du \qquad (u=\sin(x)) \\ &=\int u^{-6} - u^{-4} du = -5u^{-5} + 3u^{-3} +C\\ &=-\frac{\csc(x)^5}{5} + \frac{\csc(x)^3}{3} + C. \end{align*}

Subsection 3.2.3 Half-Angle Substitution

There is a way to convert integrals of rational functions in sine and cosine into integrals of rational functions of a single variable. It comes from the following parametrization of the unit circle.
Figure 3.23. Half-Angle Substitution
By intersecting the line \(\ell\) with the unit circle, we get
\begin{equation} \cos \theta = \frac{1-t^2}{1+t^2}, \qquad \sin \theta = \frac{2t}{1+t^2}\tag{3.6} \end{equation}
where \(t = \tan(\theta/2)\) is the slope of the line hence the name of half-angle substitution (aka the Weierstrass substitution). Since
\begin{align*} dt &= d\tan\left(\frac{\theta}{2}\right) = \frac{1}{2}\sec^2\left(\frac{\theta}{2}\right) d\theta =\frac{1+t^2}{2} d\theta, \end{align*}
so for a rational function \(R(x,y)\) in two variables,
\begin{equation*} R(\cos \theta, \sin \theta) d\theta = R\left( \frac{1-t^2}{1+t^2}, \frac{2t}{1+t^2} \right)\frac{2}{1+t^2} dt. \end{equation*}
The form on the right-hand side is a differential form involving a rational function in \(t\) which we will study systematically in Section 3.4. For now let us apply this technique to compute the indefinite integral of \(\sec(x)\text{.}\)

Example 3.24.

\begin{align*} \int \sec \theta d\theta &= \int \frac{1+t^2}{1-t^2}\frac{2}{1+t^2} dt = \int \frac{2}{1-t^2} dt\\ &= \int \frac{dt}{1-t} + \int \frac{dt}{1+t} = \ln \left| \frac{1+t}{1-t}\right| + C\\ &= \ln\left|\frac{1+\tan(\theta/2)}{1-\tan(\theta/2)}\right|+C. \end{align*}
\begin{align*} \ln\left|\frac{1+t}{1-t}\right| &= \ln\left|\frac{(1+t)^2}{1-t^2} \right|\\ &= \ln\left|\frac{1+t^2}{1-t^2} + \frac{2t}{1-t^2}\right|\\ &= \ln|\sec \theta + \tan \theta|. \end{align*}