Integrating $\int_0^{2\pi}e^{\cos{(x)}}\cos{(\sin{(x)})}\,dx$. Antiderivative evaluates out to be $0$ when it clearly isn't.

459 Views Asked by At

I have a function $$f(x)=e^{\cos{(x)}}\cos{(\sin{(x)})}$$ that I want to integrate from $0$ to $2\pi$.

Using Mathematica, the indefinite integral evaluates out to be $$\frac{-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix})}{2}+C$$ where $\operatorname{Ei}(x)$ is the exponential integral.

When I ask Mathematica the definite integral directly, it gives a $2\pi$, but when I try to use the fundamental theorem of calculus, $$\implies\left.\frac{-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix})}{2}\right|^{2\pi}_0=\frac{-i\operatorname{Ei}(e^{2\pi\cdot i})+i\operatorname{Ei}(e^{2\pi\cdot -i})}{2}-\frac{-i\operatorname{Ei}(e^{0i})+i\operatorname{Ei}(e^{-0i})}{2}$$ $$\implies\frac{-i\operatorname{Ei}(1)+i\operatorname{Ei}(1)}{2}-\frac{-i\operatorname{Ei}(1)+i\operatorname{Ei}(1)}{2}=0$$

Why do I get an incorrect value of 0 when I try to use the fundamental theorem of calculus on this integral?

4

There are 4 best solutions below

3
On BEST ANSWER

$$I= \int_{0}^{2\pi} e^{\cos x}\cos{(\sin x)} dx $$

From the Euler's formula:

$$I= \int_{0}^{2\pi} e^{\cos x}\left[\frac{e^{i\sin x}+e^{-i \sin x}}{2}\right] dx = \frac{1}{2} \int_{0}^{2\pi} \left[e^{\cos x + i \sin x} + e^{\cos x - i \sin x}\right] dx = \frac{1}{2} \int_{0}^{2\pi} \left[e^{\cos x + i \sin x} + e^{\cos(-x) + i \sin (-x)}\right] dx = \frac{1}{2} \int_{0}^{2\pi} \left[e^{e^{ix}} + e^{e^{-ix}}\right] dx $$

If we do the change of variable (see Appendix)

$$e^{ix} = z$$ $$dx = \frac{dz}{zi}$$

$$I= \frac{1}{2} \int_{0}^{2\pi} \left[e^{e^{ix}} + e^{e^{-ix}}\right] dx = \frac{1}{2i}\oint_{|z|=1} \frac{e^{z}+e^{\frac{1}{z}}}{z} dz = \underbrace{\frac{1}{2i}\oint_{|z|=1} \frac{e^{z}}{z} dz}_{A} +\underbrace{\frac{1}{2i}\oint_{|z|=1}\frac{e^{\frac{1}{z}}}{z} dz}_{B} $$

Now, apply the Cauchy's integral formula for A : $$f(a)=\frac{1}{2\pi\mathrm{i}}\oint_C \frac{f(z)}{z-a}\mathrm{d}z$$

with $f(z) = e^{z}$, $a= 0$ and $C$ the unit circle:

$$A = \frac{1}{2i}\oint_{|z|=1} \frac{e^{z}}{z} dz = \pi $$

For $B$, use the residue theorem

Expand $\displaystyle \frac{e^{\frac{1}{z}}}{z}$:

$$\frac{e^{\frac{1}{z}}}{z} = \frac{1}{z}+\frac{1}{z^2}+\frac{1}{z^32!}+\frac{1}{z^43!}+...$$

Therefore $\displaystyle \operatorname{Res}\left(\frac{e^{\frac{1}{z}}}{z} ,0\right) = 1$

Then

$$B = \frac{1}{2i}\oint_{|z|=1}\frac{e^{\frac{1}{z}}}{z} dz = \pi \operatorname{Res}\left(\frac{e^{\frac{1}{z}}}{z} ,0\right) = \pi $$ \

Hence

$$\boxed{ I = \int_{0}^{2\pi} e^{\cos x}\cos{(\sin x)} dx = 2\pi }$$

Appendix

This method will be useful in evaluating definite integrals of the type

$$\int_{0}^{2\pi} F(e^{i\theta})d\theta$$

The fact that $\theta$ varies from $0$ to $2\pi$ suggest that we consider $\theta$ as an argument of a point $z$ on the unit circle $C = \left\{ z \Big| |z|=1\right\}$ centered at the origin; hence we write $z =e^{i\theta} \quad 0 \leq \theta \leq 2\pi$. When we make this substitution using the equations:

$$ e^{i\theta} = z$$ $$d\theta = \frac{dz}{zi}$$

The integral becomes the contour integral

$$\int_{0}^{2\pi} F(e^{i\theta})d\theta = \oint_{|z|=1} F(z)\frac{dz}{zi}$$

Conversely, if we have the complex function:

$$f(z) = \frac{F(z)}{zi}$$

and the contour $\gamma(\theta) = e^{i\theta} \quad 0\leq \theta\leq 2\pi$. By definiton, the contour integral in $\gamma(\theta)$ is:

$$\oint_{\gamma} f(z) dz = \int_{0}^{2\pi} f(\gamma(\theta))\gamma'(\theta) d\theta = \int_{0}^{2\pi} \frac{F(e^{i\theta})}{e^{i\theta}i} ie^{i\theta} d\theta = \int_{0}^{2\pi} F(e^{i\theta}) d\theta $$

So, whenever you find an integral of the type $\int_{0}^{2\pi} F(e^{i\theta}) d\theta$ try to evaluate it converting it in a contour integral and then applying the techniques of complex integration.

0
On

Both the comments above show why the computation failed. An alternate route is to solve it via series.

Recall that $$ \sum_{k=0}^{\infty} \frac{\cos^2(\frac{kx}{2})}{k!} = \frac{e + e^{\cos(x)} \cos(\sin(x))}{2} $$

After some rearranging, integrating from $0$ to $2\pi$ yields $$ (-2e \pi + \sum_{k=0}^{\infty} (\frac{2 \pi }{k!}) + ( 2 \pi +\sum_{k=1}^{\infty}\frac{\sin (2 \pi k)}{k \: k!}) $$ with the $2\pi$ coming from the limit at $k=0$. The left two items cancel and the $\sin$ sum is just $0$, leaving you with $2 \pi$.

4
On

$$I=\int_0^{2\pi}e^{\cos{(x)}}\cos{(\sin{(x)})} dx=\Re \int_{0}^{2\pi} e^{e^{ix}}dx=\Re \left(\int_{0}^{2\pi} dx+\sum_{k=1}^{\infty} \frac{1}{k!}\int_{0}^{2\pi}e^{ikx} dx\right)=2\pi.$$ $$\int_{0}^{2\pi} e^{ikx} dx=0, k\in I$$

3
On

Graph the alleged antiderivative $(-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix}))/{2}$:

graph

The fundamental theorem of calculus is not applicable using this as antiderivative, since this is not a continuous function.