Skip to main content

CLP-2 Integral Calculus

Section 1.8 Trigonometric Integrals

Integrals of polynomials of the trigonometric functions \(\sin x\text{,}\) \(\cos x\text{,}\) \(\tan x\) and so on, are generally evaluated by using a combination of simple substitutions and trigonometric identities. There are of course a very large number
 1 
The more pedantic reader could construct an infinite list of them.
of trigonometric identities, but usually we use only a handful of them. The most important three are:
Notice that the last two lines of Equation 1.8.3 follow from the first line by replacing either \(\sin^2x\) or \(\cos^2x\) using Equation 1.8.1. It is also useful to rewrite these last two lines:
These last two are particularly useful since they allow us to rewrite higher powers of sine and cosine in terms of lower powers. For example:
\begin{align*} \sin^4(x) &= \left[ \frac{1-\cos(2x)}{2} \right]^2 &\text{by Equation }\knowl{./knowl/xref/eq_TRGINTtrigidentityF.html}{\text{1.8.4}}\\ &= \frac{1}{4} - \frac{1}{2} \cos(2x) + \frac{1}{4}\underbrace{\cos^2(2x)}_{\text{do it again}} & \text{use Equation }\knowl{./knowl/xref/eq_TRGINTtrigidentityG.html}{\text{1.8.5}}\\ &= \frac{1}{4} - \frac{1}{2} \cos(2x) + \frac{1}{8}\left(1 + \cos(4x) \right)\\ &= \frac{3}{8} - \frac{1}{2} \cos(2x) + \frac{1}{8}\cos(4x) \end{align*}
So while it was hard to integrate \(\sin^4(x)\) directly, the final expression is quite straightforward (with a little substitution rule).
There are many such tricks for integrating powers of trigonometric functions. Here we concentrate on two families
\begin{align*} \int \sin^mx \cos^nx \dee{x} &&\text{and}&& \int \tan^mx \sec^nx \dee{x} \end{align*}
for integer \(n,m\text{.}\) The details of the technique depend on the parity of \(n\) and \(m\) — that is, whether \(n\) and \(m\) are even or odd numbers.

Subsection 1.8.1 Integrating \(\int \sin^m x\cos^n x\dee{x}\)

Subsubsection 1.8.1.1 One of \(n\) and \(m\) is odd

Consider the integral \(\int \sin^2x \cos x\dee{x}\text{.}\) We can integrate this by substituting \(u=\sin x\) and \(\dee{u}=\cos x \dee{x}\text{.}\) This gives
\begin{align*} \int \sin^2x \cos x\dee{x} &= \int u^2 \dee{u}\\ &= \frac{1}{3}u^3+C = \frac{1}{3}\sin^3x +C \end{align*}
This method can be used whenever \(n\) is an odd integer.
  • Substitute \(u=\sin x\) and \(\dee{u}=\cos x\dee{x}\text{.}\)
  • This leaves an even power of cosines — convert them using \(\cos^2x = 1-\sin^2x = 1-u^2\text{.}\)
Here is an example.
Example 1.8.6. \(\int \sin^2 x\cos^3 x\dee{x}\).
Start by factoring off one power of \(\cos x\) to combine with \(\dee{x}\) to get \(\cos x\dee{x}=\dee{u}\text{.}\)
\begin{align*} \int \sin^2 x\cos^3 x\dee{x} &= \int \underbrace{\sin^2 x}_{=u^2}\underbrace{\cos^2 x}_{=1-u^2}\ \underbrace{\cos x\dee{x}}_{=\dee{u}} & \text{set $u=\sin x$}\\ &= \int u^2\ (1-u^2)\dee{u}\\ &=\frac{u^3}{3}-\frac{u^5}{5}+C\\ &=\frac{\sin^3x}{3}-\frac{\sin^5x}{5}+C \end{align*}
Of course if \(m\) is an odd integer we can use the same strategy with the roles of \(\sin x\) and \(\cos x\) exchanged. That is, we substitute \(u=\cos x\text{,}\) \(\dee{u}=-\sin x\dee{x}\) and \(\sin^2 x=1-\cos^2x=1-u^2\text{.}\)

Subsubsection 1.8.1.2 Both \(n\) and \(m\) are even

If \(m\) and \(n\) are both even, the strategy is to use the trig identities 1.8.4 and 1.8.5 to get back to the \(m\) or \(n\) odd case. This is typically more laborious than the previous case we studied. Here are a couple of examples that arise quite commonly in applications.
Example 1.8.7. \(\int \cos^2 x\dee{x}\).
By 1.8.5
\begin{equation*} \int \cos^2 x\dee{x} = \frac{1}{2}\int \big[1+\cos(2x)\big]\dee{x} = \frac{1}{2} \Big[x+\frac{1}{2}\sin(2x)\Big] + C \end{equation*}
Example 1.8.8. \(\int \cos^4 x\dee{x}\).
First we’ll prepare the integrand \(\cos^4x\) for easy integration by applying 1.8.5 a couple times. We have already used 1.8.5 once to get
\begin{gather*} \cos^2 x = \frac{1}{2} \big[1+\cos(2x)\big] \end{gather*}
Squaring it gives
\begin{gather*} \cos^4 x = \frac{1}{4} \big[1+\cos(2x)\big]^2 = \frac{1}{4}+\frac{1}{2}\cos(2x)+\frac{1}{4}\cos^2(2x) \end{gather*}
Now by 1.8.5 a second time
\begin{align*} \cos^4 x &= \frac{1}{4}+\frac{1}{2}\cos(2x)+\frac{1}{4}\ \frac{1+\cos(4x)}{2}\\ &=\frac{3}{8}+\frac{1}{2}\cos(2x)+\frac{1}{8}\cos(4x) \end{align*}
Now it’s easy to integrate
\begin{align*} \int \cos^4 x\dee{x} &= \frac{3}{8}\int \dee{x}+\frac{1}{2}\int\cos(2x)\dee{x}+\frac{1}{8}\int\cos(4x)\dee{x}\\ &= \frac{3}{8}x+\frac{1}{4}\sin(2x)+\frac{1}{32}\sin(4x) + C \end{align*}
Example 1.8.9. \(\int \cos^2x \sin^2x\dee{x}\).
Here we apply both 1.8.4 and 1.8.5.
\begin{align*} \int \cos^2x \sin^2x\dee{x} &= \frac{1}{4} \int \big[1+\cos(2x)\big] \big[1-\cos(2x)\big] \dee{x}\\ &= \frac{1}{4} \int \big[ 1-\cos^2(2x) \big] \dee{x}\\ \end{align*}

