# Fourier series and even extension of function

I'm trying to solve this exercise but I have some problems, because I haven't seen an exercise of this type before.

"$f(x)= \pi -x$ in $[0, \pi]$

Let's consider the even extension of f(x) in $[-\pi, \pi]$
and write the Fourier Series using this set ( $\frac{1}{\sqrt{2 \pi}}, \frac{1}{\sqrt {\pi}} \cos nx$ )
and use the Parseval identity to prove:
$\sum \frac{1}{(2k+1)^2}= \frac{\pi ^2}{8}$"

My attempt:

$a_0= \frac{1}{\sqrt {2 \pi}} \int_{-\pi}^{\pi} f(x)=\frac{1}{\sqrt {2 \pi}} \int_{-\pi}^{\pi} (\pi -x) dx= \frac{2 \pi^2}{\sqrt {2\pi}}$

$a_n= \frac{2}{\sqrt \pi}\int_{0}^{\pi} f(x)\cos nx dx=\frac{2}{\sqrt \pi} \frac{1-cos \pi n}{n^2}= \frac{2[1+(-1)^n]}{ \sqrt {\pi n^2}}$

So,

$f(x)=\frac{2 \pi^2}{\sqrt {2\pi}}+\sum_{n=1}^{\infty}\frac{2[1-(-1)^n]}{ \sqrt {\pi n^2}} \frac {\cos nx}{\sqrt \pi}$

Could you tell me if these steps are correct? Are the formulas for Fourier coefficients correct?

For the second part of the exercise, I have and enormous doubt:
It was told me that in similar cases, Parseval Identity is:

$\int_{-\pi}^{\pi} |f(x)|^2 dx= a_o^2+ \sum |a_n|^2$

I don't know how to do $|a_n|$, because there is the term $(-1)^n$..
And I have a lot of doubts to obtain the result ${\pi}^2/8$ using the results that I have obtained...

Many thanks for your precious help!

vela
Staff Emeritus