Parseval Identity and Fourier Series Question on function $f(x)=|x|$ Trying to compute the fourier series for $f(x)=|x|$ for $f$ on $[- \pi, \pi]$ using the trig method. I have a question as to the absolute value function.
I'm using the definition of absolute value where $|x|=x$ if $x \ge 0$, and $|x|=-x$ if $x <0 $. Therefore, $$a_0=\int_{-\pi}^{\pi}f(t) dt=\int_{-\pi}^0-t dt+\int_0^{\pi}tdt$$
I want to ask if this is the correct approach because I'm not getting the numerical series $\frac{\pi^4}{96}$ when I use the parseval identity so either I'm doing an arithmetic mistake with this tideous problem or my limits of integration are wrong therefore my $a_n$ and $b_n$ are wrong. Any help is greatly appreciated. Thank you.

 A: You should have:
$$\begin{align*}a_0&=\frac1\pi\int\limits_{-\pi}^\pi|x|dx=\frac2\pi\int\limits_0^\pi xdx=\pi\\{}\\
a_n&=\frac1\pi\int\limits_{-\pi}^\pi |x|\cos nx\,dx=\frac2\pi\int\limits_0^\pi x\cos nx\,dx=\\{}\\&=\overbrace{\left.\frac2{n\pi}x\sin nx\right|_0^\pi}^{=0}-\frac2{n\pi}\int\limits_0^\pi\sin nx\,dx=\frac2{n^2\pi}\left((-1)^n-1\right)=\begin{cases}\;\;\;\;\;\,0&,\;\;n\;\text{is even}\\{}\\-\frac4{n^2\pi}&,\;\;n\;\text{is odd}\end{cases}\end{align*}$$
So for example, for any $\;x\;$ not at the extreme points of the periodicity intervals, we have
$$f(x)=|x|=\frac\pi2-\sum_{n=0}^\infty\frac4{(2n+1)^2\pi}\cos nx$$
In particular, for $\;x=0\;$ we get
$$\frac\pi2=\frac4{\pi}\sum_{n=0}^\infty\frac1{(2n+1)^2}\implies\sum_{n=0}^\infty\frac1{(2n+1)^2}=\frac{\pi^2}8$$
which is equivalent with
$$\sum_{n=1}^\infty\frac1{n^2}=\frac{\pi^2}6$$
Now, using Parseval's Identity, we get:
$$\frac{2\pi^2}3=\frac1\pi\int\limits_{-\pi}^\pi \overbrace{x^2}^{=f(x)^2}dx=\frac12\pi^2+\sum_{n=0}^\infty\frac{16}{n^4\pi^2}\implies\frac{\pi^2}6=\frac{16}{\pi^2}\sum_{n=0}^\infty\frac1{(2n+1)^4}$$
which is equivalent with
$$\sum_{n=1}^\infty\frac1{n^4}=\frac{\pi^4}{90}$$