We can then apply 1.8.5 again

\begin{align*} &= \frac{1}{4} \int \big[ 1- \frac{1}{2}\left(1+ \cos(4x)\right) \big] \dee{x}\\ &= \frac{1}{8}\int \big[1 - \cos(4x)\big] \dee{x}\\ &= \frac{1}{8}x -\frac{1}{32}\sin(4x) +C \end{align*}
Oof! We could also have done this one using 1.8.2 to write the integrand as \(\sin^2(2x)\) and then used 1.8.4 to write it in terms of \(\cos(4x)\text{.}\)
Example 1.8.10. \(\int_0^\pi \cos^2 x\dee{x}\) and \(\int_0^\pi \sin^2 x\dee{x}\).
Of course we can compute the definite integral \(\int_0^\pi \cos^2 x\dee{x}\) by using the antiderivative for \(\cos^2 x\) that we found in Example 1.8.7. But here is a trickier way to evaluate that integral, and also the integral \(\int_0^\pi \sin^2 x\dee{x}\) at the same time, very quickly without needing the antiderivative of Example 1.8.7.
Solution:
  • Observe that \(\int_0^\pi \cos^2 x\dee{x}\) and \(\int_0^\pi \sin^2 x\dee{x}\) are equal because they represent the same area — look at the graphs below — the darkly shaded regions in the two graphs have the same area and the lightly shaded regions in the two graphs have the same area.
  • Consequently,
    \begin{align*} \int_0^\pi \cos^2 x\dee{x} = \int_0^\pi \sin^2 x\dee{x} &= \frac{1}{2}\bigg[\int_0^\pi \sin^2 x\dee{x} +\int_0^\pi \cos^2 x\dee{x}\bigg]\\ &=\frac{1}{2}\int_0^\pi \big[\sin^2 x+ \cos^2 x\big]\dee{x}\\ &= \frac{1}{2}\int_0^\pi \dee{x}\\ &=\frac{\pi}{2} \end{align*}

Subsection 1.8.2 Integrating \(\int \tan^m x\sec^n x\dee{x}\)

The strategy for dealing with these integrals is similar to the strategy that we used to evaluate integrals of the form \(\int \sin^m x\cos^n x\dee{x}\) and again depends on the parity of the exponents \(n\) and \(m\text{.}\) It uses
 2 
You will need to memorise the derivatives of tangent and secant. However there is no need to memorise \(1+\tan^2x = \sec^2 x\text{.}\) To derive it very quickly just divide \(\sin^2 x+\cos^2 x = 1\) by \(\cos^2 x\text{.}\)
\begin{align*} \diff{}{x}\tan x &= \sec^2 x & \diff{}{x}\sec x &= \sec x\,\tan x & 1+\tan^2x &= \sec^2 x \end{align*}
We split the methods for integrating \(\int \tan^m x\sec^n x\dee{x}\) into 5 cases which we list below. These will become much more clear after an example (or two).
  1. When \(m\) is odd and any \(n\) — rewrite the integrand in terms of \(\sin x\) and \(\cos x\text{:}\)
    \begin{align*} \tan^m x\,\sec^n x\dee{x} &=\left(\frac{\sin x}{\cos x}\right)^m \left(\frac{1}{\cos x}\right)^n\dee{x}\\ &=\frac{\sin^{m-1}x}{\cos^{n+m}x}\ \sin x\dee{x} \end{align*}
    and then substitute \(u=\cos x\text{,}\) \(\dee{u} = -\sin x\dee{x}\text{,}\) \(\sin^2x = 1-\cos^2x=1-u^2\text{.}\) See Examples 1.8.11 and 1.8.12.
  2. Alternatively, if \(m\) is odd and \(n \geq 1\) move one factor of \(\sec x\,\tan x\) to the side so that you can see \(\sec x\,\tan x\dee{x}\) in the integral, and substitute \(u=\sec x\text{,}\) \(\dee{u}=\sec x\,\tan x\,\dee{x}\) and \(\tan^2 x = \sec^2 x-1=u^2-1\text{.}\) See Example 1.8.13.
  3. If \(n\) is even with \(n\ge 2\text{,}\) move one factor of \(\sec^2 x\) to the side so that you can see \(\sec^2 x\dee{x}\) in the integral, and substitute \(u=\tan x\text{,}\) \(\dee{u}=\sec^2 x\,\dee{x}\) and \(\sec^2 x = 1+\tan^2 x=1+u^2\text{.}\) See Example 1.8.14.
  4. When \(m\) is even and \(n=0\) — that is the integrand is just an even power of tangent — we can still use the \(u=\tan x\) substitution, after using \(\tan^2x = \sec^2 x - 1\) (possibly more than once) to create a \(\sec^2 x\text{.}\) See Example 1.8.16.
  5. This leaves the case \(n\) odd and \(m\) even. There are strategies like those above for treating this case. But they are more complicated and also involve more tricks (that basically have to be memorized). Examples using them are provided in the optional section entitled “Integrating \(\sec x\text{,}\) \(\csc x\text{,}\) \(\sec^3 x\) and \(\csc^3 x\)”, below. A more straightforward strategy involves
    • multiplying the numerator \(\sin^m x\) and the denominator \(\cos^{m+n}x\) by \(\cos x\text{,}\) and then
    • expressing the denominator, which is now an even power of \(\cos x\text{,}\) in terms of \(\sin x\text{,}\) and then
    • substituting \(u=\sin x\text{.}\) This converts the integrand into a rational function (i.e. a ratio of two poynomials) of \(u\text{.}\)
    • That rational function of \(u\) may be integrated using a technique called “partial fractions”, that we will cover later.
    We shall return to this strategy after we have learned about partial fractions. See Example 1.10.5 and 1.10.6 in Section 1.10.

