1.8: Trigonometric Integrals
( \newcommand{\kernel}{\mathrm{null}\,}\)
Integrals of polynomials of the trigonometric functions sinx, cosx, tanx 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 of trigonometric identities, but usually we use only a handful of them. The most important three are:
sin2x+cos2x=1
sin(2x)=2sinxcosx
cos(2x)=cos2x−sin2x=2cos2x−1=1−2sin2x
Notice that the last two lines of Equation 1.8.3 follow from the first line by replacing either sin2x or cos2x using Equation 1.8.1. It is also useful to rewrite these last two lines:
sin2x=1−cos(2x)2
cos2x=1+cos(2x)2
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:
sin4(x)=[1−cos(2x)2]2by Equation 1.8.4=14−12cos(2x)+14cos2(2x)⏟do it againuse Equation 1.8.5=14−12cos(2x)+18(1+cos(4x))=38−12cos(2x)+18cos(4x)
So while it was hard to integrate sin4(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
∫sinmxcosnxdxand∫tanmxsecnxdx
for integer n,m. The details of the technique depend on the parity of n and m — that is, whether n and m are even or odd numbers.
Integrating ∫sinmxcosnxdx
One of n and m is odd
Consider the integral ∫sin2xcosxdx. We can integrate this by substituting u=sinx and du=cosxdx. This gives
∫sin2xcosxdx=∫u2du=13u3+C=13sin3x+C
This method can be used whenever n is an odd integer.
- Substitute u=sinx and du=cosxdx.
- This leaves an even power of cosines — convert them using cos2x=1−sin2x=1−u2.
Here is an example.
Start by factoring off one power of cosx to combine with dx to get cosxdx=du.
∫sin2xcos3xdx=∫sin2x⏟=u2cos2x⏟=1−u2 cosxdx⏟=duset u=sinx=∫u2 (1−u2)du=u33−u55+C=sin3x3−sin5x5+C
Of course if m is an odd integer we can use the same strategy with the roles of sinx and cosx exchanged. That is, we substitute u=cosx, du=−sinxdx and sin2x=1−cos2x=1−u2.
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.
By 1.8.5
∫cos2xdx=12∫[1+cos(2x)]dx=12[x+12sin(2x)]+C
First we'll prepare the integrand cos4x for easy integration by applying 1.8.5 a couple times. We have already used 1.8.5 once to get
cos2x=12[1+cos(2x)]
Squaring it gives
cos4x=14[1+cos(2x)]2=14+12cos(2x)+14cos2(2x)
Now by 1.8.5 a second time
cos4x=14+12cos(2x)+14 1+cos(4x)2=38+12cos(2x)+18cos(4x)
Now it's easy to integrate
∫cos4xdx=38∫dx+12∫cos(2x)dx+18∫cos(4x)dx=38x+14sin(2x)+132sin(4x)+C
Here we apply both 1.8.4 and 1.8.5.
∫cos2xsin2xdx=14∫[1+cos(2x)][1−cos(2x)]dx=14∫[1−cos2(2x)]dxWe can then apply 1.8.5 again
=14∫[1−12(1+cos(4x))]dx=18∫[1−cos(4x)]dx=18x−132sin(4x)+COof! We could also have done this one using 1.8.2 to write the integrand as sin2(2x) and then used 1.8.4 to write it in terms of cos(4x).
Of course we can compute the definite integral ∫π0cos2xdx by using the antiderivative for cos2x that we found in Example 1.8.7. But here is a trickier way to evaluate that integral, and also the integral ∫π0sin2xdx at the same time, very quickly without needing the antiderivative of Example 1.8.7.
Solution
- Observe that ∫π0cos2xdx and ∫π0sin2xdx 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,
∫π0cos2xdx=∫π0sin2xdx=12[∫π0sin2xdx+∫π0cos2xdx]=12∫π0[sin2x+cos2x]dx=12∫π0dx=π2
Integrating ∫tanmxsecnxdx
The strategy for dealing with these integrals is similar to the strategy that we used to evaluate integrals of the form ∫sinmxcosnxdx and again depends on the parity of the exponents n and m. It uses 2
ddxtanx=sec2xddxsecx=secxtanx1+tan2x=sec2x
We split the methods for integrating ∫tanmxsecnxdx 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 sinx and cosx:
tanmxsecnxdx=(sinxcosx)m(1cosx)ndx=sinm−1xcosn+mx sinxdx
and then substitute u=cosx, du=−sinxdx, sin2x=1−cos2x=1−u2. See Examples 1.8.11 and 1.8.12. - Alternatively, if m is odd and n≥1 move one factor of secxtanx to the side so that you can see secxtanxdx in the integral, and substitute u=secx, du=secxtanxdx and tan2x=sec2x−1=u2−1. See Example 1.8.13.
- If n is even with n≥2, move one factor of sec2x to the side so that you can see sec2xdx in the integral, and substitute u=tanx, du=sec2xdx and sec2x=1+tan2x=1+u2. 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=tanx substitution, after using tan2x=sec2x−1 (possibly more than once) to create a sec2x. 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 secx, cscx, sec3x and csc3x”, below. A more straight forward strategy uses another technique called “partial fractions”. 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.
m is odd — odd power of tangent
In this case we rewrite the integrand in terms of sine and cosine and then substitute u=cosx,du=−sinxdx.
Solution
- Write the integrand tanx=1cosxsinx.
- Now substitute u=cosx, du=−sinxdx just as we did in treating integrands of the form sinmxcosnx with m odd.
∫tanxdx=∫1cosxsinxdxsubstitute u=cosx=∫1u⋅(−1)du=−log|u|+C=−log|cosx|+Ccan also write in terms of secant=log|cosx|−1+C=log|secx|+C
Solution
- Write the integrand tan3x=sin2xcos3xsinx.
- Again substitute u=cosx, du=−sinxdx. We rewrite the remaining even powers of sinx using sin2x=1−cos2x=1−u2.
- Hence
∫tan3xdx=∫sin2xcos3xsinxdxsubstitute u=cosx=∫1−u2u3(−1)du=u−22+log|u|+C=12cos2x+log|cosx|+Crewrite in terms of secant=12sec2x−log|secx|+C
m is odd and n≥1 — odd power of tangent and at least one secant
Here we collect a factor of tanxsecx and then substitute u=secx and du=secxtanxdx. We can then rewrite any remaining even powers of tanx in terms of secx using tan2x=sec2x−1=u2−1.
Solution
- Start by factoring off one copy of secxtanx and combine it with dx to form secxtanxdx, which will be du.
- Now substitute u=secx, du=secxtanxdx and tan2x=sec2x−1=u2−1.
- This gives
∫tan3xsec4xdx=∫tan2x⏟u2−1 sec3x⏟u3 secxtanxdx⏟du=∫[u2−1]u3du=u66−u44+C=16sec6x−14sec4x+C
n≥2 is even — a positive even power of secant
In the previous case we substituted u=secx, while in this case we substitute u=tanx. When we do this we write du=sec2xdx and then rewrite any remaining even powers of secx as powers of tanx using sec2x=1+tan2x=1+u2.
Solution
- Factor off one copy of sec2x and combine it with dx to form sec2xdx, which will be du.
- Then substitute u=tanx, du=sec2xdx and rewrite any remaining even powers of secx as powers of tanx=u using sec2x=1+tan2x=1+u2.
- This gives
∫sec4xdx=∫sec2x⏟1+u2 sec2xdx⏟du=∫[1+u2]du=u+u33+C=tanx+13tan3x+C
Solution
Let us revisit this example using this slightly different approach.
- Factor off one copy of sec2x and combine it with dx to form sec2xdx, which will be du.
- Then substitute u=tanx, du=sec2xdx and rewrite any remaining even powers of secx as powers of tanx=u using sec2x=1+tan2x=1+u2.
- This gives
∫tan3xsec4xdx=∫tan3x⏟u3sec2x⏟1+u2 sec2xdx⏟du=∫[u3+u5]du=u44+u66+C=14tan4x+16tan6x+C
- 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=secx and tan2x=sec2x−1=v2−1:
16tan6x+14tan4x=16(v2−1)3+14(v2−1)2=16(v6−3v4+3v2−1)+14(v4−2v2+1)=v66−v42+v22−16+v44−v22+14=v66−v44+0⋅v2+(14−16)=16sec6x−14sec4x+112.
So while 16tan6x+14tan4x≠16sec6x−14sec4x, they only differ by a constant. Hence both are valid antiderivatives of tan3xsec4x.
m is even and n=0 — even powers of tangent
We integrate this by setting u=tanx. For this to work we need to pull one factor of sec2x to one side to form du=sec2xdx. To find this factor of sec2x we (perhaps repeatedly) apply the identity tan2x=sec2x−1.
Solution
- There is no sec2x term present, so we try to create it from tan4x by using tan2x=sec2x−1.
tan4x=tan2x⋅tan2x=tan2x[sec2x−1]=tan2xsec2x−tan2x⏟sec2x−1=tan2xsec2x−sec2x+1
- Now we can substitute u=tanx, du=sec2xdx.
∫tan4xdx=∫tan2x⏟u2 sec2xdx⏟du−∫sec2xdx⏟du+∫dx=∫u2du−∫du+∫dx=u33−u+x+C=tan3x3−tanx+x+C
Solution
Let us try the same approach.
- First pull out a factor of tan2x to create a sec2x factor: tan8x=tan6x⋅tan2x=tan6x⋅[sec2x−1]=tan6xsec2x−tan6x
The first term is now ready to be integrated, but we need to reapply the method to the second term:
=tan6xsec2x−tan4x⋅[sec2x−1]=tan6xsec2x−tan4xsec2x+tan4xdo it again=tan6xsec2x−tan4xsec2x+tan2x⋅[sec2x−1]=tan6xsec2x−tan4xsec2x+tan2xsec2x−tan2xand again=tan6xsec2x−tan4xsec2x+tan2xsec2x−[sec2x−1] - Hence
∫tan8xdx=∫[tan6xsec2x−tan4xsec2x+tan2xsec2x−sec2x+1]dx=∫[tan6x−tan4x+tan2x−1]sec2xdx+∫dx=∫[u6−u4+u2−1]du+x+C=u77−u55+u33−u+x+C=17tan7x−15tan5x+13tan3x−tanx+x+C
Indeed this example suggests that for integer k≥0:
∫tan2kxdx=12k−1tan2k−1(x)−12k−3tan2k−3x+⋯−(−1)ktanx+(−1)kx+C
This last example also shows how we might integrate an odd power of tangent:
Solution
We follow the same steps
- Pull out a factor of tan2x to create a factor of sec2x:
tan7x=tan5x⋅tan2x=tan5x⋅[sec2x−1]=tan5xsec2x−tan5xdo it again=tan5xsec2x−tan3x⋅[sec2x−1]=tan5xsec2x−tan3xsec2x+tan3xand again=tan5xsec2x−tan3xsec2x+tanx[sec2x−1]=tan5xsec2x−tan3xsec2x+tanxsec2x−tanx
- Now we can substitute u=tanx and du=sec2xdx and also use the result from Example 1.8.11 to take care of the last term: ∫tan7xdx=∫[tan5xsec2x−tan3xsec2x+tanxsec2x]dx−∫tanxdx
Now factor out the common sec2x term and integrate tanx via Example 1.8.11
=∫[tan5x−tan3x+tanx]secxdx−log|secx|+C=∫[u5−u3+u]du−log|secx|+C=u66−u44+u22−log|secx|+C=16tan6x−14tan4x+12tan2x−log|secx|+C
This example suggests that for integer k≥0:
∫tan2k+1xdx=12ktan2k(x)−12k−2tan2k−2x+⋯−(−1)k12tan2x+(−1)klog|secx|+C
Of course we have not considered integrals involving powers of cotx and cscx. But they can be treated in much the same way as tanx and secx were.
Optional — Integrating secx, cscx, sec3x and csc3x
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.
Solution
There is a very sneaky trick to compute this integral.
- The standard trick for this integral is to multiply the integrand by 1=secx+tanxsecx+tanx
secx=secx secx+tanxsecx+tanx=sec2x+secxtanxsecx+tanx
- Notice now that the numerator of this expression is exactly the derivative its denominator. Hence we can substitute u=secx+tanx and du=(secxtanx+sec2x)dx.
- Hence
∫secxdx=∫secx secx+tanxsecx+tanxdx=∫sec2x+secxtanxsecx+tanxdx=∫1udu=log|u|+C=log|secx+tanx|+C
- The above trick appears both totally unguessable and very hard to remember. Fortunately, there is a simple way 3 to recover the trick. Here it is.
- The goal is to guess a function whose derivative is secx.
- So get out a table of derivatives and look for functions whose derivatives at least contain secx. There are two:
ddxtanx=sec2xddxsecx=tanxsecx
- Notice that if we add these together we get
ddx(secx+tanx)=(secx+tanx)secx⟹ddx(secx+tanx)secx+tanx=secx
- We've done it! The right hand side is secx and the left hand side is the derivative of log|secx+tanx|.
There is another method for integrating ∫secxdx, that is more tedious, but more straight forward. In particular, it does not involve a memorized trick. We first use the substitution u=sinx, du=cosxdx, together with cos2x=1−sin2x=1−u2. This converts the integral into
∫secxdx=∫1cosxdx=∫cosx dxcos2x=∫du1−u2|u=sinx
The integrand 11−u2 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 ∫secxdx=∫du1−u2 by the method of partial fractions is presented in Example 1.10.5 below.
In addition, there is a standard trick for evaluating ∫du1−u2 that allows us to avoid going through the whole partial fractions algorithm.
Solution
We have already seen that
∫secxdx=∫du1−u2|u=sinx
The trick uses the obervations that
- 11−u2=1+u−u1−u2=11−u−u1−u2
- 11−u has antiderivative −log(1−u) (for u<1)
- The derivative ddu(1−u2)=−2u of the denominator of u1−u2 is the same, up to a factor of −2, as the numerator of u1−u2. So we can easily evaluate the integral of u1−u2 by substituting v=1−u2, dv=−2udu.
∫udu1−u2=∫dv−2v|v=1−u2=−12log(1−u2)+C
Combining these observations gives
∫secxdx=[∫du1−u2]u=sinx=[∫11−udu−∫u1−u2du]u=sinx=[−log(1−u)+12log(1−u2)+C]u=sinx=−log(1−sinx)+12log(1−sin2x)+C=−log(1−sinx)+12log(1−sinx)+12log(1+sinx)+C=12log1+sinx1−sinx+C
Example 1.8.20 has given the answer
∫secxdx=12log1+sinx1−sinx+C
which appears to be different than the answer in Example 1.8.19. But they are really the same since
1+sinx1−sinx=(1+sinx)21−sin2x=(1+sinx)2cos2x⟹ 12log1+sinx1−sinx=12log(1+sinx)2cos2x=log|sinx+1cosx|=log|tanx+secx|
Oof!
Solution
The integral ∫cscxdx may also be evaluated by both the methods above. That is either
- by multiplying the integrand by a cleverly chosen 1=cotx−cscxcotx−cscx and then substituting u=cotx−cscx, du=(−csc2x+cscxcotx)dx, or
- by substituting u=cosx, du=−sinxdx to give ∫cscxdx=−∫du1−u2 and then using the method of partial fractions.
These two methods give the answers
∫cscxdx=log|cotx−cscx|+C=−12log1+cosx1−cosx+C
In this example, we shall evaluate ∫cscxdx by yet a third method, which can be used to integrate rational functions 4 A rational function of sinx and cosx is a ratio with both the numerator and denominator being finite sums of terms of the form asinmxcosnx, where a is a constant and m and n are positive integers. of sinx and cosx.
- This method uses the substitution
x=2arctanui.e. u=tanx2and dx=21+u2du
— a half-angle substitution. - To express sinx and cosx in terms of u, we first use the double angle trig identities (Equations 1.8.2 and 1.8.3 with x↦x2) to express sinx and cosx in terms of sinx2 and cosx2:
sinx=2sinx2cosx2cosx=cos2x2−sin2x2
- We then use the triangle
to express sinx2 and cosx2 in terms of u. The bottom and right hand sides of the triangle have been chosen so that tanx2=u. This tells us that
sinx2=u√1+u2cosx2=1√1+u2
- This in turn implies that:
sinx=2sinx2cosx2=2u√1+u21√1+u2=2u1+u2cosx=cos2x2−sin2x2=11+u2−u21+u2=1−u21+u2
Oof! - Let's use this substitution to evaluate ∫cscxdx.
∫cscxdx=∫1sinxdx=∫1+u22u 21+u2du=∫1udu=log|u|+C=log|tanx2|+C
To see that this answer is really the same as that in (⋆), note thatcotx−cscx=cosx−1sinx=−2sin2(x/2)2sin(x/2)cos(x/2)=−tanx2
Solution
The standard trick used to evaluate ∫sec3xdx is integration by parts.
- Set u=secx, dv=sec2xdx. Hence du=secxtanxdx, v=tanx and
∫sec3xdx=∫secx⏟u sec2xdx⏟dv=secx⏟u tanx⏟v−∫tanx⏟v secxtanxdx⏟du
- Since tan2x+1=sec2x, we have tan2x=sec2x−1 and
∫sec3xdx=secx tanx−∫[sec3x−secx]dx=secx tanx+log|secx+tanx|+C−∫sec3xdx
where we used ∫secxdx=log|secx+tanx|+C, which we saw in Example 1.8.19. - Now moving the ∫sec3xdx from the right hand side to the left hand side
2∫sec3xdx=secxtanx+log|secx+tanx|+Cand so∫sec3xdx=12secxtanx+12log|secx+tanx|+C
for a new arbitrary constant C (which is just one half the old one).
The integral ∫sec3dx can also be evaluated by two other methods.
- Substitute u=sinx, du=cosxdx to convert ∫sec3xdx into ∫du[1−u2]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=tanx2 substitution. We use this method to evaluate ∫csc3xdx in Example 1.8.23, below.
Solution
Let us use the half-angle substitution that we introduced in Example 1.8.21.
- In this method we set
u=tanx2dx=21+u2dusinx=2u1+u2cosx=1−u21+u2
- The integral then becomes
∫csc3xdx=∫1sin3xdx=∫(1+u22u)3 21+u2du=14∫1+2u2+u4u3du=14{u−2−2+2log|u|+u22}+C=18{−cot2x2+4log|tanx2|+tan2x2}+C
Oof! - This is a perfectly acceptable answer. But if you don't like the x2's, they may be eliminated by using
tan2x2−cot2x2=sin2x2cos2x2−cos2x2sin2x2=sin4x2−cos4x2sin2x2cos2x2=(sin2x2−cos2x2)(sin2x2+cos2x2)sin2x2cos2x2=sin2x2−cos2x2sin2x2cos2x2since sin2x2+cos2x2=1=−cosx14sin2xby 1.8.2 and 1.8.3
andtanx2=sinx2cosx2=sin2x2sinx2cosx2=12[1−cosx]12sinxby \knowl./knowl/eqTRGINTtrigidentityB.html1.8.2 and \knowl./knowl/eqTRGINTtrigidentityC.html1.8.3
So we may also write∫csc3xdx=−12cotxcscx+12log|cscx−cotx|+C
That last optional section was a little scary — let's get back to something a little easier.
Exercises
Recall that we are using logx to denote the logarithm of x with base e. In other courses it is often denoted lnx.
Stage 1
Suppose you want to evaluate ∫π/40sinxcosnxdx using the substitution u=cosx. 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
Evaluate ∫secnxtanxdx, where n is a strictly positive integer.
Derive the identity tan2x+1=sec2x from the easier-to-remember identity sin2x+cos2x=1.
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.
Evaluate ∫cos3xdx.
Evaluate ∫π0cos2xdx.
Evaluate ∫sin36tcos3tdt.
Evaluate ∫sin3xcos4xdx.
Evaluate ∫π/30sin4xdx.
Evaluate ∫sin5xdx.
Evaluate ∫sin1.2xcosxdx.
Evaluate ∫tanxsec2xdx.
Evaluate ∫tan3xsec5xdx.
Evaluate ∫sec4xtan46xdx.
Evaluate ∫tan3xsec1.5xdx.
Evaluate ∫tan3xsec2xdx.
Evaluate ∫tan4xsec2xdx.
Evaluate ∫tan3xsec−0.7xdx.
Evaluate ∫tan5xdx.
Evaluate ∫π/60tan6xdx.
Evaluate ∫π/40tan8xsec4xdx.
Evaluate ∫tanx√secxdx.
Evaluate ∫sec8θtaneθdθ.
Stage 3
A reduction formula.
- Let n be a positive integer with n≥2. Derive the reduction formula
∫tann(x)dx=tann−1(x)n−1−∫tann−2(x)dx.
- Calculate ∫π/40tan6(x)dx.
Evaluate ∫tan5xcos2xdx.
Evaluate ∫1cos2θdθ.
Evaluate ∫cotxdx.
Evaluate ∫exsin(ex)cos(ex)dx.
Evaluate ∫sin(cosx)sin3xdx.
Evaluate ∫xsinxcosxdx.
- The more pedantic reader could construct an infinite list of them.
- You will need to memorise the derivatives of tangent and secant. However there is no need to memorise 1+tan2x=sec2x. To derive it very quickly just divide sin2x+cos2x=1 by cos2x.
- We thank Serban Raianu for bringing this to our attention.