<s>[INST] Series $\sum_{n=1}^{\infty}\frac{\cos(nx)}{n^2}$ Is it true that for $x\in[0,2\pi]$ we have
$$\sum_{n=1}^{\infty}\frac{\cos(nx)}{n^2}=\frac{x^2}{4}-\frac{\pi x}{2}+\frac{\pi^2}{6}$$
How can I prove it?
For other intervals what is the value of above series if is convergent?
 [/INST] See the results posted here, where I show that
$$\sum_{n=-\infty}^{\infty} \frac{\sin^2{a n}}{n^2} = \pi a$$
when $a \in (0,\pi)$.  Now, use the fact that 
$$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$$
and let $S$ be the sum in question.  Then
$$\frac{\pi^2}{6} - S = \sum_{n=1}^{\infty} \frac{1-\cos{n x}}{n^2} = 2 \sum_{n=1}^{\infty} \frac{\sin^2{n x/2}}{n^2}$$
Rewrite the last sum as
$$2 \sum_{n=1}^{\infty} \frac{\sin^2{n x/2}}{n^2} = \sum_{n=-\infty}^{\infty} \frac{\sin^2{n x/2}}{n^2} - \left ( \frac{x}{2} \right )^2 = \pi \frac{x}{2} - \frac{x^2}{4}$$
Then
$$\frac{\pi^2}{6} - S =  \pi \frac{x}{2} - \frac{x^2}{4} \implies S = \frac{x^2}{4} - \pi \frac{x}{2} + \frac{\pi^2}{6}$$
as was to be shown.
</s>