<s>[INST] Fourier series of $f(x)=x^2+x$ ,$x\in(-\pi,\pi)$ Could you please help me solve this problem:
I need use Fourier series of $f(x)=x^2+x$ ,$x\in(-\pi,\pi)$ 
to prove that $\sum_{n\ge1} \frac 1{n^2}= \frac{\pi^2}6$.
I calculated the Fourier series:
$x^2+x=\frac {\pi^2}3+\sum_{n\ge1} \frac 4{n^2}(-1)^ncosnx-\frac 2n (-1)^n sinnx$.
And could not find any $-\pi<x<\pi$ that could solve my problem.
I double-checked my calculations and could not find any problem with the series, could you please give me some hint about my error ?
I know that we can calculate $\sum_{n\ge1} \frac 1{n^2}= \frac{\pi^2}6$ by using the Fourier expansion of $f(x)=x$ but I need to prove this using different function.
Thanks.
 [/INST] If we take $x = \pi$, the right hand side becomes
$$\frac{\pi^2}{3} + \sum_{n=1}^\infty \frac{4}{n^2},$$
which is very convenient to determine $\sum\limits_{n=1}^\infty \frac{1}{n^2}$ provided we know what the Fourier series converges to for $x = \pi$.
If $f$ has a jump discontinuity at $x_0$, and is otherwise well-behaved in a neighbourhood of $x_0$ - I can't remember the criteria off the top of my head, but Lipschitz continuity is sufficient - then the Fourier series converges to the arithmetic mean of the one-sided limits of $f$ at $x_0$.
Here, we have
$$\lim_{x\to \pi^-} f(x) = \pi^2 + \pi\quad \text{and} \quad \lim_{x\to \pi^+} f(x) = \pi^2 - \pi,$$
so the arithmetic mean is $\pi^2$, and
$$\pi^2 = \frac{\pi^2}{3} + \sum_{n=1}^\infty \frac{4}{n^2}$$
easily yields
$$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$$
If we don't know the convergence behaviour of Fourier series at (nice enough) jump discontinuities, the best we can do is evaluate at $x = 0$. Then we obtain
$$0 = \frac{\pi^2}{3} + 4\sum_{n=1}^\infty \frac{(-1)^n}{n^2},$$
which we rearrange to
$$\frac{\pi^2}{12} = \sum_{n=1}^\infty \frac{(-1)^{n-1}}{n^2} = \sum_{n=1}^\infty \frac{1}{n^2} - 2\sum_{m=1}^\infty \frac{1}{(2m)^2} = \biggl(1 - \frac{2}{4}\biggr)\sum_{n=1}^\infty \frac{1}{n^2},$$
from which we again obtain
$$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$$
</s>