Subsubsection 1.8.2.1 \(m\) is odd — odd power of tangent

In this case we rewrite the integrand in terms of sine and cosine and then substitute \(u=\cos x, \dee{u}=-\sin x \dee{x}\text{.}\)
Example 1.8.11. \(\int \tan x\dee{x}\).
Solution:
  • Write the integrand \(\tan x=\frac{1}{\cos x}\sin x\text{.}\)
  • Now substitute \(u=\cos x\text{,}\) \(\dee{u}=-\sin x\,\dee{x}\) just as we did in treating integrands of the form \(\sin^mx\,\cos^nx\) with \(m\) odd.
    \begin{align*} \int \tan x\,\dee{x} &=\int \frac{1}{\cos x}\sin x\,\dee{x} \qquad\qquad\qquad \text{substitute $u=\cos x$}\\ &=\int \frac{1}{u} \cdot(-1) \dee{u}\\ &=-\log|u|+C\\ &=-\log\left|\cos x\right|+C \qquad\qquad \text{can also write in terms of secant}\\ &=\log\left|\cos x\right|^{-1}+C =\log\left|\sec x\right|+C \end{align*}
Example 1.8.12. \(\int \tan^3 x\dee{x}\).
Solution:
  • Write the integrand \(\tan^3 x=\frac{\sin^2x}{\cos^3 x}\sin x\text{.}\)
  • Again substitute \(u=\cos x\text{,}\) \(\dee{u}=-\sin x\,\dee{x}\text{.}\) We rewrite the remaining even powers of \(\sin x\) using \(\sin^2x=1-\cos^2x=1-u^2\text{.}\)
  • Hence
    \begin{align*} \int \tan^3 x\,\dee{x} &=\int \frac{\sin^2x}{\cos^3x}\sin x\,\dee{x} \qquad \text{substitute $u=\cos x$}\\ &=\int \frac{1-u^2}{u^3} (-1) \dee{u}\\ &=\frac{u^{-2}}{2}+\log|u|+C\\ &=\frac{1}{2 \cos^2 x}+\log\left|\cos x\right|+C \qquad \text{rewrite in terms of secant}\\ &= \frac{1}{2}\sec^2 x - \log\left|\sec x\right|+C \end{align*}

Subsubsection 1.8.2.2 \(m\) is odd and \(n\geq 1\) — odd power of tangent and at least one secant

Here we collect a factor of \(\tan x \sec x\) and then substitute \(u = \sec x\) and \(\dee{u} = \sec x \tan x \dee{x}\text{.}\) We can then rewrite any remaining even powers of \(tan x\) in terms of \(\sec x\) using \(\tan^2x = \sec^2 x-1=u^2-1\text{.}\)
Example 1.8.13. \(\int \tan^3 x\sec^4 x\dee{x}\).
Solution:
  • Start by factoring off one copy of \(\sec x\tan x\) and combine it with \(\dee{x}\) to form \(\sec x\tan x\dee{x}\text{,}\) which will be \(\dee{u}\text{.}\)
  • Now substitute \(u=\sec x\text{,}\) \(\dee{u}=\sec x\tan x\dee{x}\) and \(\tan^2x = \sec^2 x-1=u^2-1\text{.}\)
  • This gives
    \begin{align*} \int \tan^3x \sec^4 x\dee{x} &= \int \underbrace{\tan^2 x}_{u^2-1}\ \underbrace{\sec^3 x}_{u^3}\ \underbrace{\sec x\tan x\dee{x}}_{\dee{u}}\\ &= \int \big[u^2-1]u^3\dee{u}\\ &=\frac{u^6}{6}-\frac{u^4}{4}+C\\ &=\frac{1}{6}\sec^6 x-\frac{1}{4}\sec^4 x + C \end{align*}

Subsubsection 1.8.2.3 \(n\geq 2\) is even — a positive even power of secant

In the previous case we substituted \(u = \sec x\text{,}\) while in this case we substitute \(u=\tan x\text{.}\) When we do this we write \(\dee{u}=\sec^2 x \dee{x}\) and then rewrite any remaining even powers of \(\sec x\) as powers of \(\tan x\) using \(\sec^2x = 1+\tan^2x=1+u^2\text{.}\)
Example 1.8.14. \(\int \sec^4 x\dee{x}\).
Solution:
  • Factor off one copy of \(\sec^2 x\) and combine it with \(\dee{x}\) to form \(\sec^2 x\dee{x}\text{,}\) which will be \(\dee{u}\text{.}\)
  • Then substitute \(u=\tan x\text{,}\) \(\dee{u}=\sec^2 x\dee{x}\) and rewrite any remaining even powers of \(\sec x\) as powers of \(\tan x=u\) using \(\sec^2x = 1+\tan^2 x=1+u^2\text{.}\)
  • This gives
    \begin{align*} \int \sec^4 x\dee{x} &= \int \underbrace{\sec^2 x}_{1+u^2}\ \underbrace{\sec^2 x\dee{x}}_{\dee{u}}\\ &= \int \big[1+u^2]\dee{u}\\ &=u+\frac{u^3}{3}+C\\ &=\tan x+\frac{1}{3}\tan^3 x + C \end{align*}
