# Evaluating the product $\prod\limits_{k=1}^{n}\cos\left(\frac{k\pi}{n}\right)$

Recently, I ran across a product that seems interesting.

Does anyone know how to get to the closed form:

$$\prod_{k=1}^{n}\cos\left(\frac{k\pi}{n}\right)=-\frac{\sin(\frac{n\pi}{2})}{2^{n-1}}$$

I tried using the identity $\cos(x)=\frac{\sin(2x)}{2\sin(x)}$ in order to make it "telescope" in some fashion, but to no avail. But, then again, I may very well have overlooked something.

This gives the correct solution if $n$ is odd, but of course evaluates to $0$ if $n$ is even.

So, I tried taking that into account, but must have approached it wrong.

How can this be shown? Thanks everyone.

-
It's finite, isn't it? –  draks ... Jul 20 '12 at 12:20
You should have $sin(n\pi/2)$. –  Mhenni Benghorbal Jul 20 '12 at 12:35
In the argument of the $\sin$, instead of $k$, it should be $n$. –  Mhenni Benghorbal Jul 20 '12 at 12:38
Yes, I know. It is a careless typo. Sorry. –  Cody Jul 20 '12 at 13:52
This is almost identical to the second part of this question –  robjohn Jul 20 '12 at 18:03

The roots of the polynomial $X^{2n}-1$ are $\omega_j:=\exp\left(\mathrm i\frac{2j\pi}{2n}\right)$, $0\leq j\leq 2n-1$. We can write \begin{align} X^{2n}-1&=(X^2-1)\prod_{j=1}^{n-1}\left(X-\exp\left(\mathrm i\frac{2j\pi}{2n}\right)\right)\left(X-\exp\left(-\mathrm i\frac{2j\pi}{2n}\right)\right)\\ &=(X^2-1)\prod_{j=1}^{n-1}\left(X^2-2\cos\left(\frac{j\pi}n\right)X+1\right). \end{align} Evaluating this at $X=i$, we get $$(-1)^n-1=(-2)(-2\mathrm i)^{n-1}\prod_{j=1}^{n-1}\cos\left(\frac{j\pi}n\right),$$ hence \begin{align} \prod_{j=1}^n\cos\left(\frac{j\pi}n\right)&=-\prod_{j=1}^{n-1}\cos\left(\frac{j\pi}n\right)\\ &=\frac{(-1)^n-1}{2(-2\mathrm i)^{n-1}}\\ &=\frac{(-1)^n-1}2\cdot \frac{\mathrm i^{n-1}}{2^{n-1}}. \end{align} The RHS is $0$ if $n$ is even, and $-\dfrac{(-1)^m}{2^{2m}}=-\dfrac{\sin(n\pi/2)}{2^{n-1}}$ if $n$ is odd with $n=2m+1$.

-
You lost a factor $-(-i)^n$ in the last step; your result is non-negative whereas the result in the question oscillates. –  joriki Jul 20 '12 at 12:35
I think the problem is that the roots $-1/1$ don't come in complementary pairs. So it's really $X^{2n}-1 = (X^2-1)\prod_{i=1}^{n-1} ...$ –  Thomas Andrews Jul 20 '12 at 12:58
Also, you need a $i$ in the definition of $\omega_j$: $$\omega_j = exp(\frac{2\pi j}{2n} i)$$ –  Thomas Andrews Jul 20 '12 at 13:00
@ThomasAndrews There are indeed indeed couple of mistake. I will correct them. Thanks! –  Davide Giraudo Jul 20 '12 at 13:48
Corrected some misprints, missing occurrences of $\mathrm i$, and wrong indexations, and added a one-sentence at the end. Hope the result suits you. –  Did Jul 20 '12 at 14:24

The idea of using $\cos x=\frac{1}{2}\frac{\sin 2x}{\sin x}$ is a nice one, and works quickly. We should not use this when $x=\frac{n\pi}{n}$,because of the $\frac{0}{0}$ issue. Also, as you observe, the product is $0$ if $n$ is even, so we needn't bother. So let $n$ be odd.

Look at the product from $k=1$ to $k=n-1$. As $k$ ranges over these values, the numbers $2k$ range, modulo $n$, over all numbers from $1$ to $n-1$. So the $\cos(2k\pi/n)$ (apart from sign) range in some order over the $\cos(\pi j/n)$. Thus, apart from sign, there is cancellation and the product has absolute value $\frac{1}{2^{n-1}}$.

There is no sign issue. If $n\equiv 1\pmod {4}$, the product from $1$ to $n-1$ has an even number of negative terms. The term $\cos(\pi n/n)$ then gives us an extra $-1$, and the product is negative. For the same reason, if $n\equiv 3\pmod{4}$ then the product is positive. The $-\sin(n\pi/2)$ term captures these sign facts, and also produces the right answer of $0$ when $n$ is even.

