# On $\int_0^{2\pi}e^{\cos2x}\cos(\sin2x)\ \mathrm{d}x=2\pi$

Here's my attempt at an integral I found on this site. $$\int_0^{2\pi}e^{\cos2x}\cos(\sin2x)\ \mathrm{d}x=2\pi$$ I'm not asking for a proof, I just want to know where I messed up

Recall that, for all $$x$$, $$e^x=\sum_{n\geq0}\frac{x^n}{n!}$$ And $$\cos x=\sum_{n\geq0}(-1)^n\frac{x^{2n}}{(2n)!}$$ Hence we have that \begin{align} \int_0^{2\pi}e^{\cos2x}\cos(\sin2x)\ \mathrm{d}x=&\int_0^{2\pi}\bigg(\sum_{n\geq0}\frac{\cos^n2x}{n!}\bigg)\bigg(\sum_{m\geq0}(-1)^m\frac{\sin^{2m}2x}{(2m)!}\bigg)\mathrm{d}x\\ =&\sum_{n,m\geq0}\frac{(-1)^m}{n!(2m)!}\int_0^{2\pi}\cos(2x)^n\sin(2x)^{2m}\mathrm{d}x\\ =&\frac12\sum_{n,m\geq0}\frac{(-1)^m}{n!(2m)!}\int_0^{4\pi}\cos(t)^n\sin(t)^{2m}\mathrm{d}t\\ \end{align} The final integral is related to the incomplete beta function, defined as $$B(x;a,b)=\int_0^x u^{a-1}(1-u)^{b-1}\mathrm{d}u$$ If we define $$I(x;a,b)=\int_0^x\sin(t)^a\cos(t)^b\mathrm{d}t$$ We can make the substitution $$\sin^2t=u$$, which gives \begin{align} I(x;a,b)=&\frac12\int_0^{\sin^2x}u^{a/2}(1-u)^{b/2}u^{-1/2}(1-u)^{-1/2}\mathrm{d}u\\ =&\frac12\int_0^{\sin^2x}u^{\frac{a-1}2}(1-u)^{\frac{b-1}2}\mathrm{d}u\\ =&\frac12\int_0^{\sin^2x}u^{\frac{a+1}2-1}(1-u)^{\frac{b+1}2-1}\mathrm{d}u\\ =&\frac12B\bigg(\sin^2x;\frac{a+1}2,\frac{b+1}2\bigg)\\ \end{align} Hence we have a form of our final integral: \begin{align} I(4\pi;2m,n)=&\frac12B\bigg(\sin^24\pi;\frac{2m+1}2,\frac{n+1}2\bigg)\\ =&\frac12B\bigg(0;\frac{2m+1}2,\frac{n+1}2\bigg)\\ =&\frac12\int_0^0t^{\frac{2m-1}2}(1-t)^{\frac{n-1}2}\mathrm{d}t\\ =&\,0 \end{align} Which implies that $$\int_0^{2\pi}e^{\cos2x}\cos(\sin2x)\ \mathrm{d}x=0$$ Which is totally wrong. But as far as I can tell, I haven't broken any rules. Where's my error, and how do I fix it? Thanks.

You cannot substitute $$u=\sin^2t$$. As $$t$$ ranges from $$0$$ to $$2\pi$$, this is not a one-to-one relationship.

It's like if you subbed $$u=x^2$$ in $$\int_{-1}^1x^2\,dx$$ You would get an integral from $$u=1$$ to $$u=1$$, which would be $$0$$ even though the integral is clearly nonzero.

• What do you recommend I do instead? Dec 1, 2018 at 4:41
• I don't know. The question explicitly asks for "where I messed up". It's not asking for the right way to calculate this integral. Dec 1, 2018 at 4:42
• You're right. Thank you. Dec 1, 2018 at 4:43
• @clathratus I have not read you solution but in case of an even function $f(x)$, $\int_{-a}^{+a}f(x)dx=2\int_0^af(x)dx$ Dec 1, 2018 at 4:59
• What does $\cos \sin 2 x$ mean? Dec 1, 2018 at 7:00

To solve the integral, you may consider $$\int_{C} \frac{e^z}{z}dz$$ where $$C$$ is a unit circle, and see its real part.

If you want a full solution of the integral using complex analysis, going along the lines of what Seewoo Lee recommend, you can solve the integral as follows:

First consider the integral $$\int_{C} \frac{e^z}{z}dz$$

where $$C$$ is the unit circle oriented counter-clockwise in the complex plane. Using the Cauchy Integral formula (from complex analysis) you can find that $$\int_{C} \frac{e^z}{z}dz = 2\pi i \phantom{------}(1)$$

