$\sum_{n=0}^{\infty} \sin (nx) = \cot(x/2)$?

I noticed this trend playing around in desmos, that the series $\sin x + \sin 2x + \sin 3x +...$ tends to $\cot(\frac{x}{2})$, is this identity correct?

Here is an example:

with <span class=$a=18$" />


Solution 1:

If one would formally differentiate the well-known Fourier series $$ \log|\sin(x/2)|=-\log 2-\sum_{n=1}^{+\infty}\frac{\cos nx}{n},\quad (x\neq 2\pi k,\ k\in\mathbf Z), $$ one would get $$ \frac{1}{2}\cot(x/2)=\sum_{n=1}^{+\infty}\sin(nx). $$ Now, as it happens, one cannot just differentiate Fourier series as one wish. Note that, for general $x\in (0,2\pi)$, the terms $\sin(nx)\not\to 0$ (as also mentioned by @Dr.MV in a comment), so the series in the right-hand side does not converge.

One way out of this would be to interpret everything in terms of distributions.