I am trying to find the Fourier coefs of even extension of $cos^2(\pi x /L)$ which is defined over $0\leq x \leq L$.
So since the function is even it only has $a_0$ and $a_n$ as cosine series expansion. I find $a_0$ to be 0.5 which is fine, but when I find $a_n$ I come to zero, which does not make sense and I do not know what I am doing wrong.
Basically, I write
$a_n=\frac{1}{2L} \int_{-L}^{L} cos^2(\pi x /L) cos(n\pi x/L)$
even I put this in a software to calculate the integral, I got similar to the one I found by hand, which has all sine terms which at $\pm L$ give zero so that's why I come to zero values for $a_n$.
I don't see what I doing wrong