Need help with an integral. I am asked to show that
$\displaystyle \frac{1}{2\pi} \int_{0}^{2\pi} e^{2 \cos \theta} \cos \theta \, d\theta = 1 + \frac{1}{2!} + \frac{1}{2!3!} + \frac{1}{3!4!} + \cdots$
by considering $\displaystyle \int e^{z + \frac{1}{z}} \, dz$. I don't really know how to incorporate the hint, and any advice would be appreciated. Thanks!
 A: Hint: the usual way to attempt a real integral from $0$ to $2\pi$ by using complex methods is to substitute $z=e^{i\theta}$.  At some stage you may need to take the real part or imaginary part of a complex integral.
A: Spelling out David's hint, if $z=e^{i\theta}$ then $dz=i\,e^{i\theta}\,d\theta=i(\cos\theta+i\,\sin\theta)\,d\theta$, and we have  $z+\displaystyle\frac1z=2\cos\theta$.
Now
$$\frac1{2\pi}\int_0^{2\pi}e^{2\cos\theta}\,\cos\theta\,d\theta = 
\frac1{2\pi i}\Im\oint e^{z+\frac1z}\,dz
$$
which can be evaluated by the residue theorem: look for the coefficient of $z^{-1}$ in the Laurent-series of $e^z\,e^{\frac1z}$.
A: let $z = e^{i \theta}$ in $\oint e^{z + \frac{1}{z}} \, dz$, you most likely get $\int_{0}^{2\pi} e^{2 \cos \theta} \cos \theta \, d\theta$ as imaginary part of it.
Now consider $ \displaystyle \oint_{|z|=1} e^{z + \frac 1 z}dz $ look for it's residue by expanding it.
\begin{align*}
e^{\left( z + \frac 1 z \right)} &= \sum_{n=0}^\infty \frac{\left( z + \frac 1 z \right)^n}{n!}  \\ 
 &= \sum_{n=0}^\infty \frac{1}{n!} \sum_{k=0}^n \binom{n}{k}z^k z^{-n+k}\\ 
 &= \sum_{n=0}^\infty \frac{1}{n!} \sum_{k=0}^n \binom{n}{k}z^{2k - n}\\
\end{align*}
Set $2k - n=-1 $, since $k$ is integer, let $n = 2m + 1$, you get $k = m$ and and you get
$ \left( \sum_{m=0}^\infty  \frac{1}{m! (m+1)!}\right)z^{-1}$. Use residue theorem after that.
