# Use contour integration to calculate real integrals

I tried to prove this equality: $$\int_0^{\pi/2} e^{-x\cos \theta}\ \cos (x\sin \theta)\ d \theta=\frac \pi 2 - \int_0^x \frac {\sin u} u du$$

I calculated $$\int_{\gamma^+} \frac {e^{iz}} z dz$$ with $\gamma^+$ is positively oriented contour consisting of: $(C)$ the upper semicircle of radius $x$; $(L_1),(L_2)$ two real segment $[-x;-\epsilon]$ and $[x;\epsilon]$; (I) three sides of the rectangular with vertices $(-\epsilon;0)$;$(-\epsilon;-1)$;$(\epsilon;-1)$ and $(\epsilon;0)$

Following Cauchy's integral formula, we have $$\int_{\gamma^+} \frac {e^{iz}} z dz= 2\pi i$$

Now, we separate imagine and real parts of four integrals along $(C),(L_1),(L_2),(I)$. Here are imagine parts:
$$\operatorname{Im}\left(\int_C \frac {e^{iz}} z\, dz\right)=\operatorname{Im}\left(\int_0^{\pi}ie^{ixe^{i\theta}}\ d\theta\right)=2\int_0^{\pi/2}e^{-x\cos \theta}\ \cos (x\sin \theta)\ d \theta$$
$$\operatorname{Im}\left(\int_{L_1} \frac {e^{iz}} z\, dz\right)=\operatorname{Im}\left(\int_{-x}^{-\epsilon} \frac {e^{iu}} u\,du \right)=\int_{\epsilon}^{x} \frac {\sin u} u du$$
$$\operatorname{Im}\left(\int_{L_2} \frac {e^{iz}} z\, dz\right)=\operatorname{Im}\left(\int_{\epsilon}^{x} \frac {e^{iu}} u\,du\right)=\int_{\epsilon}^{x} \frac {\sin u} u\, du$$
$$\operatorname{Im}\left(\int_{I} \frac {e^{iz}} z\, dz\right)=\operatorname{Im}\left(\int_{-\epsilon}^{\epsilon} \frac {e^{i(u+i)}} {u+i}du\right)=\int_{-\epsilon}^{\epsilon} \frac {u\sin u-\cos u} {u^2+1}du$$
Therefore $$2\int_0^{\pi/2}e^{-x\cos \theta}\ \cos (x\sin \theta)\ d \theta+2\int_{\epsilon}^{x} \frac {\sin u} u du+\int_{-\epsilon}^{\epsilon} \frac {u\sin u-\cos u} {u^2+1}du=2\pi$$
Integral along two long sides of the rectangular \begin{align}\int_{I_1} \frac {e^{iz}} z dz+\int_{I_2} \frac {e^{iz}} z dz&=\int_0^{-1} \frac {e^{i(- \epsilon +iu)}} {-\epsilon +iu}idu +\int_{-1}^{0} \frac {e^{i( \epsilon +iu)}} {\epsilon +iu}idu\\ &=\int_0^{-1} \frac {e^{-u}} {u^2+ \epsilon^2}[i(-\epsilon \cos \epsilon -u \sin \epsilon)-(\epsilon \sin \epsilon -u \cos \epsilon)]du \\& + \int_{-1}^0 \frac {e^{-u}} {u^2 +\epsilon^2} [i(\epsilon \cos \epsilon+u \sin \epsilon)-(\epsilon \sin \epsilon-u \cos \epsilon)]du\\ &=2i\int_{-1}^0 \frac {e^{-u}} {u^2+ \epsilon^2}(\epsilon \cos \epsilon +u \sin \epsilon) du \end{align}
Now, let $\epsilon \to 0$ we get $$\int_0^{\pi/2} e^{-x\cos \theta}\ \cos (x\sin \theta)\ d \theta= \pi - \int_0^x \frac {\sin u} u du$$
What is wrong with this solution?

• I added some backslashes to make your trigonometric functions look right. What is $\gamma^+$? You only define $\gamma$. I am also a bit confused by your rectangle. Are its vertices at $\pm\epsilon$ and $\pm\epsilon-i$? Why the long detour along the negative imaginary axis? – Harald Hanche-Olsen Oct 18 '14 at 11:56
• $\gamma^+$ is positively oriented $\gamma$. You're right about the rectangular. I choose this because I want to include $0$ in interior points. Cauchy's integral formula doesn't work for points on the boundary. – HLong Oct 18 '14 at 12:03

## 1 Answer

You should replace $I$ by a small semicircle around the origin. When $|z|$ is small, you get $e^{iz}=1+O(|z|))$, so $e^{iz}/z=1/z+O(1)$. The contribution from the $O(1)$ part vanishes in the limit as the radius goes to zero, so you're left with the integral of $1/z$ plus something negligible. Now the integral of $1/z$ around a semicircle centered at the origin is $\pm\pi i$ (sign depending or orientation), and that's the missing bit.

It doesn't matter if you put the small semicircle in the lower half plane, thus including the origin inside $\gamma$ or in the upper half plane. The latter is very slightly easier, since the integral around $\gamma$ will be zero.

Edit: I realized that I didn't answer your qustion, what is wrong with your solution? The problem is the excursion up and down the sides of your skinny rectangle $I$. Near the origin, the integrand blows up, so you can't just assume that the integrals along the two sides will cancel in the limit. In fact, they do not.

• I add the caculation of integrals along two long sides. The imagine part is zero. – HLong Oct 18 '14 at 12:50
• Along the left side, you have $z=-\epsilon+iu$, and so $dz=-idu$. But more importantly, $1/z=(-\epsilon-iu)/(u^2+\epsilon^2)$. You have left out the factor $-\epsilon-iu$, and made a similar omission along the right side. – Harald Hanche-Olsen Oct 18 '14 at 13:42
• Oh!Yeah, thanks a lot! Silly mistake. – HLong Oct 18 '14 at 13:59