Finding the value of $\frac{1}{2\pi} \int_{0}^{2\pi} e^{\cos(\theta)}\cos(n\theta) d\theta$ I wanted to find the value of $$\frac{1}{2\pi} \int_{0}^{2\pi} e^{\cos(\theta)}\cos(n\theta) d\theta:(n \in \mathbb{N}  )$$
I believe it is the real part of the following integral:
$$\frac{1}{2\pi} \int_{0}^{2\pi} e^{\cos(\theta)}\cdot e^{\operatorname{in}\theta} d\theta$$
using substitution $z=e^{i\theta}$, I was able to rewrite it as the following contour integral:
$$\frac{1}{2\pi i} \oint_{\|z\|=1}e^{\frac{z+\frac{1}{z}}{2}}\cdot z^{n-1}dz$$
The only poles inside the contour are at $z=0$, but I can't think of an easy way to find the residue of that function at that pole. How do I evaluate that final integral?
 A: We can use the following representation:
$$
\exp\left(\frac{x}{2}\left(z+\frac{1}{z}\right)\right) = \sum\limits_{m=-\infty}^{+\infty} I_m(x) z^m,
$$
where $I_m$ where is the modified Bessel function of the first of order $m$.
This implies
$$
\exp\left(\frac{1}{2}\left(z+\frac{1}{z}\right)\right) = \sum\limits_{m=-\infty}^{+\infty} I_m(1) z^m.
$$
Clearly, that
$$
z^{n-1} \exp\left(\frac{1}{2}\left(z+\frac{1}{z}\right)\right) = \sum\limits_{m=-\infty}^{+\infty} I_m(1) z^{m+n-1}.
$$
This let us calculate residue
$$
\mathop{\mathrm{Res}}_{z=0} \left(z^{n-1} \exp\left(\frac{1}{2}\left(z+\frac{1}{z}\right)\right)\right)=I_{-n}(1).
$$
So,
$$\frac{1}{2\pi i} \oint_{||z||=1}e^{\frac{z+\frac{1}{z}}{2}}\cdot z^{n-1}dz = \frac{1}{2\pi i} \times 2\pi i I_{-n}(1) = I_{-n}(1),
$$
and
$$\frac{1}{2\pi} \int_{0}^{2\pi} e^{\cos(\theta)}\cos(n\theta) d\theta = \mathfrak{Re}(I_{-n}(1)) = I_{-n}(1).
$$
Btw, on  Wolfram MathWorld there is the definition
$$
I_n(z)=\frac{1}{2 \pi i} \oint \exp\left(\frac{z}{2}\left(t+\frac{1}{t}\right)\right)t^{-n-1}dt,
$$
where the contour encloses the origin and is traversed in a counterclockwise direction. This allows to write the answer directly.
