## Trig integrals

Trigonometric functions generally tell us about behaviour which happens in a periodic way – the motion of the earth around the sun, the position of a pendulum. This might be related to the (AC) current flowing down an electrical circuit, the change in risk of certain weather patterns throughout the year or the position of a planet in the sky.

Here we’re going to use a combination of simple integrals that we should all know by now and integration by substitution and parts along with trigonometric identities to solve certain integrals.

Note that some of the tricks we use are going to appear to have been pulled out of a hat, and until you become familiar with these methods, that’s unfortunately the case for some time. But spend time looking through them and seeing the structure of the methods and they will become clearer and clearer.

Integrating the $\tan$ function $\int\tan\theta d\theta$

Often it will be best to try and put our integral in the form of $\sin$ and $\cos$. Remember that $\tan\theta=\frac{\sin\theta}{\cos\theta}$ and so we can see that we have something that has the same pattern that we saw previously when looking at integration by substitution.
Let’s try: $u=\cos\theta$ and so $du=-\sin\theta d\theta$ which gives us: $-\int\frac{1}{u}du=-\ln|u|+c$

substituting back we get: $\int\tan\theta d\theta=-\ln|\cos\theta|+c=\ln|\sec\theta|+c$

Integrating the $\sec$ function

This one really does require some dirty tricks, but if you remember the first step, then you will be good to go. $\int\sec\theta d\theta$

Here we are going to multiply and divide the integrand (the function inside the integral) by an expression which is going to make things look harder but will actually be easier: $\int \frac{\sec\theta(\sec\theta+\tan\theta)}{\sec\theta+\tan\theta}d\theta=\int\frac{(sec^2\theta+\tan\theta\sec\theta)}{\sec\theta+\tan\theta}d\theta$

The reason we do this is because the derivative of the function in the denominator is precisely the numerator! If we make the substitution: $u=\sec\theta+\tan\theta$

Then we can show, by simply taking the derivative, that: $du=(\sec^2\theta+\sec\theta\tan\theta) d\theta$

Well, this means that the integral simply becomes: $\int \frac{1}{u}du=\ln|u|+c=\ln|\sec\theta+\tan\theta|+c$

Again, don’t worry that you wouldn’t have thought of this trick – remember it for now and it will become clear why we use it as you work through it over time.

I was asked a great question in class about the fact that this trick seems so random. There are some nice tips here about other ways to do this integral which you might find a little more intuitive.

Some higher powers of trig functions

Let’s look at an example where again we will use a trick and it will allow us to use our previous integral: $\int\sec^3\theta d\theta$

Very often with trig functions, if we have an odd power, we will split off an even power as follows: $\int\sec^3\theta d\theta=\int\sec^2\theta\sec\theta d\theta$

Now we rewrite the $\sec^2\theta$ part as $\sec^2\theta=1+\tan^2\theta$ which gives $\int\sec\theta(1+\tan^2\theta)d\theta=\int\sec\theta d\theta+\int\sec\theta\tan^2\theta d\theta$

But we see that we already know the first part as we did it in the last example. So we have: $\ln|\sec\theta+\tan\theta|+\int(\tan\theta)(\sec\theta\tan\theta) d\theta$

Now we are going to integrate the second term by parts using: $u=\tan\theta, \,\,\,\, dv=\sec\theta\tan\theta d\theta\longrightarrow du=\sec^2\theta,\,\,\,\, v=\sec\theta$

This now gives $\int\sec^3\theta d\theta=\ln|\sec\theta+\tan\theta|+\tan\theta\sec\theta-\int\sec^3\theta d\theta$

But the term on the right is the negative of the term on the left, so we can pull it to the other side to get: $2\int\sec^3\theta d\theta=\ln|\sec\theta+\tan\theta|+\tan\theta\sec\theta+c$

and so: $\int\sec^3\theta d\theta=\frac{1}{2}\left(\ln|\sec\theta+\tan\theta|+\tan\theta\sec\theta\right)+c$

An even higher power example

Here we will see a general method which is applicable to odd powers of $\sin$ and $\cos$: $\int \sin^5\theta d\theta=\int \sin^4\theta \sin(\theta) d\theta$

Now we want to write $\sin$ in terms of $\cos$: $=\int (1-\cos^2\theta)^2 \sin(\theta) d\theta$

But now we can see that a substitution will help. We use $u=\cos\theta$ to get: $-\int (1-u^2)^2 du=-\int (1-2u^2+u^4)du=-(u-\frac{2}{3}u^3+\frac{u^5}{5})+c=-(\cos\theta-\frac{2}{3}\cos^3\theta+\frac{\cos^5\theta}{5})+c$

An iteration formula

