So I need to verify
$$\sum_{n=1}^\infty \frac{1}{n^2}=\frac{\pi^2}{6}.$$
Using Parsevals identity on $f(x)=x$ on $[0,2\pi)$. Does this mean if $a_n$ are the Fourier coefficients then
$$\sum_{n=-\infty}^\infty \vert a_n \vert^2 = \frac{1}{2\pi} \int_0^{2\pi} x^2 dx.$$
Where
$$a_n=\frac{1}{2\pi}\int_0^{2\pi} f(x) e^{-inx}dx.$$
But this becomes just $\frac{1}{2\pi}\int_0^{2\pi} xe^{-inx}dx.$ which I computed using IBP to being $-\frac{1}{in}$. (Though this is not the answer on integral calculators). Then do I take the absolute value of $-\frac{1}{in}$ and square it to get $\frac{1}{n^2}$ which has value $\frac{1}{2\pi}\int_0^{2\pi}x^2dx$ but this becomes $\frac{2 \pi^2}{3}$. Where Am I going wrong?? Can someone please help me see why I don’t get the desired result ?
You seem to be comparing the sum over the integers directly with the sum over the natural numbers. You need to first calculate $a_0$ separately,
\begin{eqnarray*} a_0 &=& \frac1{2\pi}\int_0^{2\pi}f(x)\,\mathrm dx\\ &=& \frac1{2\pi}\int_0^{2\pi}x\,\mathrm dx\\ &=& \pi\;, \end{eqnarray*}
and then actually perform the sum over the integers (using $|a_{-n}|=|a_n|$):
\begin{eqnarray*} \sum_{n=-\infty}^\infty|a_n|^2 &=& |a_0|^2+2\sum_{n=1}^\infty|a_n|^2 \\ &=& \pi^2+2\sum_{n=1}^\infty\frac1{n^2}\;. \end{eqnarray*}
Then using
\begin{eqnarray*} \sum_{n=-\infty}^\infty|a_n|^2 &=& \frac1{2\pi}\int_0^{2\pi}x^2\,\mathrm dx \\ &=& \frac {(2\pi)^2}3 \end{eqnarray*}
(you were missing either a factor of $2$ or a pair of parentheses there), you get
$$ \frac{(2\pi)^2}3=\pi^2+2\sum_{n=1}^\infty\frac1{n^2} $$
and thus
$$ \sum_{n=1}^\infty\frac1{n^2}=\frac{\pi^2}6\;. $$