Solution: Consider the function \( f(z) = \frac{e^{iz}}{z} \) and the contour \( C \) consisting of
-
A semicircle \( \gamma_R \) of radius \( R \) in the upper half-plane,
-
The real axis from \( -R \) to \( -\epsilon \),
-
A small semicircle \( \gamma_\epsilon \) of radius \( \epsilon \) around the origin in the upper half-plane,
-
The real axis from \( \epsilon \) to \( R \).
By
Cauchy's residue theorem, since \( f(z) \) is analytic inside and on \( C \) except at \( z = 0 \), we have:
\[
\oint_C f(z) \, dz = 0.
\]
Breaking the integral into parts:
\[
\int_{-R}^{-\epsilon} \frac{e^{ix}}{x} \, dx + \int_{\gamma_\epsilon} \frac{e^{iz}}{z} \, dz + \int_{\epsilon}^{R} \frac{e^{ix}}{x} \, dx + \int_{\gamma_R} \frac{e^{iz}}{z} \, dz = 0.
\]
As \( R \to \infty \), the integral over \( \gamma_R \) vanishes by
Jordan's lemma. As \( \epsilon \to 0 \), the integral over \( \gamma_\epsilon \) approaches \( -i\pi \) (half the residue at \( z = 0 \)).
Taking the imaginary part of the remaining integrals, we get:
\[
2i \int_{0}^{\infty} \frac{\sin x}{x} \, dx = i\pi.
\]
Therefore:
\[
\int_{0}^{\infty} \frac{\sin x}{x} \, dx = \frac{\pi}{2}.
\]