# Why does the sum of these trigonometric expressions give such a simple result?

During calculations I came across the following identity:

$$M+2(1-m) = \sum_{l=1}^{M-1} \frac{\cos\left(2\pi\frac{(2-m)\,l}{M}\right) - \cos\left(2\pi\frac{m\,l}{M}\right)}{2(1-\cos\left(2\pi\frac{l}{M}\right)}, \quad \forall m\in \{2,\dots, M\}, M\in \mathbb{N}$$

I cannot see why this rather complicated sum should give such a simple expression.

Does anyone know trig-tricks to simplify the sum? Can one already see intuitively that the result is linear in $m$ ?

-
Trig tricks, sure. Look up in say Wikipedia a way to express a difference $\cos x-\cos y$ as a product. Or derive the formula yourself from $\cos(A+B)=\dots$ and $\cos(A-B)=\dots$ and letting $x=A+B$, $y=A-B$. Then a familiar identity for the bottom will let you simplify things. Or else (easier for me) use $\cos \theta= (e^{i\theta}+e^{-i\theta})/2$. There probably is also a way to see the result without calculation. – André Nicolas Feb 2 '12 at 15:14
Are you sure about that: $m=1$ gives $\cos(2\pi (2-1) l/M )-\cos(2\pi (1) l/M ) =0$! – draks ... Feb 2 '12 at 15:28
@draks:sorry, I forgot to exclude m=1. it remains true for the other m. – madison54 Feb 2 '12 at 15:34

I don't believe any simple substitutions work directly. To get both the $M$ and $m-1$, I made a substitution which brings in another sum over a different variable, and then change the orders. Here is my proof of the identity:

Proof: Assume $m\in\mathbb{Z}$, and that $m\neq 1$. First, we begin with the addition and subtraction identities for cosine, and attempt to exploit the numerators symmetry around $m-1$. Upon subtracting $$\cos\left(2\pi\frac{\left(2-m\right)}{M}l\right)=\cos\left(2\pi\frac{(m-1)l}{M}\right)\cos\left(\frac{2\pi l}{M}\right)+\sin\left(2\pi\frac{(m-1)l}{M}\right)\sin\left(\frac{2\pi l}{M}\right)$$ and $$\cos\left(2\pi\frac{m}{M}l\right)=\cos\left(2\pi\frac{(m-1)l}{M}\right)\cos\left(\frac{2\pi l}{M}\right)-\sin\left(2\pi\frac{(m-1)l}{M}\right)\sin\left(\frac{2\pi l}{M}\right)$$ we have

$$\sum_{l=1}^{M-1}\frac{\cos\left(2\pi\frac{\left(2-m\right)}{M}l\right)-\cos\left(2\pi\frac{m}{M}l\right)}{2\left(1-\cos\frac{2\pi l}{M}\right)}= \sum_{l=1}^{M-1}\frac{\sin\left(2\pi\frac{(m-1)l}{M}\right)\sin\left(\frac{2\pi l}{M}\right)}{\left(1-\cos\frac{2\pi l}{M}\right)}.$$

Recall that $$\frac{\sin(x)}{1-\cos\left(x\right)}=\cot\left(\frac{x}{2}\right)$$ so our series becomes $$\sum_{l=1}^{M-1}\frac{\sin\left(2\pi\frac{(m-1)l}{M}\right)\cos\left(\frac{\pi l}{M}\right)}{\sin\left(\frac{\pi l}{M}\right)}.$$ Since $$\frac{\sin\left(2kx\right)}{\sin(x)}=2\left(\cos(x)+\cos(3x)+\cdots+\cos((2k-1)x)\right)=2\sum_{n=1}^{k}\cos\left((2n-1)x\right)$$ we may substitute in and rearrange orders to obtain $$2\sum_{l=1}^{M-1}\cos\left(\frac{\pi l}{M}\right)\sum_{n=1}^{m-1}\cos\left((2n-1)\frac{\pi l}{M}\right)$$

$$=2\sum_{n=1}^{m-1}\sum_{l=1}^{M-1}\cos\left(\frac{\pi l}{M}\right)\cos\left((2n-1)\frac{\pi l}{M}\right).$$ Upon using the identity $$\cos(nx)\cos(x)=\frac{1}{2}\cos\left((n-1)x\right)+\frac{1}{2}\cos\left((n+1)x\right),$$ we have $$\sum_{n=1}^{m-1}\sum_{l=1}^{M-1}\left(\cos\left(2\pi\frac{nl}{M}\right)+\cos\left(2\pi\frac{(n-1)l}{M}\right)\right).$$ Lets shift $n$ by $1$ for the right hand term, so both terms in the sum line up. Doing so introduces $\sum_{l=1}^{M-1} \cos(0)=M-1$, and since we have to cut off the sum at $m-2$, we must also add in $\sum_{l=1}^{M-1}\left(\cos\left(2\pi\frac{(m-1)l}{M}\right)\right)$ so we get $$=M-1+\sum_{l=1}^{M-1}\left(\cos\left(2\pi\frac{(m-1)l}{M}\right)\right)+2\sum_{n=1}^{m-2}\sum_{l=1}^{M-1}\cos\left(2\pi\frac{nl}{M}\right).$$ Using the fact that the roots of unity sum to zero, and we are only missing the root $1$, we see that $\sum_{l=1}^{M-1}\cos\left(2\pi\frac{nl}{M}\right)=-1$, for $n\neq 0$ and hence our sum is

$$=M-2+2\left(2-m\right)=M+2(1-m).$$

-
Thanks, nice derivation! You've subtracted one too much at the very last equal sign... – madison54 Feb 2 '12 at 16:24
@madison54: Ahh thanks! I fixed the $-1$. I don't know why that always happens, but I'll inevitably lose a sign, or do $1+1=4$, on the very last line of most of what I write.... – Eric Naslund Feb 2 '12 at 16:27