$\int_0^{2\pi}e^{\cos x}\cos(\sin x)dx$ [duplicate]

Solution 1:

Note that

$$e^{\cos x}\cos (\sin x) = \operatorname{Re} \left(e^{\cos x}(\cos (\sin x) + i \sin (\sin x))\right) = \operatorname{Re} e^{\cos x + i \sin x}.$$

So we can transform the integral into a standard contour integral over the unit circle writing $z = e^{ix}$, which gives us $dx = \frac{dz}{iz}$, and the integral becomes

$$\operatorname{Re} \int_{\lvert z\rvert = 1} \frac{e^z}{iz}\,dz = \operatorname{Re} \frac{2\pi i e^0}{i} = 2\pi$$

by Cauchy's integral formula.