Example 1.8.15. \(\int \tan^3 x\sec^4x \dee{x}\) — redux.
Solution: Let us revisit this example using this slightly different approach.
  • Factor off one copy of \(\sec^2 x\) and combine it with \(\dee{x}\) to form \(\sec^2 x\dee{x}\text{,}\) which will be \(\dee{u}\text{.}\)
  • Then substitute \(u=\tan x\text{,}\) \(\dee{u}=\sec^2 x\dee{x}\) and rewrite any remaining even powers of \(\sec x\) as powers of \(\tan x=u\) using \(\sec^2x = 1+\tan^2 x=1+u^2\text{.}\)
  • This gives
    \begin{align*} \int \tan^3x \sec^4 x\dee{x} &= \int \underbrace{\tan^3x}_{u^3} \underbrace{\sec^2 x}_{1+u^2}\ \underbrace{\sec^2 x\dee{x}}_{\dee{u}}\\ &= \int \big[u^3+u^5]\dee{u}\\ &=\frac{u^4}{4}+ \frac{u^6}{6} + C\\ &=\frac{1}{4}\tan^4 x+\frac{1}{6}\tan^6 x + C \end{align*}
  • This is not quite the same as the answer we got above in Example 1.8.13. However we can show they are (nearly) equivalent. To do so we substitute \(v=\sec x\) and \(\tan^2x=\sec^2x-1 = v^2-1\text{:}\)
    \begin{align*} \frac{1}{6}\tan^6x + \frac{1}{4}\tan^4x &= \frac{1}{6} (v^2-1)^3 + \frac{1}{4}(v^2-1)^2\\ &= \frac{1}{6} (v^6-3v^4+3v^2-1) + \frac{1}{4} (v^4-2v^2+1)\\ &= \frac{v^6}{6} - \frac{v^4}{2} + \frac{v^2}{2} - \frac{1}{6} + \frac{v^4}{4} - \frac{v^2}{2} + \frac{1}{4}\\ &= \frac{v^6}{6} -\frac{v^4}{4} + 0 \cdot v^2 + \left(\frac{1}{4}-\frac{1}{6}\right)\\ &= \frac{1}{6}\sec^6x - \frac{1}{4}\sec^4x + \frac{1}{12}. \end{align*}
    So while \(\frac{1}{6}\tan^6x + \frac{1}{4}\tan^4x \neq \frac{1}{6}\sec^6x - \frac{1}{4}\sec^4x\text{,}\) they only differ by a constant. Hence both are valid antiderivatives of \(\tan^3 x\sec^4x\text{.}\)

Subsubsection 1.8.2.4 \(m\) is even and \(n=0\) — even powers of tangent

We integrate this by setting \(u=\tan x\text{.}\) For this to work we need to pull one factor of \(\sec^2x\) to one side to form \(\dee{u}=\sec^2x\dee{x}\text{.}\) To find this factor of \(\sec^2x\) we (perhaps repeatedly) apply the identity \(\tan^2x=\sec^2x-1\text{.}\)
Example 1.8.16. \(\int \tan^4 x\dee{x}\).
Solution:
  • There is no \(\sec^2x\) term present, so we try to create it from \(\tan^4x\) by using \(\tan^2x = \sec^2 x - 1\text{.}\)
    \begin{align*} \tan^4 x &= \tan^2 x \cdot \tan^2 x\\ &= \tan^2 x\big[\sec^2 x - 1\big]\\ &=\tan^2x\sec^2 x-\underbrace{\tan^2 x}_{\sec^2x-1}\\ & = \tan^2x\sec^2 x-\sec^2 x + 1 \end{align*}
  • Now we can substitute \(u=\tan x\text{,}\) \(\dee{u}=\sec^2 x\dee{x}\text{.}\)
    \begin{align*} \int \tan^4 x\dee{x} & =\int \underbrace{\tan^2x}_{u^2}\ \underbrace{\sec^2 x\dee{x}}_{\dee{u}} - \int\underbrace{\sec^2 x\dee{x}}_{\dee{u}} + \int\dee{x}\\ &= \int u^2\dee{u} -\int \dee{u} + \int\dee{x}\\ &=\frac{u^3}{3}-u+x+C\\ &=\frac{\tan^3x}{3}-\tan x +x +C \end{align*}
Example 1.8.17. \(\int \tan^8x \dee{x}\).
Solution: Let us try the same approach.
  • First pull out a factor of \(\tan^2x\) to create a \(\sec^2x\) factor:
    \begin{align*} \tan^8x &= \tan^6x \cdot \tan^2x\\ &= \tan^6x \cdot \big[ \sec^2x - 1\big]\\ &= \tan^6x \sec^2x - \tan^6x\\ \end{align*}

    The first term is now ready to be integrated, but we need to reapply the method to the second term:

    \begin{align*} &= \tan^6x \sec^2x - \tan^4x\cdot\big[ \sec^2x - 1\big]\\ &= \tan^6x \sec^2x - \tan^4x \sec^2x + \tan^4x \qquad \text{do it again}\\ &= \tan^6x \sec^2x - \tan^4x \sec^2x + \tan^2x\cdot\big[ \sec^2x - 1\big]\\ &=\tan^6x \sec^2x - \tan^4x \sec^2x + \tan^2x \sec^2x - \tan^2x \qquad \text{and again}\\ &=\tan^6x \sec^2x - \tan^4x \sec^2x + \tan^2x \sec^2x - \big[\sec^2x-1\big] \end{align*}
  • Hence
    \begin{align*} &\int \tan^8x \dee{x}\\ &\hskip0.25in= \int\left[ \tan^6x \sec^2x - \tan^4x \sec^2x + \tan^2x \sec^2x -\sec^2x +1 \right]\dee{x}\\ &\hskip0.25in= \int \left[\tan^6x -\tan^4x +\tan^2x - 1\right]\sec^2x\dee{x} + \int \dee{x}\\ &\hskip0.25in= \int \left[u^6 - u^4 +u^2 - 1\right]\dee{u} + x +C\\ &\hskip0.25in= \frac{u^7}{7} - \frac{u^5}{5} + \frac{u^3}{3} - u + x +C\\ &\hskip0.25in=\frac{1}{7}\tan^7x - \frac{1}{5}\tan^5x + \frac{1}{3}\tan^3x - \tan x + x +C \end{align*}
