So i Have created a Fourier as $$f(x)=\frac{1}{3} + \sum^{\infty}_{n=1}(\frac{-4}{n^{2} \pi^{2}}\cos(n \pi x))$$ and i believe i can rearrange this to: $$ f(x) = \frac{1}{3} - \frac{4}{\pi^{2}}\sum^{\infty}_{n=1} \frac{1}{n^2}\cos(n \pi x)$$ Now how would i use this to get a answer for $$S = \sum^{\infty}_{k=1} \frac{1}{k^{2}} $$ So by taking a suitable point x. Can i use x=0, giving $\cos(n \pi x)=1$ Giving the equation: $$f(0)=\frac{1}{3}-\frac{4}{\pi^{2}}\sum^{\infty}_{k=1}\frac{1}{k^{2}}$$ and rearrange this to (using$\quad f(0)=0)$: $$\frac{\pi^{2}}{12} = \sum^{\infty}_{k=1}\frac{1}{k^{2}}$$
Would this be the right final answer for the approximation of this sum? Any help would be appreciated thanks in advance.
Your 1/3 is wrong. It has to be 2/3: $$ a_0 = \frac 2 P\int_0^P f(x)\,dx = \int_0^2 (2x-x^2)\,dx = \left[x^2 - \frac 1 3 x^3\right]_0^2 = 4 - \frac 8 3 = \frac 4 3. $$ So, $\frac{a_0}2 = \frac 2 3$. For the other coefficients we get $$ a_n = \int_0^2 (2x-x^2)\cos(n\pi x)\,dx = -\int_0^2 x^2\cos(n\pi x)\,dx, $$ because $x\cos(n\pi x)$ is odd with resp. to $1$ (not $0$ as usual). Now, \begin{align*} \int_0^2 x^2\cos(n\pi x)\,dx &= \left[\frac{x^2}{n\pi}\sin(n\pi x)\right]_0^2 - \frac 2{n\pi}\int_0^2 x\sin(n\pi x)\,dx\\ &= -\frac 2 {n\pi}\left( \left[-\frac x {n\pi}\cos(n\pi x)\right]_0^2 + \frac 1 {n\pi}\int_0^2\cos(n\pi x)\,dx \right)\\ &= \frac 4 {n^2\pi^2}, \end{align*} hence $a_n = -4/(n^2\pi^2)$.