# Integrals Involving Trig Functions

## Related calculator: Integral (Antiderivative) Calculator with Steps

Integration by Parts and Substitution Rule will not help if we directly apply them to integrals like `int cos^5(x)dx`. Because if `u=cos(x)` then `du=sin(x)dx`. In order to integrate powers of cosine, we would need an extra `sin(x)` factor. Similarly, a power of sine would require an extra `cos(x)` factor. Thus, here we separate one cosine factor and convert the remaining factor to the expression involving sine.

**Example 1.** Find `int cos^5(x)dx`.

Rewrite integral as `int (cos^2(x))^2cos(x)dx` . Now take advantage of the trigonometric identity `cos^2(x)=1-sin^2(x)`.

Integral can be rewritten as `int (1-sin^2(x))^2cos(x)dx`. Now substitution `u=sin(x)` will work, because `du=cos(x)dx` and cosine term will disappear.

`int (1-sin^2(x))^2 cos(x)dx=int (1-u^2)^2du=int (1-2u^2+u^4)du= `

`=u-2/3 u^3+1/5 u^5+C=sin(x)-2/3 sin^3(x)+1/5 sin^5(x)+C`.

**Example 2.** Find `int cos^4(x)sin^3(x)dx` .

Here we apply same technique: since exponent of sine is odd, we strip out one sine.

`int cos^4(x)sin^3(x)dx=int cos^4(x)sin^2(x)sin(x)dx=int cos^4(x)(1-cos^2(x))sin(x)dx`.

Let `u=cos(x)` then `du=-sin(x)dx` or `-du=sin(x)dx`.

So, integral can be rewritten as `int u^4 (1-u^2)(-du)=int (u^6-u^4)du=1/7 u^7-1/5 u^5+C=`

`=1/7 cos^7(x)-1/5 cos^5(x)+C`.

Let's summarize this strategy. Suppose you have integral `int sin^(n)(x)cos^m(x)dx` . If `n` is odd you strip out one sine, convert the rest of expression to the expression containing cosines and make substitution `u=cos(x)`. Similarly if `m` is odd you strip out one cosine, convert the rest of expression tothe expression containing sines and make substitution `u=sin(x)`. If both `m` and `n` are odd, you can choose either method.

However, this strategy fails if both `m` and `n` are even. In this case you should use double angle formulas:

**Example 3.** Evaluate `int sin^4(x)cos^2(x)dx`.

Rewriting integral and using double angle formulas yields `int sin^4(x)cos^2(x)dx=int (sin^2(x))^2cos^2(x)dx=int (1/2(1-cos(2x)))^2 * 1/2 (1+cos(2x))dx=`

`=1/8 int (1-2cos(2x)+cos^2(2x))(1+cos(2x))dx=1/8 int (1-cos(2x)-cos^2(2x)+cos^3(2x))dx=`

Now, use double and triple angle formulas for cosine.

`=1/8 int (1-cos(2x)-1/2 (1+cos(4x))+1/4 (cos(6x)+3cos(2x)))dx=`

`=1/32 int (2-cos(2x)-2cos(4x)+cos(6x))dx=`

`=1/32 (2x-1/2 sin(2x)-1/2 sin(4x)+1/6 sin(6x))+C` .

Note, that we could integrate `cos^3(2x)` without using triple angle formula, we could use technique for odd powers.

In general if we have products of sines and cosines in which both exponents are even we will need to use double angle formulas at least once to obtain expression that we can integrate. The larger the exponents the more times we well need to use the formulas and hence problem becomes messier.

Sometimes, we will run into cases when we have product of sines or cosines with different arguments. In this case we need formulas to convert product into sum.

**Example 4.** Find `int sin(3x)sin(8x)dx`.

`int sin(3x)sin(8x)dx=1/2 int (cos(3x-8x)-cos(3x+8x))dx=1/2 int (cos(-5x)-cos(11x))dx=`

`=1/2 int (cos(5x)-cos(11x))dx=1/2 (1/5 sin(5x)-1/11 sin(11x))`.

Now, let's switch attention to products of secants and tangents.

All of the above techniques with small changes can be applied to such integrals.