Indeed this example suggests that for integer \(k\geq 0\text{:}\)
\begin{align*} \int \tan^{2k}x \dee{x} &= \frac{1}{2k-1}\tan^{2k-1}(x) - \frac{1}{2k-3}\tan^{2k-3}x + \cdots \\ &\hskip1.0in - (-1)^k \tan x + (-1)^k x +C \end{align*}
This last example also shows how we might integrate an odd power of tangent:
Example 1.8.18. \(\int \tan^7 x\).
Solution: We follow the same steps
  • Pull out a factor of \(\tan^2x\) to create a factor of \(\sec^2x\text{:}\)
    \begin{align*} \tan^7x &= \tan^5x \cdot \tan^2x\\ &= \tan^5x \cdot \big[ \sec^2x - 1\big]\\ &= \tan^5x \sec^2x - \tan^5x \qquad \text{do it again}\\ &= \tan^5x \sec^2x - \tan^3x \cdot \big[ \sec^2x - 1\big]\\ &= \tan^5x \sec^2x - \tan^3x \sec^2x + \tan^3x \qquad\text{and again}\\ &= \tan^5x \sec^2x - \tan^3x \sec^2x + \tan x \big[ \sec^2x - 1\big]\\ &= \tan^5x \sec^2x - \tan^3x \sec^2x + \tan x \sec^2x - \tan x \end{align*}
  • Now we can substitute \(u=\tan x\) and \(\dee{u}=\sec^2x \dee{x}\) and also use the result from Example 1.8.11 to take care of the last term:
    \begin{align*} \int \tan^7x\dee{x} &= \int \big[\tan^5x \sec^2x - \tan^3x \sec^2x + \tan x \sec^2x\big] \dee{x}\\ &\hskip2in- \int \tan x \dee{x}\\ \end{align*}

    Now factor out the common \(\sec^2x\) term and integrate \(\tan x\) via Example 1.8.11

    \begin{align*} &= \int \big[ \tan^5x - \tan^3x +\tan x\big]\sec^2 x\ \dee{x} - \log|\sec x| +C\\ &= \int \big[ u^5 - u^3 + u \big]\dee{u} - \log|\sec x| +C\\ &= \frac{u^6}{6} - \frac{u^4}{4} + \frac{u^2}{2} - \log|\sec x| +C\\ &= \frac{1}{6}\tan^6x - \frac{1}{4}\tan^4x +\frac{1}{2}\tan^2x - \log|\sec x| + C \end{align*}
This example suggests that for integer \(k\geq 0\text{:}\)
\begin{align*} \int \tan^{2k+1}x \dee{x} &= \frac{1}{2k}\tan^{2k}(x) - \frac{1}{2k-2}\tan^{2k-2}x + \cdots\\ &\hskip0.25in - (-1)^k \frac{1}{2} \tan^2 x + (-1)^k \log|\sec x| +C \end{align*}
Of course we have not considered integrals involving powers of \(\cot x\) and \(\csc x\text{.}\) But they can be treated in much the same way as \(\tan x\) and \(\sec x\) were.

Subsection 1.8.3 Optional — Integrating \(\sec x\text{,}\) \(\csc x\text{,}\) \(\sec^3 x\) and \(\csc^3 x\)

As noted above, when \(n\) is odd and \(m\) is even, one can use similar strategies as to the previous cases. However the computations are often more involved and more tricks need to be deployed. For this reason we make this section optional — the computations are definitely non-trivial. Rather than trying to construct a coherent “method” for this case, we instead give some examples to give the idea of what to expect.

Example 1.8.19. \(\int \sec x\dee{x}\) — by trickery.

Solution: There is a very sneaky trick to compute this integral
 3 
The integral of secant played an important role in constructing accurate Mercator projection maps of the earth. See https://en.wikipedia.org/wiki/Integral_of_the_secant_function and https://arxiv.org/pdf/2204.11187.pdf. The method for evaluating the integral that is being presented in this example was invented by the Scottish mathematician James Gregory in 1668. There are also a number of other methods. See the previous two references.
.
  • The standard trick for this integral is to multiply the integrand by \(1=\frac{\sec x+\tan x}{\sec x+\tan x}\)
    \begin{align*} \sec x &= \sec x\ \frac{\sec x+\tan x}{\sec x+\tan x} = \frac{\sec^2x + \sec x \tan x}{\sec x+\tan x} \end{align*}
  • Notice now that the numerator of this expression is exactly the derivative its denominator. Hence we can substitute \(u=\sec x+\tan x\) and \(\dee{u} = (\sec x\tan x+\sec^2 x)\,\dee{x}\text{.}\)
  • Hence
    \begin{align*} \int \sec x\dee{x} &=\int \sec x\ \frac{\sec x+\tan x}{\sec x+\tan x}\dee{x} =\int \frac{\sec^2 x+\sec x\tan x}{\sec x+\tan x}\dee{x}\\ &=\int \frac{1}{u}\dee{u}\\ &=\log |u|+C\\ &=\log|\sec x+\tan x|+C \end{align*}
  • The above trick appears both totally unguessable and very hard to remember. Fortunately, there is a simple way
     4 
    We thank Serban Raianu for bringing this to our attention.
    to recover the trick. Here it is.
    • The goal is to guess a function whose derivative is \(\sec x\text{.}\)
    • So get out a table of derivatives and look for functions whose derivatives at least contain \(\sec x\text{.}\) There are two:
      \begin{align*} \diff{}{x}\tan x &= \sec^2 x\\ \diff{}{x}\sec x &= \tan x\,\sec x \end{align*}
    • Notice that if we add these together we get
      \begin{align*} \diff{}{x}\big(\sec x+\tan x\big) &=(\sec x+\tan x)\sec x & \implies\\ \frac{\diff{}{x}\big(\sec x+\tan x\big)}{\sec x+\tan x}&=\sec x \end{align*}
    • We’ve done it! The right hand side is \(\sec x\) and the left hand side is the derivative of \(\log|\sec x+\tan x|\text{.}\)
There is another method for integrating \(\int \sec x\dee{x}\text{,}\) that is more tedious, but more straightforward. In particular, it does not involve a memorized trick. We first use the substitution \(u=\sin x\text{,}\) \(\dee{u}=\cos x\,\dee{x}\text{,}\) together with \(\cos^2 x = 1-\sin^2x=1-u^2\text{.}\) This converts the integral into
\begin{align*} \int \sec x\dee{x} &= \int\frac{1}{\cos x}\dee{x} = \int\frac{\cos x\ \dee{x}}{\cos^2 x} \\ &= \int \frac{\dee{u}}{1-u^2}\bigg|_{u=\sin x} \end{align*}
The integrand \(\frac{1}{1-u^2}\) is a rational function, i.e. a ratio of two polynomials. There is a procedure, called the method of partial fractions, that may be used to integrate any rational function. We shall learn about it in Section 1.10 “Partial Fractions”. The detailed evaluation of the integral \(\int \sec x\,\dee{x}=\int\frac{\dee{u}}{1-u^2}\) by the method of partial fractions is presented in Example 1.10.5 below.
In addition, there is a standard trick for evaluating \(\int\frac{\dee{u}}{1-u^2}\) that allows us to avoid going through the whole partial fractions algorithm.

