Showing two things are equal by Fourier series Given the Fourier series for the function:
$$f(x) = x+\frac14x^2 \quad -\pi\leq x \lt \pi$$
$$f(x)=f(x+2\pi) \quad -\infty \leq x \lt \infty$$
is
$$\frac{\pi^2}{12}+\sum \limits_{n=1}^\infty (-1)^n \left(\frac{\cos(nx)}{n^2}-\frac{2\sin(nx)}{n}\right)$$
show that$$\sum \limits_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$$

Now I hope this doesn't mean I have to calculate the Fourier series for this, since it seems to be given, since I had written down the Fourier coefficient for $a_0$ and most of $a_n$ and realised that this will simply be too time consuming in an exam!
If I sub in $x=2\pi$ for $f(2\pi)=2\pi + \pi^2$ and the fourier gives:
$$\frac{\pi^2}{12}+\sum \limits_{n=1}^\infty (-1)^n \left(\frac{\cos(2n\pi)}{n^2}-\frac{2\sin(2n\pi)}{n}\right)=\frac{\pi^2}{12}+\sum \limits_{n=1}^\infty (-1)^n \left(\frac{1}{n^2}\right)$$
$$2\pi + \pi^2=\frac{\pi^2}{12}+\sum \limits_{n=1}^\infty (-1)^n \frac{1}{n^2}$$
$$2\pi+\frac{11\pi^2}{12}=\sum \limits_{n=1}^\infty (-1)^n \frac{1}{n^2}$$
So this isn't right. Perhaps another value for $x$, how about $x=\pi$
$$\pi + \frac{\pi^2}{4}=\frac{\pi^2}{12}+\sum \limits_{n=1}^\infty (-1)^n \left(\frac{\cos(n\pi)}{n^2}-\frac{2\sin(n\pi)}{n}\right)$$
$$\pi + \frac{\pi^2}{4}=\frac{\pi^2}{12}+\sum \limits_{n=1}^\infty (-1)^n \left(\frac{(-1)^n}{n^2}\right)$$
$$\pi+ \frac{\pi^2}{6}=\sum \limits_{n=1}^\infty\frac{1}{n^2}$$
Almost correct, but I have an extra $\pi$ term. Is there a way I could have gotten this on the first guess, and how do I show it?
 A: Why not substitute $\;x=0\;$ to make things easier (though perhaps slightly longer)?
$$f(x)=x+\frac{x^2}4\implies f(0)=0=\frac{\pi^2}{12}+\sum_{n=1}^\infty (-1)^n\frac1{n^2}\implies$$
$$\implies\sum_{n=1}^\infty\frac{(-1)^{n+1}}{n^2}=\frac{\pi}{12}$$
But
$$\sum_{n=1}^\infty\frac{(-1)^{n+1}}{n^2}=1-\frac14+\frac19-\frac1{16}+\ldots=\sum_{n=1}^\infty\frac1{(2n-1)^2}-\sum_{n=1}^\infty\frac1{(2n)^2}=$$
$$=\sum_{n=1}^\infty\frac1{(2n-1)^2}-\frac14\sum_{n=1}^\infty\frac1{n^2}$$
and
$$\sum_{n=1}^\infty\frac1{n^2}=\sum_{n=1}^\infty\frac1{(2n-1)^2}+\sum_{n=1}^\infty\frac1{(2n)^2}\implies\frac34\sum_{n=1}^\infty\frac1{n^2}\stackrel *=\sum_{n=1}^\infty\frac1{(2n-1)^2}$$
So we finally get:
$$\frac{\pi^2}{12}=\sum_{n=1}^\infty\frac1{(2n-1)^2}-\frac14\sum_{n=1}^\infty\frac1{n^2}\stackrel *=\frac12\sum_{n=1}^\infty\frac1{n^2}$$
and the result follows at once.
A: Try $x = \pi$. When $x=\pi$, by Dirichlet Theorem (will look up which one), 
$$
f(\pi) = \frac{f(-\pi)+f(\pi)}{2} = \frac{\pi^2}{4}
$$
since you have a jump discontinuity at $x=\pi$ (see theorem).

This gives you
$$
\sum_{n=1}^{\infty}\frac{1}{n^2} + \frac{\pi^2}{12}=\frac{\pi^2}{4}
$$

Theorem: Let $f$ be periodic and piecewise differentiable. Then at each point $\theta$ the symmetric partial sum
$$
S_N(\theta) = \sum_{-N}^Na_ne^{in\theta}
$$ 
converges to $\frac{1}{2}(f(\theta +) + f(\theta -))$; if $f$ is continuous at $\theta$, then it converges to $f(\theta)$.
