I calculated this integral below : $$ \int_{-\pi/2}^{\pi/2} \cos(x)\cos(nx) dx $$
And I got this result : $\dfrac{\left(\left(n-1\right)\sin\left(\frac{{\pi}n+{\pi}}{2}\right)+\left(n+1\right)\sin\left(\frac{{\pi}n-{\pi}}{2}\right)\right)}{n^2-1}$
I had a check at the end at the solution : $-\dfrac{2\cos\left(\frac{{\pi}n}{2}\right)}{n^2-1}$
So apparently there is some kind of simplification to do but I don't actually know how .