Example 1.8.20. \(\int \sec x\dee{x}\) — by more trickery.

Solution: We have already seen that
\begin{align*} \int \sec x\dee{x} &= \int \frac{\dee{u}}{1-u^2}\bigg|_{u=\sin x} \end{align*}
The trick uses the obervations that
  • \(\displaystyle \frac{1}{1-u^2}=\frac{1+u-u}{1-u^2}=\frac{1}{1-u}-\frac{u}{1-u^2}\)
  • \(\frac{1}{1-u}\) has antiderivative \(-\log(1-u)\) (for \(u\lt 1\))
  • The derivative \(\diff{}{u}(1-u^2)=-2u\) of the denominator of \(\frac{u}{1-u^2}\) is the same, up to a factor of \(-2\text{,}\) as the numerator of \(\frac{u}{1-u^2}\text{.}\) So we can easily evaluate the integral of \(\frac{u}{1-u^2}\) by substituting \(v=1-u^2\text{,}\) \(\dee{v}=-2u\,\dee{u}\text{.}\)
    \begin{gather*} \int \frac{u\,\dee{u}}{1-u^2} = \int \frac{\frac{\dee{v}}{-2}}{v}\bigg|_{v=1-u^2} =-\frac{1}{2}\log(1-u^2)+C \end{gather*}
Combining these observations gives
\begin{align*} \int \sec x\dee{x} &=\bigg[\int \frac{\dee{u}}{1-u^2}\bigg]_{u=\sin x} =\bigg[\int\frac{1}{1-u}\dee{u} -\int\frac{u}{1-u^2}\dee{u}\bigg]_{u=\sin x}\\ &=\Big[-\log(1-u)+\frac{1}{2}\log(1-u^2)+C\Big]_{u=\sin x}\\ &=-\log(1-\sin x)+\frac{1}{2}\log(1-\sin^2 x)+C\\ &=-\log(1-\sin x)+\frac{1}{2}\log(1-\sin x)+\frac{1}{2}\log(1+\sin x)+C\\ &=\frac{1}{2}\log\frac{1+\sin x}{1-\sin x}+C \end{align*}
Example 1.8.20 has given the answer
\begin{gather*} \int \sec x\dee{x} =\frac{1}{2}\log\frac{1+\sin x}{1-\sin x}+C \end{gather*}
which appears to be different than the answer in Example 1.8.19. But they are really the same since
\begin{align*} &\frac{1+\sin x}{1-\sin x} =\frac{(1+\sin x)^2}{1-\sin^2 x} =\frac{(1+\sin x)^2}{\cos^2 x}\\ \implies\ &\frac{1}{2}\log \frac{1+\sin x}{1-\sin x} =\frac{1}{2}\log\frac{(1+\sin x)^2}{\cos^2 x} =\log\Big|\frac{\sin x+1}{\cos x}\Big| =\log|\tan x+\sec x| \end{align*}
Oof!

Example 1.8.21. \(\int \csc x\dee{x}\) — by the \(u=\tan\frac{x}{2}\) substitution.

Solution: The integral \(\int \csc x\dee{x}\) may also be evaluated by both the methods above. That is either
  • by multiplying the integrand by a cleverly chosen \(1=\frac{\cot x-\csc x}{\cot x-\csc x}\) and then substituting \(u=\cot x -\csc x\text{,}\) \(\dee{u} = (-\csc^2 x+\csc x \cot x)\,\dee{x}\text{,}\) or
  • by substituting \(u=\cos x\text{,}\) \(\dee{u}=-\sin x\,\dee{x}\) to give \(\int \csc x\dee{x}=-\int\frac{\dee{u}}{1-u^2}\) and then using the method of partial fractions.
These two methods give the answers
\begin{gather} \int \csc x\dee{x}=\log|\cot x-\csc x|+C =-\frac{1}{2}\log \frac{1+\cos x}{1-\cos x}+C\tag{✶} \end{gather}
In this example, we shall evaluate \(\int\csc x\dee{x}\) by yet a third method, which can be used to integrate rational functions
 5 
A rational function of \(\sin x\) and \(\cos x\) is a ratio with both the numerator and denominator being finite sums of terms of the form \(a\sin^m x\cos^n x\text{,}\) where \(a\) is a constant and \(m\) and \(n\) are positive integers.
of \(\sin x\) and \(\cos x\text{.}\)
  • This method uses the substitution
    \begin{align*} x&=2\arctan u & \text{i.e. } u &=\tan\frac{x}{2} & \text{and } \dee{x}&=\frac{2}{1+u^2}\dee{u} \end{align*}
    — a half-angle substitution.
  • To express \(\sin x\) and \(\cos x\) in terms of \(u\text{,}\) we first use the double angle trig identities (Equations 1.8.2 and 1.8.3 with \(x \mapsto \frac{x}{2}\)) to express \(\sin x\) and \(\cos x\) in terms of \(\sin\frac{x}{2}\) and \(\cos\frac{x}{2}\text{:}\)
    \begin{align*} \sin x &= 2 \sin\frac{x}{2} \cos\frac{x}{2}\\ \cos x &= \cos^2 \frac{x}{2} - \sin^2\frac{x}{2} \end{align*}
  • We then use the triangle
    to express \(\sin\frac{x}{2}\) and \(\cos\frac{x}{2}\) in terms of \(u\text{.}\) The bottom and right hand sides of the triangle have been chosen so that \(\tan\frac{x}{2}=u\text{.}\) This tells us that
    \begin{align*} \sin \frac{x}{2} &= \frac{u}{\sqrt{1+u^2}} & \cos \frac{x}{2} &= \frac{1}{\sqrt{1+u^2}} \end{align*}
  • This in turn implies that:
    \begin{align*} \sin x&=2\sin\frac{x}{2}\cos\frac{x}{2} =2\frac{u}{\sqrt{1+u^2}}\frac{1}{\sqrt{1+u^2}} =\frac{2u}{1+u^2}\\ \cos x&=\cos^2\frac{x}{2}-\sin^2\frac{x}{2} =\frac{1}{1+u^2}-\frac{u^2}{1+u^2} =\frac{1-u^2}{1+u^2} \end{align*}
    Oof!
  • Let’s use this substitution to evaluate \(\int \csc x\,\dee{x}\text{.}\)
    \begin{align*} \int \csc x\dee{x} &=\int \frac{1}{\sin x}\dee{x} =\int \frac{1+u^2}{2u}\ \frac{2}{1+u^2}\dee{u} =\int \frac{1}{u}\dee{u}\\ &=\log|u|+C =\log\Big|\tan\frac{x}{2}\Big|+C \end{align*}
    To see that this answer is really the same as that in (✶), note that
    \begin{gather*} \cot x-\csc x =\frac{\cos x-1}{\sin x} =\frac{-2\sin^2(x/2)}{2\sin(x/2)\cos(x/2)} =-\tan\frac{x}{2} \end{gather*}

