TITLE: The infinite integral of $\frac{\sin x}{x}$ using complex analysis
QUESTION [7 upvotes]: The problem i came across is the evaluation of $$\int_0^\infty\frac{\sin x}{x}\,dx$$ I chose the function $f(z) = \dfrac{e^{iz}}{z}$ and took a contour of $[\varepsilon , R ] + [R , R+iy] + [-R+iy , R+iy] + [-R,-R+iy]+[-R, -\varepsilon]$ . The problem is how do I continue now to find integrals on each of these segments ?

REPLY [11 votes]: Take the function $\;f(z)=\frac{e^{iz}}z\;$ and define the (positive) indented semicircle 
$$\gamma_r:=\{z\in\Bbb C\;:\;z=re^{it}\;,\;\;0\le t\le \pi\,,\,\,r>0\}$$
Now, for big $\;R\in\Bbb R_+\;$ and very small $\;\epsilon>0\;$ , take the contour:
$$C:=[-R,-\epsilon]\cup(-\gamma_\epsilon)\cup[\epsilon,R]\cup\gamma_R$$
We're going to use the lemma, and in particular its corolary, that in the first and most upvoted answer here

Observe that $\;f\;$ is analytic on the contour and within the domain enclosed by it, so by Cauchy's Theorem its integral equals zero. Also
$$\text{Res}_{z=0}(f)=\lim_{z\to 0} zf(z)=e^0=1$$
and thus by the lemma
$$\lim_{\epsilon\to0}\int_{\gamma_\epsilon}f(z)=\pi i$$
and also
$$\left|\int_{\gamma_R}f(z)\,dz\right|\le\frac{\pi R e^{-R\cdot\text{Im}\,z}}{R}\xrightarrow[R\to\infty]{}0\,,\,\text{since}\;\;\text{Im}\,(z)>0\;\;\text{on}\;\;\gamma_R$$
So we get:
$$0=\oint_C f(z)\,dz=\int_{-R}^\epsilon f(x)\,dz-\int_{\gamma_\epsilon} f(z)\,dz+\int_\epsilon^R f(x)\,dx+\int_{\gamma_R}f(z)\,dz\implies$$
$$0=\lim_{R\to\infty,\,\epsilon\to0}\oint_C f(z)dz=\int_{-\infty}^\infty\frac{e^{ix}}xdx-\pi i$$
and now just compare imaginary parts and divide by two since the real function is even.