Now we will directly integrate the above integral by parametrising $$C$$. Let $$z(t)=e^{2it}$$ with $$0 \le t \le \pi$$ be the parametrisation of $$C$$. Then the integral works out as:

\begin{align} \int_{C} \frac{e^z}{z}dz &= \int_0^{\pi} \frac{e^{e^{2it}}}{e^{2it}} 2ie^{2it} dt \\ &= 2i \int_0^{\pi} {e^{\cos(2t)+i\sin(2t)}}dt \\ &= 2i \int_0^{\pi} {e^{\cos(2t)}e^{i\sin(2t)}}dt \\ &= 2i \int_0^{\pi} {e^{\cos(2t)}(\cos(\sin(2t))+i\sin(\sin(2t))} dt \\ &= 2i \int_0^{\pi} {e^{\cos(2t)}}(\cos(\sin(2t))dt - 2 \int_0^{\pi} {e^{\cos(2t)}}(sin(sin(2t)) dt \phantom{-------} (2) \\ \end{align}

Equating imaginary parts of (1) and (2) we see that:

$$\int_0^{\pi} {e^{\cos(2t)}}(\cos(\sin(2t))dt = \pi$$

If we parametrise the curve initially with $$\pi \le t \le 2\pi$$ we would have ended up with:

$$\int_{\pi}^{2\pi} {e^{\cos(2t)}}(\cos(\sin(2t))dt = \pi$$

Thus,

\begin{align} \int_{0}^{2\pi} {e^{\cos(2t)}}(\cos(\sin(2t))dt &= \int_{0}^{\pi} {e^{\cos(2t)}}(\cos(\sin(2t))dt + \int_{\pi}^{2\pi} {e^{\cos(2t)}}(\cos(\sin(2t))dt \\ &= \pi + \pi = 2\pi \end{align}

you could try this: $$I=\int_0^{2\pi}e^{\cos(2x)}\cos\left[\sin(2x)\right]dx$$ $$=\Re\left(\int_0^{2\pi}e^{\cos(2x)}\cos\left[\sin(2x)\right]dx+i\int_0^{2\pi}e^{\cos(2x)}\sin\left[\sin(2x)\right]dx\right)$$ $$=\Re\left(\int_0^{2\pi}e^{\cos(2x)}e^{i\sin(2x)}dx\right)$$ $$=\Re\left(\int_0^{2\pi}e^{\cos(2x)+i\sin(2x)}dx\right)$$ $$=\Re\left(\int_0^{2\pi}e^{e^{2ix}}dx\right)$$ and since: $$e^y=\sum_{n=0}^\infty\frac{x^n}{n!}$$ we can say that: $$e^{e^{2ix}}=\sum_{n=0}^\infty\frac{e^{2nix}}{n!}$$ and so: $$I=\Re\int_0^{2\pi}\sum_{n=0}^\infty\frac{e^{2nix}}{n!}dx$$ $$=\Re\sum_{n=0}^\infty\left[\frac{e^{2nix}}{2ni.n!}\right]_0^{2\pi}$$ $$=\Re\sum_{n=0}^\infty\frac{e^{4\pi ni}-1}{2ni.n!}$$ but note that for all integers n, $$e^{4\pi ni}=1$$ so this summation may be hard to calculate (or wrong). This is probably due to the fact that the integral is between $$0$$ and $$2\pi$$, so the integral may need to be split up into several parts before it can be evaulated.

• Neat approach for sure! Thanks for sharing (+1). Dec 2, 2018 at 19:03

If by $$\cos \sin (2 x)$$ you really mean $$\cos (2 x ) \sin (2 x)$$, then the full function looks like

and the full integral is $$0$$.

$$\int\limits_{x=0}^{2 \pi} e^{\cos (2 x)} \cos \left( \sin ( 2 x)\right)\ dx$$

the graph is:

and Mathematica gives the answer as $$2 \pi$$.

• I believe that the function is $\cos(\sin(2x))$.
– robjohn
Dec 1, 2018 at 7:24
• Really? Then the OP is not very careful with mathematical notation. Dec 1, 2018 at 7:41
• I prefer to write $\cos(x)$, but many write $\cos x$ even though that often leads to confusion. However, inserting an extra $2x$ into the formula to get $\cos(2x)\sin(2x)$ seems questionable.
– robjohn
Dec 1, 2018 at 8:18
• I did mean $\cos(\sin(2x))$. Sorry for the confusion. I appreciate the thoroughness of your answer though (+1) Dec 1, 2018 at 20:13