Hi I am practicing fourier series and am doing a problem that asks you to use $f(x) = |x|$ to derive the series representation
$\frac{\pi^2}{8} = \sum_{n=1}^\infty \frac{1}{(2n-1)^2}$
What I have done so far is say that $f(x) = |x|$ is an even function so this will be a fourier cos series. Then I calculate the coefficients,
$a_o = \int_{-\pi}^{\pi} |x|dx = \pi^2$
$a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} |x|cos(nx)dx = \frac{\pi n sin(\pi n) + cos(\pi n) -1}{n^2} = \frac{cos(\pi n) -1}{n^2}$
So then the series representation is,
$|x| = \frac{\pi^2}{2} + \sum_{n=1}^\infty \frac{cos(\pi n) -1}{n^2} cos(nx)$
but I don't see how this can represent $\frac{\pi^2}{8}$, does anyone have any ideas about how I can proceed?