I don't know if I'm doing something wrong, I need to find the Fourier series of $f(x) = \cos (x) $ in $[- \pi , \pi ] $ but all the coefficients are giving me $0$.
First, clearly $b_n = 0 $ since $b_n = \frac{1}{\pi} \int^{\pi}_{-\pi} \cos(x) \sin (n x )dx = 0 $ because it's an odd function.
Then, $a_0 = \frac{1}{\pi} \int^{\pi}_{-\pi} \cos(x) dx = 0$ , I don't think there's a detail in this integral.
But, $a_n = \frac{1}{\pi} \int^\pi_{-\pi} \cos(x) \cos (nx )dx $ seems to have a detail I'm missing. I did the following:
$a_n = \frac{1}{\pi} \int^\pi_{-\pi} \cos(x) \cos (nx )dx = \frac{2}{\pi} \int^\pi_{0} \bigg[ \frac{1}{2} \cos ((n+1)x) + \frac{1}{2} \cos ((n-1)x) \bigg] dx = \frac{1}{\pi} \bigg[ \frac{1}{n+1} \sin ((n+1)x) + \frac{1}{n-1} \sin ((n-1)x) \bigg]_{0}^{\pi} = 0 $
I think I'm missing some detail in $a_n$ because I don't think my procedures were wrong in $a_0 $ and $b_n$. Any help is greatly appreciated. Thanks.
You did everything correctly except for $n=1$: Note that you're dividing by $n-1$ in the last equality.
Instead you'll get $$a_1=\frac{1}{\pi}\int_{-\pi}^{\pi}\cos^2(x)dx=\frac{1}{\pi}\int_{-\pi}^{\pi}\sin^2(x)dx=2-\frac{1}{\pi}\int_{-\pi}^{\pi}\cos^2(x)dx=2-a_1$$ by integration by parts. Thus, $a_1=1$.
This is also exactly what you should expect since the cosine is already a trigonometric polynomial.