# Evaluating the integral $\int_{0}^{2\pi}dx\sin x e^{\cos^2 x}$

Is this correct?

$$\int_{0}^{2\pi}dx\sin x e^{\cos^2 x}$$

Let $u=\cos x$, thus $du=-\sin x dx$. My doubt is now. When $x\rightarrow0$, $u\rightarrow1$ and when $x\rightarrow2\pi$, $u\rightarrow 1$. So, $$\int_{0}^{2\pi}dx\sin x e^{\cos^2 x}=\int_{1}^{1}dx()=0?$$

• This is not really an answer to your difficulty, but an easy way to do this integral may suggest itself if you graph the integrand. – Malcolm Apr 8 '18 at 20:30

$$\int\mathrm{e}^{\cos^2{x}}\sin x\,\mathrm dx\tag{1}$$ Substitute $u = \cos x$, $\mathrm du = -\sin x\,\mathrm dx$ in $(1)$. $$\int\mathrm{e}^{\cos^2{x}}\sin x\,\mathrm dx = -\int \mathrm e^{u^2}\,\mathrm du = -\dfrac{\sqrt{\pi}}{2}\int \dfrac 2{\sqrt{\pi}}\mathrm e^{u^2}\,\mathrm du = -\dfrac{\sqrt{\pi}}{2}\operatorname{erf}(u)$$ Reverse substitution. $$\int\mathrm{e}^{\cos^2{x}}\sin x\,\mathrm dx = -\dfrac{\sqrt{\pi}}{2}\operatorname{erf}(\cos x)$$ Plug in the limits. $$-\dfrac{\sqrt{\pi}}{2}\operatorname{erf}(\cos x)\Bigg|_0^{2\pi} = -\dfrac{\sqrt{\pi}}{2}\left(\operatorname{erf(1)} - \operatorname{erf}(1)\right) = 0$$
The function $e^{\cos^2 x}$ is even about $\pi$: $f(\pi+x)=e^{(-\cos(x))^2}=f(\pi-x).$ Since $\sin(x)$ is odd around $\pi$, the integral is just 0.