Sum function of a series Does anyone know what is the sum function $f(x)$ of the series $\displaystyle\sum_{n=1}^\infty \frac{\cos(nx)}{n^2}$? I have no idea how to find a sum function... Any help would be appreciated.
 A: Another method:
Define $$f:(0,2\pi)\to \mathbb{R},\ f(x)=\sum_{n\ge 1}\frac{\cos nx}{n^2}$$Then it easily follows that  $$\frac{d^2 f}{dx^2}=-\sum_{n\ge 1}\cos nx=\frac{1}{2}\implies f(x)=x^2/4+Bx+C$$ Note that the equalities are in $L^2$ sense. Then $f(0)=C\implies C=\frac{\pi^2}{6}$ and $f(2\pi)=\pi^2+C+2\pi B=\pi^2/6\implies B=-\pi/2\implies f(x)=x^2/4-\pi x/2+\pi^2/6 $. Then by periodicity we can extend the domain of $f$ to the whole real line.
A: Hint: Fourier series.  The derivative is a "sawtooth" function.
A: Use the Fourier series expasion of a function $g(x)$:
$$g(x) = \sum_{n=-\infty}^{+\infty} e^{ i n x} c_n$$
where
$$ c_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}e^{inx} g(x) dx.$$
Calculate the coefficients of the functions: $x^2,x,c$. $f$ will be a linear combination of these. 
$$ f(x) = \alpha x^2 +\beta x +\gamma$$
thus $c_n(f) = \alpha c_n(x^2) +\beta c_n(x) +\gamma \overset{!}{=} \frac{1}{n^2}$. Solve for the coefficients $\alpha,\ \beta,\ \gamma$.
A: Consider
$$g(x) = \sum_{n=1}^\infty \frac{e^{inx}}{n^2}$$
so that $\Re g(x) = f(x)$. Now,
$$g'(x)= i\sum_{n=1}^\infty \frac{e^{inx}}{n} = -i\log(1-e^{ix})$$
which converges, since we know $\sum x^n/n$ converges when $|x|\le 1$. Taking the real part of $g'$:
$$\Re \left(-i\log(1-e^{ix})\right) = \arg (1-e^{ix}) = -\arctan\left(\cot\left(\frac x2\right)\right)$$
which is just a periodic set of lines in the form $y=(x-\pi)/2$ with a period of $w\pi$. Integrating this, we get
$$f(x) = \frac{x^2}{4}-\frac{\pi}{2}x+C$$
since $f(0) = \pi^2/6$, we finally get
$$f(x) = \frac{x^2}{4}-\frac{\pi}{2}x+\frac{\pi^2}{6}$$
for $x\in[0, 2\pi]$. The rest of the function is defined by $2\pi$-periodicity.
