How to calculate the sum of the series $\sum_{n=1}^{\infty}\frac{\cos^3(nx)}{n^2}$? As the title says, I need to calculate the sum of the function series $$\sum_{n=1}^{\infty}\frac{\cos^3(nx)}{n^2}$$ so that I can find out if the series does simple or uniform converge to something.
Usually, for problems like this I need to write the sum like a difference of sums so when we write the sums, some terms will go away, but I can't think of a way to write this one.
Can you help me?
UPDATE
I managed to show that the series is uniform convergent even if I do not know to who it converges. Still, I wonder if there is any way to calculate the sum of the series.
 A: $$\sum_{n\geq 1}\frac{\cos(nx)}{n^2} = \text{Re}\,\text{Li}_2(e^{ix})$$
is a periodic and piecewise-parabolic function, as the primitive of the sawtooth wave $\sum_{n\geq 1}\frac{\sin(nx)}{n}$.
Since $\cos^3(nx)=\frac{1}{4}\cos(3nx)+\frac{3}{4}\cos(nx)$ your function is a piecewise-parabolic function too.
In explicit terms it is a $2\pi$-periodic, even function which equals $\frac{3}{4}\left(x-\frac{\pi}{3}\right)\left(x-\frac{2\pi}{3}\right)$ over $[0,2\pi/3]$ and $\frac{3}{4}\left(x-\frac{2\pi}{3}\right)\left(x-\frac{4\pi}{3}\right)$ over $[2\pi/3,\pi]$.
This is very simple to derive by interpolation once the original series is evaluated at $x\in\left\{0,\frac{\pi}{3},\frac{2\pi}{3},\pi,\frac{4\pi}{3},\frac{5\pi}{3}\right\}$.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

"As the title says, I need to calculate the sum of the function series..."

\begin{equation}
\bbx{\mbox{It's clear that}\
\sum_{n=1}^{\infty}{\cos^{3}\pars{nx} \over n^{2}} = {\pi^{2} \over 6\phantom{^{2}}}\ \mbox{when}\
\braces{\verts{x} \over 2\pi} = 0}
\end{equation}

Hereafter, I'll consider the case
$\ds{\braces{\verts{x} \over 2\pi} \not= 0}$.
Lets $\ds{r \equiv 2\pi\braces{\verts{x} \over 2\pi}}$ with $\ds{r \in \left[0,2\pi\right)}$. Then
\begin{align}
&\bbox[10px,#ffd]{\sum_{n=1}^{\infty}{\cos^{3}\pars{nx} \over n^{2}}} =
\sum_{n=1}^{\infty}{\cos^{3}\pars{n\verts{x}} \over n^{2}} =
\sum_{n=1}^{\infty}{\cos^{3}\pars{nr} \over n^{2}} \\[5mm] = &\
\sum_{n=1}^{\infty}{\bracks{3\cos\pars{nr} + \cos\pars{3nr}}/4 \over n^{2}}
\\[5mm] = &\
{3 \over 4}\,\Re\sum_{n = 1}^{\infty}
{\pars{\expo{\ic r}}^{n}  \over n^{2}} +
{1 \over 4}\,\Re\sum_{n = 1}^{\infty}
{\pars{\expo{3\ic r}}^{n} \over n^{2}}
\\[5mm] = &\
{3 \over 4}\,
\Re\mrm{Li}_{2}\pars{\exp\pars{\ic r}} +
{1 \over 4}\,
\Re\mrm{Li}_{2}\pars{\exp\pars{\ic\tilde{r}}}
\\[2mm] &\
\mbox{where}\ 
\tilde{r} \equiv 2\pi\braces{3r \over 2\pi} =
2\pi\braces{3\braces{\verts{x} \over 2\pi}}
\end{align}
$\ds{\mrm{Li}_{s}}$ is the
Polylogarithm Function. Note that
$\ds{3r \in \left[0,6\pi\right)}$.

With
Jonqui$\grave{\mathrm{e}}$re Inversion Formula, it's found
\begin{align}
&\left.\bbox[10px,#ffd]{\sum_{n=1}^{\infty}{\cos^{3}\pars{nx} \over n^{2}}}\,\right\vert
_{\ \verts{x}/\pars{2\pi} \not=\ 0}
\\[5mm] = &\
\bbx{{3 \over 4}\,\bracks{\pi^{2}\,\mrm{B}_{2}\pars{\braces{\verts{x} \over 2\pi}}} +
{1 \over 4}\,\bracks{\pi^{2}\,
\mrm{B}_{2}\pars{\braces{3\braces{\verts{x} \over 2\pi}}}}}
\end{align}

$\ds{\mrm{B}_{n}}$ is a
  Bernoulli Polynomial.
  Note that
$\ds{\mrm{B}_{2}\pars{z} = z^{2} - z + {1 \over 6}}$.
  

