Finite sum of csc via sum of cot Would anyone give a clue how to prove the following identity:
$\sum_{k =1}^{n-1} \csc\left(\frac{k\pi}{n}\right) = -\frac{1}{n}\sum_{k=0}^{n-1}(2k+1)\cot\left(\frac{(2k+1)\pi}{2n}\right)$.
I tried various methods with no success.
This formula is given as an excercise in H. Chen "Excursions in classical analysis" in Chapter 7.
 A: You could rewrite $$\sum_{k=0}^{n-1}(2k+1)\cot\left(\frac{(2k+1)\pi}{2n}\right)$$ as
$$\sum_{k=1}^{2n-1}k\cot\left(\frac{k\pi}{2n}\right)-\sum_{k=1}^{n-1}2k\cot\left(\frac{2k\pi}{2n}\right).$$ Then use $\cot\left(\dfrac{(2n-s)\pi}{2n}\right)=-\cot\left(\dfrac{s\pi}{2n}\right)$ and $\cot\left(\dfrac{n\pi}{2n}\right)=0$ to rewrite the first sum, giving $$\sum_{k=1}^{n-1}(k-(2n-k))\cot\left(\frac{k\pi}{2n}\right)-\sum_{k=1}^{n-1}2k\cot\left(\frac{k\pi}{n}\right)=-2n\sum_{k=1}^{n-1}\cot\left(\frac{k\pi}{2n}\right)+\sum_{k=1}^{n-1}2k\csc\left(\frac{k\pi}{n}\right),$$ from the identity $\csc x = \cot \frac{1}{2}x - \cot x$.
Also, $$n\sum_{k=1}^{n-1}\csc\left(\frac{k\pi}{n}\right) = n\sum_{k=1}^{n-1}\cot\left(\frac{k\pi}{2n}\right) -n\sum_{k=1}^{n-1}\cot\left(\frac{k\pi}{n}\right)$$ and the second of these sums is zero, using $\cot\left(\dfrac{(n-k)\pi}{n}\right)=-\cot\left(\dfrac{k\pi}{n}\right)$, so  $$n\sum_{k=1}^{n-1}\csc\left(\frac{k\pi}{n}\right)+\sum_{k=0}^{n-1}(2k+1)\cot\left(\frac{(2k+1)\pi}{2n}\right) = -n\sum_{k=1}^{n-1}\cot\left(\frac{k\pi}{2n}\right) +\sum_{k=1}^{n-1}2k\csc\left(\frac{k\pi}{n}\right).$$ Finally, because $\csc\left(\dfrac{k\pi}{n}\right) =\csc\left(\dfrac{(n-k)\pi}{n}\right)$,$$\sum_{k=1}^{n-1}k\csc\left(\frac{k\pi}{n}\right)=\sum_{k=1}^{n-1}(n-k)\csc\left(\frac{k\pi}{n}\right),$$ so $$\sum_{k=1}^{n-1}2k\csc\left(\frac{k\pi}{n}\right)=\sum_{k=1}^{n-1}n\csc\left(\frac{k\pi}{n}\right)=\sum_{k=1}^{n-1}n\cot\left(\frac{k\pi}{2n}\right)-\sum_{k=1}^{n-1}n\cot\left(\frac{k\pi}{n}\right)$$ and $$n\sum_{k=1}^{n-1}\csc\left(\frac{k\pi}{n}\right)+\sum_{k=0}^{n-1}(2k+1)\cot\left(\frac{(2k+1)\pi}{2n}\right) = -n\sum_{k=1}^{n-1}\cot\left(\frac{k\pi}{n}\right)=0.$$
