TITLE: Showing $\int_{0}^{\infty} \frac{\sin{x}}{x} \ dx = \frac{\pi}{2}$ using complex integration
QUESTION [8 upvotes]: Recently I had to use the fact that the Dirichlet integral evaluates as
$$\int_{0}^{\infty} \frac{\sin{x}}{x} \ dx = \frac{\pi}{2}$$ a couple of times. 
There already is a question that specifically ask for methods to show this result $\textbf{not}$ using complex integration. In this question I am interested in seeing the derivation via contour integration. ( I am aware of the wikipedia entry, but am looking for more detail )

REPLY [10 votes]: We need to use $f(z) = (e^{iz} - 1)/z$ because it has a removable singularity at $z = 0$. Consider a contour $C = [-R, R] \cup C_R$ for $R > 0$. Then
$$I \equiv \int_{-R}^R f(z)dz + \int_{C_R} f(z)dz = 0$$
by Cauchy Theorem, i.e.,
$$\int_{-R}^R f(z)dz = \int_{C_R} \frac{1}{z}dz - \int_{C_R} \frac{e^{iz}}{z}dz$$
but
$$\int_{C_R} \frac{1}{z}dz = \pi i$$
and we can show that the other integral goes to zero as $R \to \infty$. Therefore, because
$$\int_{-R}^R \frac{\sin x}{x}dx = \operatorname{Im}I,$$
we see that
$$\int_{-\infty}^\infty \frac{\sin x}{x}dx = \pi$$
or
$$\int_0^\infty \frac{\sin x}{x}dx = \frac{\pi}{2}.$$
Hope this helps.