-
Thanks Andre. I was on the right path afterall. I noticed the 0/0 issue you mention but failed to see the forest for the trees. Thanks. I managed to see the $2^{n-1}$ from this method, but did not see how the $\sin(\pi n/2)$ was revealed. –  Cody Jul 20 '12 at 13:55
@Cody: Corrected a few typos. One would think such a short argument would be typo-free! As you can see, there is basically term by term cancellation if one looks at things right. –  André Nicolas Jul 20 '12 at 14:01
@AndréNicolas: now that I read your answer, I see that mine is just a paraphrase into $\prod$s. (+1) –  robjohn Jul 20 '12 at 16:55

The monic Chebyshev polynomial of the second kind,

$$\hat{U}_n(x)=\frac{\sin((n+1)\arccos\,x)}{2^n \sqrt{1-x^2}}$$

can be easily seen to have the roots $x_k=\cos\dfrac{\pi k}{n+1}$ for $k=1,\dots,n$. By Vieta, the constant term of $\hat{U}_n(x)$ is equal to

$$\hat{U}_n(0)=\prod_{k=1}^n \cos\dfrac{\pi k}{n+1}$$

and thus

$$\prod_{k=1}^n \cos\dfrac{\pi k}{n}=-\hat{U}_{n-1}(0)=-\frac{\sin\frac{n\pi}{2}}{2^{n-1}}$$

-
Thanks JM. I certainly would have not thought of this. I have heard of Chebyshev polynomials, but that's about it. I will have to look into them. –  Cody Jul 20 '12 at 14:15
Big guns work fast :-) (+1) –  robjohn Jul 20 '12 at 16:52
We both have seen this before. –  robjohn Jul 20 '12 at 20:34
@rob, oh dear, precisely the same argument, except I hadn't mentioned Vieta in the other answer... :) –  Ｊ. Ｍ. Jul 20 '12 at 22:03

If $n$ is even, then the term with $k=n/2$ makes the product on the left $0$ and $\sin\left(\frac{n}{2}\pi\right)=0$. So assume that $n$ is odd. \begin{align} \prod_{k=1}^n\cos\left(\frac{k\pi}{n}\right) &=-\prod_{k=1}^{n-1}\cos\left(\frac{k\pi}{n}\right)\tag{1}\\ &=-\prod_{k=1}^{n-1}\frac{\sin\left(\frac{2k\pi}{n}\right)}{2\sin\left(\frac{k\pi}{n}\right)}\tag{2}\\ &=\frac{-1}{2^{n-1}}\frac{\prod\limits_{k=\frac{n+1}{2}}^{n-1}\sin\left(\frac{2k\pi}{n}\right)}{\prod\limits_{k=1}^{\frac{n-1}{2}}\sin\left(\frac{(2k-1)\pi}{n}\right)}\tag{3}\\ &=\frac{(-1)^{\frac{n+1}{2}}}{2^{n-1}}\frac{\prod\limits_{k=1}^{\frac{n-1}{2}}\sin\left(\frac{(2k-1)\pi}{n}\right)}{\prod\limits_{k=1}^{\frac{n-1}{2}}\sin\left(\frac{(2k-1)\pi}{n}\right)}\tag{4}\\ &=-\frac{\sin\left(n\frac\pi2\right)}{2^{n-1}}\tag{5} \end{align} $(1)$: $\cos(\pi)=-1$

$(2)$: $\sin(2x)=2\sin(x)\cos(x)$

$(3)$: cancel $\sin\left(\frac{j\pi}{n}\right)$ in the numerator and denominator for even $j$ from $2$ to $n-1$

$(4)$: in the numerator, change variable $k\mapsto k+\frac{n-1}{2}$ and use $\sin(x+\pi)=-\sin(x)$

$(5)$: for odd $n$, $\sin\left(n\frac\pi2\right)=(-1)^{\frac{n-1}{2}}$

-
Thanks RobJohn. That is how I started it, but was too dumb to finish :(. Thanks a bunch. –  Cody Jul 20 '12 at 17:19
@Cody: It is not easy to see all the cancellations. I had to picture where the points on the circle were and note where the terms from the numerator and denominator overlapped to get step $(3)$. Good question! (+1) –  robjohn Jul 20 '12 at 17:55
Thanks RobJohn. I noticed in the link you provided this has been asked before. I always look before I post to see if the same question as been asked. But, I did not find this one. Often, it is difficult to locate something in particular. I thought this was a cool problem. Thanks for all the input and different methods. –  Cody Jul 21 '12 at 10:31