I want to compute this integral $$\int_{-\frac{\pi}{2}}^\frac{\pi}{2} \cos(x)\,e^{-inx} dx $$ to determine the fourier coefficients of $$y(x)=\max(\cos(x),0)$$ In order to calculate the sum of $$ \sum_{1}^\infty \frac{(-1)^n}{4n^{2}-1} $$
When I calculate the coefficients, I rewrite $\cos(x)$ in terms of exponentials: $$ \int_{-\frac{\pi}{2}}^\frac{\pi}{2} \frac{e^{ix}+e^{-ix}}{2}e^{-inx}\,dx $$
I'm able to integrate this integral, but I get something really messy in the end with several cases..not able to solve it in order to get something useful to compute the sum.