let $ f: \mathbb{R} \rightarrow \mathbb{R} $ is a $ 2 \pi $ periodic function, that is even, and: $ \forall x \in [0, \pi]: f(x) = x $
What are the Fourier coefficient.
Since the function is pair, we will have: $b_n = 0$ and:
$ a_0 = \frac{1}{\pi} \int_{-\pi}^{\pi} x dx = 0 $
$ a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} x \cos(nx) dx = \frac{1}{\pi n^2} \int_{-\pi}^{\pi} \sin(nx) dx = 0$
Using integration by parts, I find $ 0 $, which is absurd since the function is pair. What am I missing? Thank you.
Assuming that $f(x)=-x$ if $x\in (-\pi, 0]$, then your coefficient is given by
$$ $ a_n = \frac{1}{\pi} \int_{0}^{\pi} x \cos(nx) dx + \int_{-\pi}^{0} -x \cos(nx) dx \neq 0. $$ You just forgot the minus sign for negative values of $x$.