Example 1.8.22. \(\int \sec^3 x\dee{x}\) — by trickery.

Solution: The standard trick used to evaluate \(\int \sec^3 x\dee{x}\) is integration by parts.
  • Set \(u=\sec x\text{,}\) \(\dee{v}=\sec^2 x\dee{x}\text{.}\) Hence \(\dee{u}=\sec x\tan x\dee{x}\text{,}\) \(v=\tan x\) and
    \begin{align*} \int \sec^3 x\dee{x} &=\int \underbrace{\sec x}_{u}\ \underbrace{\sec^2 x\dee{x}}_{\dee{v}}\\ &=\underbrace{\sec x}_{u}\ \underbrace{\tan x}_{v} -\int \underbrace{\tan x}_{v}\ \underbrace{\sec x\tan x\dee{x}}_{\dee{u}} \end{align*}
  • Since \(\tan^2 x+1=\sec^2 x\text{,}\) we have \(\tan^2 x=\sec^2 x-1\) and
    \begin{align*} \int \sec^3 x\dee{x} &=\sec x\ \tan x -\int [\sec^3 x-\sec x]\dee{x}\\ &=\sec x\ \tan x +\log|\sec x+\tan x|+C -\int \sec^3 x\dee{x} \end{align*}
    where we used \(\int \sec x\dee{x} = \log|\sec x+\tan x|+C\text{,}\) which we saw in Example 1.8.19.
  • Now moving the \(\int \sec^3 x\dee{x}\) from the right hand side to the left hand side
    \begin{align*} 2\int \sec^3 x\dee{x} &=\sec x\tan x +\log|\sec x+\tan x|+C & \text{and so}\\ \int \sec^3 x\dee{x} &=\frac{1}{2} \sec x\tan x +\frac{1}{2}\log|\sec x+\tan x|+C \end{align*}
    for a new arbitrary constant \(C\) (which is just one half the old one).
The integral \(\int \sec^3\dee{x}\) can also be evaluated by two other methods.
  • Substitute \(u=\sin x\text{,}\) \(\dee{u}=\cos x\dee{x}\) to convert \(\int\sec^3 x\dee{x}\) into \(\int\frac{\dee{u}}{{[1-u^2]}^2}\) and evaluate the latter using the method of partial fractions. This is done in Example 1.10.6 in Section 1.10.
  • Use the \(u=\tan\frac{x}{2}\) substitution. We use this method to evaluate \(\int\csc^3 x\dee{x}\) in Example 1.8.23, below.

Example 1.8.23. \(\int \csc^3 x\dee{x}\) – by the \(u=\tan\frac{x}{2}\) substitution.

Solution: Let us use the half-angle substitution that we introduced in Example 1.8.21.
  • In this method we set
    \begin{align*} u&=\tan\frac{x}{2} \quad \dee{x}=\frac{2}{1+u^2} \dee{u}\quad \sin x=\frac{2u}{1+u^2} \quad \cos x=\frac{1-u^2}{1+u^2} \end{align*}
  • The integral then becomes
    \begin{align*} \int \csc^3 x\dee{x} &=\int \frac{1}{\sin^3 x}\dee{x}\\ &=\int {\Big(\frac{1+u^2}{2u}\Big)}^3\ \frac{2}{1+u^2}\dee{u}\\ &=\frac{1}{4}\int \frac{1+2u^2+u^4}{u^3}\dee{u}\\ &=\frac{1}{4}\Big\{\frac{u^{-2}}{-2}+2\log|u|+\frac{u^2}{2}\Big\}+C\\ &=\frac{1}{8}\Big\{-\cot^2\frac{x}{2}+4\log\Big|\tan\frac{x}{2}\Big| +\tan^2\frac{x}{2}\Big\}+C \end{align*}
    Oof!
  • This is a perfectly acceptable answer. But if you don’t like the \(\frac{x}{2}\)’s, they may be eliminated by using
    \begin{align*} \tan^2\frac{x}{2}-\cot^2\frac{x}{2} &=\frac{\sin^2\frac{x}{2}}{\cos^2\frac{x}{2}} -\frac{\cos^2\frac{x}{2}}{\sin^2\frac{x}{2}}\\ &=\frac{\sin^4\frac{x}{2}-\cos^4\frac{x}{2}} {\sin^2\frac{x}{2}\cos^2\frac{x}{2}}\\ &=\frac{\big(\sin^2\frac{x}{2}-\cos^2\frac{x}{2}\big) \big(\sin^2\frac{x}{2}+\cos^2\frac{x}{2}\big)} {\sin^2\frac{x}{2}\cos^2\frac{x}{2}}\\ &=\frac{\sin^2\frac{x}{2}-\cos^2\frac{x}{2}} {\sin^2\frac{x}{2}\cos^2\frac{x}{2}} \qquad \text{since $\sin^2\frac{x}{2}+\cos^2\frac{x}{2}=1$}\\ &=\frac{-\cos x}{\frac{1}{4}\sin^2x} \qquad\qquad\quad \text{by }\knowl{./knowl/xref/eq_TRGINTtrigidentityB.html}{\text{1.8.2}}\text{ and }\knowl{./knowl/xref/eq_TRGINTtrigidentityC.html}{\text{1.8.3}} \end{align*}
    and
    \begin{align*} \tan\frac{x}{2} &=\frac{\sin\frac{x}{2}}{\cos\frac{x}{2}} =\frac{\sin^2\frac{x}{2}} {\sin\frac{x}{2}\cos\frac{x}{2}}\\ &=\frac{\frac{1}{2}[1-\cos x]}{\frac{1}{2}\sin x} \qquad\qquad\qquad \text{by }\knowl{./knowl/xref/eq_TRGINTtrigidentityB.html}{\text{1.8.2}}\text{ and }\knowl{./knowl/xref/eq_TRGINTtrigidentityC.html}{\text{1.8.3}} \end{align*}
    So we may also write
    \begin{gather*} \int \csc^3 x\dee{x} =-\frac{1}{2}\cot x\csc x +\frac{1}{2}\log|\csc x-\cot x|+C \end{gather*}
