# Prove that $\sum\limits_{k=0}^{n-1}\dfrac{1}{\cos^2\frac{\pi k}{n}}=n^2$ for odd $n$

In old popular science magazine for school students I've seen problem

Prove that $\quad$ $\dfrac{1}{\cos^2 20^\circ} + \dfrac{1}{\cos^2 40^\circ} + \dfrac{1}{\cos^2 60^\circ} + \dfrac{1}{\cos^2 80^\circ} = 40.$

How to prove more general identity:

$$\begin{array}{|c|} \hline \\ \sum\limits_{k=0}^{n-1}\dfrac{1}{\cos^2\frac{\pi k}{n}}=n^2 \\ \hline \end{array} , \qquad \mbox{ where } \ n \ \mbox{ is odd.}$$

• 40 isn't the square of an integer, so why do you think the problems are related? – Mercy King Jul 13 '13 at 13:04
• @Mercy: $\dfrac{1}{\cos 0^\circ} + \dfrac{1}{\cos 20^\circ} + \dfrac{1}{\cos 40^\circ} + \ldots+ \dfrac{1}{\cos 160^\circ} =81=9^2$. – Oleg567 Jul 13 '13 at 13:08
• Cool question, I have a suspicion you should add the complex-analysis tag – Cocopuffs Jul 13 '13 at 13:30
• Does the fourth power give you something similar? – Empy2 Jul 13 '13 at 14:25
• @Michael, my answer below generalizes to this case by taking instead $f(z) = (2/(z+z^{-1}))^4$. In this you'll find that the sum becomes $\tfrac{1}{3}n^2 (2 + n^2)$. – fuglede Jul 13 '13 at 14:31

Since $n$ is odd, the numbers $u_k=\cos k\pi/n$ are the same as the numbers $\cos 2k\pi/n$, i.e. the distinct angles $\theta$ satisfying $n\theta=0$ (mod $2\pi$). We think of them as the roots of the equation $\cos n\theta=1$. Writing $$\cos n\theta = \cos^n\theta - \binom{n}{2}\cos^{n-2}\theta\sin^2\theta \cdots \pm n\cos\theta \sin^{n-1}\theta$$ and using $\sin^2\theta=1-\cos^2\theta$, we see that the $u_k$'s are the roots of the polynomial $$p(u)=u^n - \binom{n}{2}u^{n-2}(1-u^2) \pm n u(1-u^2)^{(n-1)/2} + 1.$$ Note that all powers of $u$ which occur are odd (except for the constant term). The reciprocals $1/u_k$ are the roots of the "reverse polynomial" $$r(u)=u^n p(1/u) = u^n + a_{n-1} u^{n-1} + \cdots,$$ where $a_{n-1}=\pm n$ and $a_{n-2}=0$.

The sum in question is the sum of the squares of the roots of $r(u)$, i.e. $a_{n-1}^2 - 2a_{n-2} = n^2$.

• Thank you. It was most elementary proof (as for me). – Oleg567 Jul 14 '13 at 2:50

Whenever I see a problem like this, I think Chebyshev polynomials.

The Chebyshev polynomials of the first kind, $T_m(x)$, are defined so that:

$$T_m(\cos \theta) = \cos m\theta$$

$T_m$ is an $m$th degree polynomial, and the roots of $T_m(x)-1$ are exactly $\cos 2\pi k/m$ for $k=0,1,\dots,m-1$.

When $m=2n$ is even, we can write $$T_{2n}(x)=1+C\prod_{k=0}^{n-1}\left(x^2-\cos^2\frac{k\pi}{n}\right)$$ for some constant $C$. The occurrence of those $\cos^2\frac{k\pi}{n}$ suggested this might be a good approach.

Now, given a polynomial $p(x)=a_mx^m + a_{m-1}x^{m-1}\dots +a_0$, with non-zero roots $r_0,\dots, r_{m-1}$, we have formulas: $$\sum \frac{1}{r_k} = -\frac{a_1}{a_0}$$ And: $$\sum_{i< j} \frac{1}{r_ir_j} = \frac{a_2}{a_0}$$

