Using Fourier Analysis to solve Basel Problem Let $f$ be the $1$-periodic function such that $f(x)=x$ for $x \in [0, 1)$.
Compute the Fourier coefficient $\hat{f}(n)$ for every $n\in \mathbb{Z}$ and use Parseval’s theorem to derive the formula
$$\sum^{\infty}_{n=1} \frac{1}{n^{2}}=\frac{\pi^{2}}{6}.$$
We have that
$$\hat{f}(n)=\int^{1}_{0}xe^{-2\pi inx}dx=\frac{-xe^{-2\pi inx}}{2\pi in} \Big|^{1}_{0}+\int^{1}_{o} \frac{e^{-2\pi inx}}{2\pi in}dx= \frac{-1}{2\pi in}+\frac{e^{-2\pi inx}}{4\pi^{2}n^{2}}\Big|^{1}_{0}=\frac{i}{2\pi n}.$$
By Parseval's theorem, we have that
$$ ||f||^{2}_{2}=\sum^{\infty}_{-\infty}|\hat{f}(n)|^2 $$
Then $|\hat{f}(n)|^2=|\frac{i}{2\pi n}|^2=(\frac{1}{2\pi n})^2=\frac{1}{4\pi^2 n^2}$. But then,
$$\int^{1}_{0}x^2dx=2\sum^{\infty}_{n=0}\frac{1}{4\pi^2 n^2}$$
$$\frac{1}{3}=\sum^{\infty}_{n=0}\frac{1}{2\pi^2 n^2} $$
$$\frac{2\pi^2}{3}=\sum^{\infty}_{n=0}\frac{1}{n^2} $$
This obviously isn't the correct answer. Can anyone please tell me what I did wrong?

We have 
$$\frac13 = |\hat{f}(0)|^2 + 2\sum_{n=1}^\infty \frac{1}{4 \pi^2n^2}$$
where $\hat{f}(0) = \int_0^1 x \, dx$.