That last optional section was a little scary — let’s get back to something a little easier.

Exercises 1.8.4 Exercises

Recall that we are using \(\log x\) to denote the logarithm of \(x\) with base \(e\text{.}\) In other courses it is often denoted \(\ln x\text{.}\)

Exercises — Stage 1 .

1.
Suppose you want to evaluate \(\displaystyle\int_0^{\pi/4} \sin x \cos^n x \dee{x}\) using the substitution \(u=\cos x\text{.}\) Which of the following need to be true for your substitution to work?
  1. \(n\) must be even
  2. \(n\) must be odd
  3. \(n\) must be an integer
  4. \(n\) must be positive
  5. \(n\) can be any real number
2.
Evaluate \(\displaystyle\int \sec^n x \tan x \dee{x}\text{,}\) where \(n\) is a strictly positive integer.
3.
Derive the identity \(\tan^2 x +1 = \sec^2 x\) from the easier-to-remember identity \(\sin^2x+\cos^2 x =1\text{.}\)

Exercises — Stage 2 .

Questions 4 through 10 deal with powers of sines and cosines. Review Section 1.8.1 in the notes for integration strategies.
Questions 12 through 21 deal with powers of tangents and secants. Review Section 1.8.2 in the notes for strategies.
4. (✳).
Evaluate \(\displaystyle\int\cos^3x\,\dee{x}\text{.}\)
5. (✳).
Evaluate \(\displaystyle\int_0^\pi\cos^2x\,\dee{x}\text{.}\)
6. (✳).
Evaluate \(\displaystyle\int\sin^{36}t\,\cos^3t\,\dee{t}\text{.}\)
7.
Evaluate \(\displaystyle\int \dfrac{\sin^3 x}{\cos ^4 x} \dee{x}\text{.}\)
8.
Evaluate \(\displaystyle\int_0^{\pi/3} \sin^{4}x \dee{x}\text{.}\)
9.
Evaluate \(\displaystyle\int \sin^{5}x \dee{x}\text{.}\)
10.
Evaluate \(\displaystyle\int \sin^{1.2}x\cos x \dee{x}\text{.}\)
11.
Evaluate \(\displaystyle\int \tan x \sec^2 x \dee{x}\text{.}\)
12. (✳).
Evaluate \(\displaystyle\int \tan^3 x \sec^5x \,\dee{x}\text{.}\)
13. (✳).
Evaluate \(\displaystyle\int\sec^4x\,\tan^{46}x\,\dee{x}\text{.}\)
14.
Evaluate \(\displaystyle\int \tan^3 x \sec^{1.5} x \dee{x}\text{.}\)
15.
Evaluate \(\displaystyle\int \tan^3x\sec^2x \dee{x}\text{.}\)
16.
Evaluate \(\displaystyle\int \tan^4 x \sec^2 x \dee{x}\text{.}\)
17.
Evaluate \(\displaystyle\int \tan^3 x \sec^{-0.7}x \dee{x}\text{.}\)
18.
Evaluate \(\displaystyle\int \tan^5 x \dee{x}\text{.}\)
19.
Evaluate \(\displaystyle\int_0^{\pi/6} \tan^6 x \dee{x}\text{.}\)
20.
Evaluate \(\displaystyle\int_0^{\pi/4} \tan^8 x \sec^4 x \dee{x}\text{.}\)
21.
Evaluate \(\displaystyle\int \tan x \sqrt{\sec x} \dee{x}\text{.}\)
22.
Evaluate \(\displaystyle\int \sec^{8}\theta \tan^{e}\theta \dee{\theta}\text{.}\)

Exercises — Stage 3 .

23. (✳).
A reduction formula.
  1. Let \(n\) be a positive integer with \(n\ge 2\text{.}\) Derive the reduction formula
    \begin{equation*} \int\tan^n(x)\,\dee{x}=\frac{\tan^{n-1}(x)}{n-1} -\int\tan^{n-2}(x)\,\dee{x}. \end{equation*}
  2. Calculate \(\displaystyle\int_0^{\pi/4}\tan^6(x)\,\dee{x}\text{.}\)
24.
Evaluate \(\displaystyle\int \tan^5 x \cos^2 x \dee{x}\text{.}\)
25.
Evaluate \(\displaystyle\int \frac{1}{\cos^2 \theta}\dee{\theta}\text{.}\)
26.
Evaluate \(\displaystyle\int \cot x\dee{x}\text{.}\)
27.
Evaluate \(\displaystyle\int e^x\sin(e^x)\cos(e^x) \dee{x}\text{.}\)
28.
Evaluate \(\displaystyle\int \sin(\cos x)\sin^3 x \dee{x}\text{.}\)
29.
Evaluate \(\displaystyle\int x\sin x \cos x \dee{x}\text{.}\)