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:
Equation1.8.1.
\begin{align*}
\sin^2 x +\cos^2 x &= 1
\end{align*}
Equation1.8.2.
\begin{align*}
\sin(2x)&=2\sin x\cos x
\end{align*}
Equation1.8.3.
\begin{align*}
\cos(2x)&=\cos^2 x - \sin^2 x\\
&=2\cos^2 x - 1\\
&=1-2\sin^2 x
\end{align*}
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:
Equation1.8.4.
\begin{align*}
\sin^2 x &= \frac{1-\cos(2x)}{2}
\end{align*}
Equation1.8.5.
\begin{align*}
\cos^2 x &= \frac{1+\cos(2x)}{2}
\end{align*}
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:
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.
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
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{.}\)
Subsubsection1.8.1.2Both \(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.
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{.}\)
Example1.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.
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).
When \(m\) is odd and any \(n\) — rewrite the integrand in terms of \(\sin x\) and \(\cos x\text{:}\)
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.
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.
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.
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.
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.
Subsubsection1.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{.}\)
Example1.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.
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{.}\)
Subsubsection1.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{.}\)
Example1.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{.}\)
Subsubsection1.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{.}\)
Example1.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*}
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 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{:}\)
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{.}\)
Subsubsection1.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{.}\)
Example1.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{.}\)
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.
Subsection1.8.3Optional — 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.
Example1.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}\)
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{.}\)
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
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.
Example1.8.20.\(\int \sec x\dee{x}\) — by more trickery.
\(\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{.}\)
Example1.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.
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
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.
Example1.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.
That last optional section was a little scary — let’s get back to something a little easier.
Exercises1.8.4Exercises
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?
\(n\) must be even
\(n\) must be odd
\(n\) must be an integer
\(n\) must be positive
\(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.