I am trying to compute Fourier coefficients for the function $f(x) = \cos x$. I have managed to solve that the coefficients "$c$" and "$b$" for the function are $0$. However, I am struggling to solve the following integral (in order to compute coefficient "a")
$$a_n =\frac{1}{π}\int_{-\pi}^{\pi}\cos(x)\cos(nx)dx$$
where n is a positive integer.
I have tried to solve the problem by using integration by parts but this gets me going around in circles. I have also tried to solve the integral using the cosine product-to-sum formula.
For context, I am facing this problem in a calculus textbook, not in the context of Fourier analysis . The purpose of the exercise is solely to practice integration techniques (I am not yet familiar with Fourier series or analysis).
Edit: here is what I get when using the product-to-sum formula: $$\frac{1}{2π}\frac{2\sin(\pi+\pi n)}{(1+n)}+\frac{1}{2π}\frac{2\sin(\pi-\pi n)}{(1-n)}$$
Recall that $$\cos(\theta+\varphi)=\cos\theta\cos\varphi-\sin\theta\sin\varphi$$ Therefore, we can show that $$\cos\theta\cos\varphi=\frac 12\bigr(\cos(\theta+\varphi)+\cos(\theta-\varphi)\bigr)$$ Setting $\theta=x$ and $\varphi=nx$ gives $$\int\limits_{-\pi}^{\pi}\mathrm dx\,\cos x\cos nx=\frac 12\int\limits_{-\pi}^{\pi}\mathrm dx\,\cos x(1+n)+\frac 12\int\limits_{-\pi}^{\pi}\mathrm dx\,\cos x(1-n)$$ Can you finish the rest?