So $$\sum \frac{1}{r_k^2} = \left(-\frac{a_1}{a_0}\right)^2 - 2\frac{a_2}{a_0}$$

Now let $p(x)=T_{2n}(x)-1$. The roots of $p$ are $r_k=\cos \frac{k\pi}{n}$ for $k=0,\dots,2n-1$, and the roots are non-zero since $n$ is odd. We know that $p(x)$ is even, so $a_1=0$. Finally, we know that $\sum_{k=0}^{2n-1} \frac{1}{r_k}^2$ is twice the sum that you are looking for.

So your sum is now reduced to finding $-\frac{a_2}{a_0}$ where the $a_0,a_2$ are coefficients of $p(x)$. Since $p(0)=T_{2n}(\cos \pi/2)-1 = \cos n\pi - 1 = -2$, so we know that $a_0=-2$. So $\sum r_k^{-2} = a_2$. (Again, we use $n$ odd here.)

So we need to prove that $a_2=2n^2$.

Now, $a_2=\frac{1}{2}T_{2n}^{''}(0)$. Let $f(x)=\cos 2nx = T_{2n}(\cos x)$. Differentiating we get:

$$-2n\sin 2nx = -T_{2n}^{'}(\cos x)\sin x$$

Differentiating both sides again:

$$-4n^2\cos 2nx = T_{2n}^{''}(\cos x)(\sin^2 x) - T_{2n}^{'}(\cos x)\cos x$$

Putting in $x=\pi/2$, then $\cos x=0$, $\sin x=1$, and $\cos 2nx=-1$. Therefore, we get $$4n^2 = T_n^{''}(0)\\a_n=\frac{1}{2}T_{2n}^{''}(0)=2n^2$$

and therefore your sum is $n^2$.

Note: Any symmetric rational function with rational coefficients of $\{\cos 2\pi k/n\mid k=0,\dots,n-1\}$ will be rational by this argument.

• Thank you. Nice approach with Chebyshev polynomials. – Oleg567 Jul 14 '13 at 2:53

I believe I first came across this trick in this paper by Szenes, so check out section 3 in that for more details.

Consider the form $$\mu_n(z) = n\frac{dz}{z} \frac{z^n + z^{-n}}{z^n-z^{-n}}$$ and the function $$f(z) = \frac{4}{(z+z^{-1})^2}.$$ Your sum is the sum of the $f(z_k)$, where $z_k = \exp(\pi i k/n)$, $k = 0, \dots, n-1$. Note first of all that for these particular values of $z$, $$f(z_k) = \mathop{\mathrm{Res}}_{z=z_k} f \mu_n.$$ Note also that the same formula holds with $z_k$ replaced by $z_k^{-1}$, and that $\mathop{\mathrm{Res}}_{z=\infty} f\mu_n = \mathop{\mathrm{Res}}_{z=0} f\mu_n = 0.$ Moreover, $\mathop{\mathrm{Res}}_{z= \pm i} f\mu_n = -n^2$. It follows from the residue theorem that $$\sum_{k=0}^{n-1} f(z_k) = -\frac{1}{2}\left(\mathop{\mathrm{Res}}_{z=i} f\mu_n + \mathop{\mathrm{Res}}_{z=-i} f\mu_n\right) = n^2.$$

• Ah, interesting. I was thinking all the time this should be doable with $\frac1{\cos^2\alpha}=\frac2{1+\cos 2\alpha}=2(1-\cos2\alpha+\cos^22\alpha-\cos^32\alpha\pm\ldots)$ and character orthogonality, but ran into dead ends ... – Hagen von Eitzen Jul 13 '13 at 14:28
• My own first approach was to somehow relate the sum of the question to the quadratic Gauss sum to which it is very similar. Indeed, many of the formulas given on that page can be proved in a fashion much like the above. – fuglede Jul 13 '13 at 14:41
• Thank you for the nice answer using complex analysis. – Oleg567 Jul 14 '13 at 2:54

In equation $(7)$ of this answer, I compute that $$\sum_{k=1}^n\tan^2\left(\frac{k\pi}{2n+1}\right)=n(2n+1)$$ Thus, with $n=2m+1$, \begin{align} \sum_{k=0}^{n-1}\frac1{\cos^2\left(\frac{k\pi}{n}\right)} &=\sum_{k=0}^{2m}\sec^2\left(\frac{k\pi}{2m+1}\right)\\ &=2\sum_{k=0}^m\tan^2\left(\frac{k\pi}{2m+1}\right)+2(m+1)\\[6pt] &=2m(2m+1)+2(m+1)\\[12pt] &=(2m+1)^2\\[12pt] &=n^2 \end{align}

For odd $n$, consider the function $$f(z)=\frac{n/z}{z^n-1}\left(\frac{z-1}{z+1}\right)^2\tag{1}$$ All the singularities are simple, except the singularity at $-1$. $$\left(\frac{z-1}{z+1}\right)^2=1-\frac4{z+1}+\frac4{(z+1)^2}\tag{2}$$ Furthermore, $$\frac{\mathrm{d}}{\mathrm{d}z}\frac{n/z}{z^{\raise{2pt}n}-1}=\frac{n-n(n+1)z^n}{z^2(z^{\raise{2pt}n}-1)^2}\tag{3}$$ Using $(2)$ and $(3)$, we get the residue of $f$ at $-1$ to be $$-4\cdot\frac{-n}{-1-1}+4\cdot\frac{n+n(n+1)}{(-1-1)^2}=n^2\tag{4}$$ The residue of $f$ at $0$ is $-n$ and the residue at each $n^{\text{th}}$ root of unity is $-\tan^2(\theta/2)$.
Since the integral of $f$ over an increasing circle vanishes, the sum of the residues must be $0$. Therefore, $$\sum_{k=0}^{n-1}\tan^2\left(\frac{k\pi}{n}\right)=n^2-n\tag{5}$$ and therefore, $$\sum_{k=0}^{n-1}\sec^2\left(\frac{k\pi}{n}\right)=n^2\tag{6}$$
• Using the half-angle formula for cosine, could you instead consider $f(z) = \displaystyle\frac{4z}{(z+1)^{2}} \frac{n/z}{z^{n}-1}$? – Random Variable Jul 15 '13 at 16:25
• @RandomVariable: $\displaystyle\frac{4z}{(z+1)^2}=1-\left(\frac{z-1}{z+1}\right)^2$, so I imagine so. – robjohn Jul 15 '13 at 16:40
From this answer we know that $$\sum\limits_{k=1}^{m}\tan^2\frac{\pi k}{2m+1}=m(2m+1)$$ Similarly $$\sum\limits_{k=m+1}^{2m}\tan^2\frac{\pi k}{2m+1}= \sum\limits_{l=1}^{m}\tan^2\frac{\pi (2m+1-l)}{2m+1}= \sum\limits_{l=1}^{m}\tan^2\frac{\pi l}{2m+1}=m(2m+1)$$ Since $\cos^{-2}\alpha=1+\tan^2\alpha$, then \begin{align} \sum\limits_{k=0}^{2m}\frac{1}{\cos^2\frac{\pi k}{2m+1}} &=\sum\limits_{k=0}^{2m} 1 +\sum\limits_{k=0}^{2m}\tan^2\frac{\pi k}{2m+1}\\ &=2m+1+\sum\limits_{k=1}^{m}\tan^2\frac{\pi k}{2m+1}+\sum\limits_{k=m+1}^{2m}\tan^2\frac{\pi k}{2m+1}\\ &=2m+1+m(2m+1)+m(2m+1)=(2m+1)^2 \end{align}
• +1 This one is a classic! It even works so as to calculate $\zeta(2),\zeta(4)$ pretty nicely. – Pedro Tamaroff Jul 13 '13 at 18:23