<s>[INST] Series $\sum_{n=1}^\infty \frac{\cos n}{n^2}$ This is the series I want to find:
$$\sum_{n=1}^\infty \frac{\cos n}{n^2}$$
WolframAlpha gives the answer of $\frac14 + \frac16 (\pi - 3)\pi$.
I do not know anything about this problem other than to prove that it is convergent.
Thanks.
 [/INST] Here's a solution using Fourier series.
For $a\in\mathbb C-\mathbb Z$, consider the $2\pi$-periodic function $f$ defined as $f_a(x)=\cos (ax)$ for $x\in [-\pi,\pi)$.
Let's expand it as a Fourier series (since it's periodic). The Fourier coefficients are
$$a_n = \int_{-\pi}^{\pi} \cos(ax)\cos(nx)dx = \frac{(-1)^{n+1}}{\pi}\frac{a \sin{\pi a}}{n^2-a^2}$$
So the Fourier expansion is $$f_a(x)=\cos(ax)=\frac{\sin{\pi a}}{\pi a} \left [1+2 a^2 \sum_{n=1}^{\infty} \frac{(-1)^{n+1} \cos{n x}}{n^2-a^2} \right ]$$
In other words
$$ \sum_{n=1}^{\infty} \frac{(-1)^{n+1} \cos{n x}}{n^2-a^2} = \frac 1 {2a^2}\left ( \frac{\pi a \cos(ax)}{\sin(\pi a)} - 1\right)$$
Evaluating at $x=1-\pi\in [-\pi, \pi)$ gives
$$\sum_{n=1}^{\infty} \frac{ \cos n}{n^2-a^2} = \frac 1 {2a^2}\left (1 - \frac{\pi a \cos(a(1 - \pi))}{\sin(\pi a)} \right)$$
Now letting $a\rightarrow 0$ gives
$$\begin{split}
\sum_{n=1}^{\infty} \frac{ \cos n}{n^2} &= \lim_{a\rightarrow 0}\frac 1 {2a^2}\left ( 1 - \frac{\pi a \cos(a (1-\pi))}{\sin(\pi a)} \right)\\
&=\lim_{a\rightarrow 0}\frac 1 {2a^2}\left (1 -  \frac{\pi a \left(1-\frac{a^2(1-\pi)^2}{2} + o(a^2)\right)}{\pi a -\frac{\pi^3 a^3}6 + o(a^2)} \right)\\
&= \lim_{a\rightarrow 0}\frac 1 {2a^2}\left (\frac{a^2}2 - a^2\pi + a^2\frac{\pi^2}3 +o(a^2)\right)\\
&=\frac 1 4 -\frac {\pi} 2 + \frac {\pi^2} 6
\end{split}$$
</s>