What is the sign of the integral $\int_{0}^{2\pi}e^{\sin(x)}\cos(nx)\,dx$?

Using the results listed here we can show that $I_n=2\pi i^n{\cal I}_n(1)$ where ${\cal I}_n$ is the modified Bessel function of the first kind.


Here we will perform the derivation from scratch. Applying the unit circle transformation we have \begin{align}I_n&=\Re\int_0^{2\pi}e^{\sin x}e^{inx}\,dx=\Re\oint_{|z|=1}z^n\exp\left(\frac{z-1/z}{2i}\right)\,\frac{dz}{iz}\end{align} which we can expand as \begin{align}I_n&=\Re\oint_{|z|=1}\sum_{r=0}^\infty\left(\frac i2\right)^r\frac{z^{n-r-1}(1-z^2)^r}{i\cdot r!}\,dz=\Re\left[2\pi\operatorname{Res}(f,0)\right]\end{align} where $$f(z)=\sum_{r=0}^\infty\left(\frac i2\right)^r\frac{z^{n-r-1}(1-z^2)^r}{r!}.$$ To evaluate this residue we seek the term independent of $z$ in $zf(z)$. This occurs when the power of $1-z^2$ is $(r-n)/2$ which means that $r=2s$ is even. Hence \begin{align}\operatorname{Res}(f,0)&=\sum_{s=n/2}^\infty\left(\frac i2\right)^{2m}\frac{(-1)^{(2s-n)/2}}{(2s)!}\binom{2s}{(2s-n)/2}\\&=\sum_{s=n/2}^\infty\frac{(-1)^s}{2^{2s}}\frac{(-1)^{s-n/2}}{(s-n/2)!(s+n/2)!}.\end{align} Substituting back into the integral gives $$I_n=\sum_{s=n/2}^\infty\frac{(-1)^{n/2}\pi}{2^{2s-1}(s-n/2)!(s+n/2)!}=\sum_{t=0}^\infty\frac{(-1)^{n/2}\pi}{2^{2t+n-1}t!(t+n)!}=2\pi i^n{\cal I}_n(1)$$ and we can immediately conclude that $I_{4k}>0$ and $I_{4k+2}<0$.


If you just want to find the sign of the integral, you can do it directly as follows:

the substitution $x \to -x$ shows that

$\int_{0}^{2\pi}e^{\sin(x)}\cos(nx)\,dx=\int_{0}^{2\pi}e^{-\sin(x)}\cos(nx)\,dx$ but now for odd $n$ the substitution $x \to x+\pi$ sends $\int_{0}^{2\pi}e^{\sin(x)}\cos(nx)\,dx$ to $-\int_{0}^{2\pi}e^{-\sin(x)}\cos(nx)\,dx$ hence the integral is zero.

Using the well known (and easy to prove fact) that $\cos^q x=\sum c_{k,q}\cos kx, c_{kq} \ge 0, c_{q,q}>0$ it immediately follows that $\int_{0}^{2\pi}e^{\cos(x)}\cos(nx)\,dx >0$

(edited later - this follows by an easy induction since $2\cos a \cos b=\cos(a+b)+\cos(a-b)$ hence the coefficients stay non-negative if they start so; we have $\cos^2x=(\cos 2x+1)/2$ and then $\cos^3x=\cos x (\cos 2x+1)/2=...$ and all the terms remain non-negative when expanded, while the highest order term in $\cos^q x$ is clearly $\cos qx$ with coefficient $1/2^{q-1}$ since that appears only once in the inductive computation with half the previous highest term coefficient; then using that $e^{\cos x}=\sum \frac{\cos^qx}{q!}$ with uniform convergence in $[0, 2\pi]$ we can integrate term by term and all the coefficients of $\cos nx$ that appear in the expansions are non-negative while at least the one from $\cos^n x$ is positive, so the integral is positive by orthognality of the cosines)

But the substitution $x \to \pi/2-x$ sends $\int_{0}^{2\pi}e^{\sin(x)}\cos(nx)\,dx$ into $(-1)^{n/2}\int_{0}^{2\pi}e^{\cos(x)}\cos(nx)\,dx$ for even $n$ hence the required sign result follows.