Trigonometric identity states that `cos^2(x)+sin^2(x)=1`. Dividing both sides by `cos^2(x)` gives `1+tan^2(x)=sec^2(x)`.

If we use substitution `u=tan(x)` then `du=sec^2(x)dx`. If we use substitution `u=sec(x)` then `du=sec(x)tan(x)dx` .

Let's summarize this. Consider integral `int tan^n(x)sec^m(x)dx`.

If `m` is even then we can strip out 2 secants, convert the rest into tangents and use substitution `u=tan(x)`.

If `n` is odd and we have at least one secant then we can strip out one secant and one tangent, convert rest of expression into secants and use substitution `u=sec(x)`.

If above two conditions hold simultaneously, we can use either method. But it is easier to convert term with the smallest exponent.

**Example 5.** Evaluate `int sec^9(x)tan^3(x)dx`.

Rewrite integral `int sec^8(x)tan^2(x)sec(x)tan(x)dx=int sec^8(x)(sec^2(x)-1)sec(x)tan(x)dx`.

Make substitution `u=sec(x)` then `du=sec(x)tan(x)dx`.

And integral can be rewritten as `int u^8 (u^2-1)du=int (u^10-u^8)du=1/11 u^11-1/9 u^9+C=`

`=1/11 sec^11(x)-1/9 sec^9(x)+C`.

**Example 6.** Evaluate `int sec^4(x)tan^4(x)dx`.

Power of secant is even, so strip out two secants and rewrite remaining secants in terms of tangents:

`int sec^2(x)tan^4(x)sec^2(x)dx=int (1+tan^2(x))tan^4(x)sec^2(x)dx`.

Let `u=tan(x)` then `du=sec^2(x)dx` , so integral can be rewritten as

`int (1+u^2)u^4 du=int (u^6+u^4)du=1/7 u^7+1/5 u^5+C=1/7 tan^7(x)+1/5 tan^5(x)+C`.

Note, that there are a couple of exceptions to above rules and all these cases should be integrated differently.

Let's see how to handle situtations when power of tangent is odd, and there is no secant.

**Example 7.** `int tan(x)dx`

Recall that `tan(x)=sin(x)/cos(x)`, so substitution `u=cos(x)` works. In this case `du=-sin(x)dx` or `sin(x)dx=-du`.

So, `int tan(x)dx=int (sin(x))/(cos(x))dx=int 1/u (-du)=-ln|u|+C=-ln|cos(x)|+C=`

`=ln|sec(x)|+C` .

**Example 8.** Find `int tan^3(x)dx`.

To solve such integrands we need to manipulate integrand:

`int tan^3(x)dx=int tan(x)tan^2(x)dx=int tan(x)(sec^2(x)-1)dx=`

`=int tan(x)sec^2(x)dx-int tan(x)dx` .

First integral can be integrated with the subsitution `u=tan(x)`, second integral was found in example 7.

Therefore, `int tan^3(x)dx=1/2 tan^2(x)+ln|cos(x)|+C` .

In general, if you have have integral `int tan^n(x)dx` where `n` is positive odd integer and `n!=1` , then you strip out two tangents and rewrite it as in example above.

`int tan^n xdx=int tan^(n-2)(x)tan^2(x)dx=int tan^(n-2)(x)(sec^2(x)-1)dx=`

`=int tan^(n-2)(x)sec^2(x)dx-int tan^(n-2)dx` .

First integral can be found with the above methods (substitution `u=tan(x)` then `du=sec^2(x)dx`).

`int tan^(n-2)(x)sec^2(x)dx=int u^(n-2)du=(u^(n-1))/(n-1)+C=1/(n-1)tan^(n-1)(x)+C` .

Second integral `int tan^(n-2)(x)dx` can be treated same way as `int tan^n(x)dx` because if `n` is odd then `n-2` is also odd.

This approach on each step reduces power of tangent by 2.

**Example 9.** Evaluate `int sec(x)dx`.

This seems to be an easy integral, but we can't integrate it directly. Again, we need to manipulate integrand:

`int sec(x)dx=int (sec(x)(sec(x)+tan(x)))/(sec(x)+tan(x))dx=int (sec^2(x)+sec(x)tan(x))/(tan(x)+sec(x))dx`

Now, let `u=tan(x)+sec(x)` then `du=sec^2(x)+sec(x)tan(x)dx` , so integral can be rewritten as

`int (du)/u=ln|u|+C=ln|tan(x)+sec(x)|+C`.

`int sec(x)dx=ln|tan(x)+sec(x)|+C`.

**Example 10.** Evaluate `int sec^3(x)dx`.

Again we try the same trick as in example 8:

`int sec^3(x)dx=int sec(x)sec^2(x)dx=int sec(x)(tan^2(x)+1)dx=`

`=int sec(x)tan^2(x)dx+int sec(x)dx`

Second integral was found in example 9. However, first integral can't be found using above techniques.

Let's try integration by parts. Let `u=tan(x)` and `dv=sec(x)tan(x)dx` then `du=sec^2(x)dx` and `v=int sec(x)tan(x)dx=sec(x)`.

So, `int sec(x)tan^2(x)dx=sec(x)tan(x)-int sec^3(x)dx`.

Now plug this value into above equation:

`int sec^3(x)dx=sec(x)tan(x)-int sec^3(x)dx+int sec(x)dx`.

This can be rewritten as `2 int sec^3(x)dx=sec(x)tan(x)+int sec(x)dx`.

Or `2 int sec^3(x)dx=sec(x)tan(x)+ln|sec(x)+tan(x)|+C_1`.

Finally, `int sec^3(x)=1/2(sec(x)tan(x)+ln|sec(x)+tan(x)|)+C` where `C=1/2 C_1`.

All of the above techniques also applicable to the integrals of form `int cot^n(x)csc^m(x)dx`.

Indeed, since `cos^2(x)+sin^2(x)=1` then dividing both sided of identity by `sin^2(x)` yields `cot^2(x)+1=csc^2(x)` which is similar to tangents and secants.

Some of the ideas of this note can be applied to the quotient of trigs.

**Example 11.** Evaluate `int (sin^5(x))/(cos^3(x))dx`.

We sine has odd power, so we can strip one sine and convert rest to cosines:

`int (sin^5(x))/(cos^3(x))dx=int (sin^4(x))/(cos^3(x)) sin(x)dx=int ((1-cos^2(x))^2)/(cos^3(x))sin(x)dx`.

Let `u=cos(x)` then `du=-sin(x)dx` or `sin(x)dx=-du` and integral can be rewritten as

`int ((1-u^2)^2)/(u^3)(-du)=int (2u^2-1-u^4)/(u^3)du=int (2u^(-1)-u^(-3)-u)du=`

`=2ln|u|+1/2 u^(-2)-1/2 u^2+C=2ln|cos(u)|+1/2 sec^2(x)-1/2 cos^2(x)+C`.

However, in general it is much more difficult to integrate quotient. For example `int (cos^4(x))/(sin^5(x))dx` is very hard, because we can't strip out sine (it is in denominator and for substitution we need sine in numerator). Even power of cosine doesn't allow to strip out cosine. Even if we convert somehow sines to cosines (or vice versa), integral is still very difficult to evaluate.

At the end of this note, let's make a quick summary of how to solve trigonometric integrals.

- Important thing is that you should know integrals of basic trigs (sines, cosines, tangent etc). This will allow to recognize parts of integrand and make correct substitution. For example, `int sec(x)tan^2(x)dx` implicitly contains `sec(x)tan(x)dx` which is derivative of `sec(x)`. Without knowing it, we could incorrectly perform integration by parts. Also without knowing that integral of sine is minus cosine and integral of cosine is sine we wouldn't be able to strip them out.
- Take advantage of trigonometric identities, double angle formulas and formulas that convert product of trigs into sum. Simplify integral as much as possible until you can evaluate it. It may appear that some non-standard approach is required, as with `int sec(x)dx` (we multiplied numerator and denominator by same expression and then performed simple manipulations).
**Practice, practice and once more practice.**Above two tips will be mastered only if you practice. Try one approach, if it doesn't work - try another. If you tried everything, there is, for sure, another method to try.