# Ask Uncle Colin: Far too many cosines

Dear Uncle Colin,

My classmate claims he can work out $\int_0^\pi \cos^{2020}(x)\dx$. I think that’s

fartoo many cosines to integrate. What do you think?Trigonometric Ratio, Exponentiated Excessively - That’s Hardly Realistic Enumeration, Eh?

Hi, TREETHREE, and thanks for your message!

I can’t speak for your classmate, but I can show you a way to solve it!

This is going to use a *reduction formula*, which feels a bit like cheating.

Suppose that, instead of wanting to integrate $\cos^{2020}(x)$, it’s $\cos^n(x)$ – a more general form. I’m going to call that $I_n$. Then we have:

- $I_n = \int_0^\pi \cos^n(x) \dx$.

Let’s split off two of the cosines:

- $I_n = \int_0^\pi \cos^2(x) \cos^{n-2}(x) \dx$
- $\dots = \int_0^\pi \left(1 - \sin^2(x)\right) \cos^{n-2}(x) \dx$
- $\dots = \int_0^\pi \cos^{n-2}(x) - \sin^2(x)\cos^{n-2}(x) \dx$
- $I_n = I_{n-2} - \int_0^\pi \sin^2(x) \cos^{n-2}(x) \dx$

(That’s the clever bit, I think: spotting that we’ve got the same integral with a reduced parameter.)

We can attack the remaining integral by parts:

- $u = \sin(x)$ so $u’ = \cos(x)$
- $v’ = \sin(x)\cos^{n-2}(x)$, so $v = -\frac{1}{n-1} \cos^{n-1}(x)$

We could work out $uv$, but we don’t need to – $\sin(0) = \sin(\pi) = 0$, so that bit will vanish. We’re left with:

- $I_n = I_{n-2} - \frac{1}{n-1}\int_0^\pi \cos^{n}(x)\dx$, or $I_{n-2} - \frac{1}{n-1}I_n$.

That feels like we’ve gone around in circles! Happily, the constant in front means we haven’t.

- $I_n = I_{n-2} - \frac{1}{n-1}I_n$ (careful with the signs)
- $(n-1)I_n = (n-1)I_{n-2} - I_n$
- $I_n = \frac{n-1}{n}I_{n-2}$

There’s a trap here: you might be tempted to rewrite $\frac{n-1}{n}$ as $1 - \frac{1}{n}$. I don’t think that’s a good idea.

Instead, you can see that you can repeat the process: $I_n = \frac{n-1}{n} \cdot \frac{n-3}{n-2} \cdots I_0$, at least for even $n$. (For odd $n$, it ends with $I_1$).

What’s $I_0$? It’s $\int_0^\pi \cos^{0}(x) \dx$, which is $\pi$.

So, we could then work out $I_2 =\frac{1}{2}\pi$, and $I_4 = \frac{3}{8}\pi$ and so on… or simply use the double-factorial function to say $I_{2n} = \frac{(2n-1)!!}{(2n)!!}\pi$.

If you don’t like the double factorial, you can say that $(2n-1)!! = (2n-1)! / [2^{n-1} (n-1)!]$ and $(2n)!! = 2^n n!$ to write the result as $\frac{(2n-1)!}{2^{2n-1}n!(n-1)!}\pi$.

You might even spot that that’s a binomial coefficient: $I_n = \frac{1}{2^{2n-1}}\nCr{2n-1}{n}\pi$, which is probably as nice as it gets.

Hope that helps!

- Uncle Colin

- Edited 2022-08-09 to fix a LaTex error. Thanks to Andrew for pointing it out!