We’re going to see here an example where the answer to an integral is going to be another integral, but one which is simpler than the first and can be written, again, using another integral and so on and so forth until we reach the bottom of the tower of integrals and we have an answer.

We look at: $\int\sin^n xdx$

For positive integer $n>1$. We start by splitting this up as: $\int\sin^{n-1}x\sin x dx$

And integrate by parts with: $u=\sin^{n-1} x,\,\,\, dv=\sin x dx\longrightarrow du=(n-1)\sin^{n-2}x\cos x dx,\,\,\,v=-\cos x$

Which gives: $\int\sin^{n}x dx=-\sin^{n-1} x\cos x+\int cos^2 x(n-1)\sin^{n-2}x dx$

Writing the $\cos^2 x$ term in terms of $\sin$: $\int\sin^{n}x dx=-\sin^{n-1} x\cos x+\int (1-\sin^2x) (n-1)\sin^{n-2}x dx$

Which can be expanded as: $\int\sin^{n}x dx=-\sin^{n-1} x\cos x+\int (n-1)\sin^{n-2}x dx-\int (n-1)\sin^{n}x dx$

But the piece on the right is very similar to the original integral and so we take it to the left hand side: $\int\sin^{n}x dx(1+n-1)=-\sin^{n-1} x\cos x+\int (n-1)\sin^{n-2}x dx$

Manipulating this we get: $\int\sin^{n}x dx=\frac{1}{n}\left(-\sin^{n-1} x\right)\cos x+\frac{n-1}{n}\int\sin^{n-2}x dx$

And so we have managed to write our original integral of a power of $\sin x$ in terms of another integral of a power of $\sin x$ but now a lower power. If you take the tenth power, you can write it in terms of the 8th power, which you can write in terms of the 6th power, etc. until you have integral on the right which you can solve explicitly. Note that we haven’t included the constant, because the integral on the right itself will give a constant of integration.

Using the double angle formula

A useful way to solve even powers of trig functions is to use the double angle formulae: $\int \cos^2\theta d\theta=\int\frac{1}{2}(1+\cos 2\theta) d\theta$.

This can then be solved with a simple substitution for $2\theta=u$, or integrated directly. The final answer is then: $\frac{\theta}{2}+\frac{\sin(2\theta)}{4}+c$

More examples for you to try.

There are lots of good examples for you to go through here:

https://www.math.ucdavis.edu/~kouba/CalcTwoDIRECTORY/trigintdirectory/TrigInt.html

http://tutorial.math.lamar.edu/Classes/CalcII/IntegralsWithTrig.aspx

Let me know if you need some more and I’ll find some more useful links.

### Bonus section

It’s very easy to show that there are an infinite number of prime numbers. This was shown by Euclid over 2000 years ago. When you look through prime numbers you will see that they often occur as pairs which differ by 2. These are called twin primes. For instance 11 and 13 are twin primes, 17 and 19 are twin primes.

The density of primes around an integer x, as shown by Gauss goes as $\frac{1}{\ln x}$.

you might think that twin primes should get more and more rare.

We know that there are an infinite number of primes, but how about twin primes? Are there are infinite number of twin primes? Do they go on forever or is there a pair of twin primes which are the largest, and then there are no others? Well, it turns out that we still don’t know this. In fact, until pretty recently we could say almost nothing about the number of primes which differed by a fixed number of places.

In May 2013, a relatively unknown mathematician called Yitang Zhang from the University of New Hampshire, astounded the mathematics community by showing, not that there were infinitely many primes which differed by 2, but that there were infinitely many primes which differed by at most 70 million! This doesn’t seem nearly as impressive, but it was a huge breakthrough because until this time nobody had any idea how to get ANY bound on pairs of prime numbers.

The mathematics community was abuzz with excitement about this. All they needed to do now was to bring down this bound from 70 million to 2. That’s still not easy but at least we’ve made a start now!

Soon, Terrence Tao, one of the world’s most important mathematicians today, launched an online project called the Polymath project which was an open project where anyone could come and contribute to try and make stronger and stronger statements about twin primes.

Soon the project had managed to drop the bound to less than a million, then less than half a million, then suddenly to less than 70 thousand, just a month after Zhang had published his groundbreaking result. After two months it was down from 70 million to 4680.

Then, in November of last year a postdoctoral researcher called Maynard showed that there were infinitely many pairs of primes which differ by less than 600. Another huge jump! The bound is now down to 246 as of April this year. Let’s see if through the joint collaboration of the world’s mathematicians if the twin primes conjecture can finally be proved!
You might well ask ’Who cares?’ But the point is that because prime numbers are the building blocks of all of the natural numbers, while there are still deep mysteries into the structures and patterns of primes numbers, there are even more things that we don’t understand about the structure of the integers.