Solving the following exercise I have some doubts. I want to show that \begin{equation*} \int_{0}^{\infty}\frac{\sin(x)}{x}dx=\frac{\pi}{2} \end{equation*}
I tried the following: Let $\gamma$ be the upper semicircle \begin{equation*} \int_{\gamma} \frac{\sin(z)}{z} dz = 0 \end{equation*} how do we have to \begin{equation*} f(x) = \frac{\sin(x)}{x} = \frac{\sin(-x)}{-x} = f(-x) \end{equation*} Note that \begin{eqnarray*} 0 = \int_{\gamma} \frac{\sin(z)}{z} dz & = & \int_{-R}^{R} \frac{\sin(z)}{z} dz + \int_{C_{R}} \frac{\sin(z)}{z} dz\\ & = & \int_{-R}^{R} \frac{\sin(x)}{x} dx + \int_{C_{R}} \frac{\sin(z)}{z} dz\\ & = & 2\int_{0}^{R} \frac{\sin(x)}{x} dx + \int_{C_{R}} \frac{\sin(z)}{z} dz\\ \end{eqnarray*} then \begin{eqnarray*} -2 \int_{0}^{R} \frac{\sin(x)}{x}dx & = & \int_{C_{R}} \frac{\sin(z)}{z}dz\\ & = & \int_{0}^{\pi} \frac{\sin(Re^{i\theta})}{Re^{i\theta}} Rie^{i\theta} d\theta\\ & = & i\int_{0}^{\pi}\sin(Re^{i\theta})d\theta\\ & = & -\int_{u(0)}^{u(\pi)}\sin(u)udu\\ & = & -\left(u\cos(u)|_{u(0)}^{u(\pi)}-\int_{u(0)}^{u(\pi)}-\cos(u)du \right)\\ & = & -\left(Re^{i\theta}\cos(Re^{i\theta})|_{0}^{\pi}-\sin(Re^{i\theta})|_{0}^{\pi} \right)\to -\pi\text{ when }R\to\infty\text{ ?}\\ \end{eqnarray*} I do not think this last step is correct, however I see it necessary, I do not know if my reasoning is wrong or I should approach the problem from another point of view.
Is my reasoning correct? I have my doubts about being able to take the closed curve, because at $ z = 0 $ there is a singularity and it is located on the border of the region enclosed by my curve
PD: This requires the use of contour integral, although another method is also welcome
Let $$I = \int_0^\infty \frac{\sin(x)}{x} dx$$
In the case of $\frac{\sin(z)}{z}$ the singularity is removable. With $\frac{e^{i z}}{z}$ the singularity at 0 is essential. Consider the following contour:
We will let $R \to \infty$.
By Cauchy's theorem
$$ \begin{align} 0 =& \int_\gamma \frac{e^{i z}}{z} dz \\ =& \int_{A \oplus B \oplus C \oplus D} \frac{e^{i z}}{z} dz \\ =& \, 2 i \cdot I - i \pi + 0 \\ \end{align} $$
thus
$$I = \tfrac{\pi}{2}.$$
$$ \begin{align} & \int_{B \oplus D} \frac{e^{i z}}{z} dz \\ =& \int_{1/R}^{R} \frac{e^{i z}}{z} dz + \int_{-R}^{-1/R} \frac{e^{i z}}{z} dz \\ =& \int_{1/R}^{R} \frac{e^{i z}}{z} dz + \int_{R}^{1/R} -\frac{e^{-i z}}{-z} dz \\ =& \int_{1/R}^{R} \frac{e^{i z}}{z} dz - \int_{1/R}^{R} \frac{e^{-i z}}{z} dz \\ =& \int_{1/R}^{R} \frac{e^{i z} - e^{-i z}}{z} dz \\ =& \, 2i \cdot I \\ \end{align} $$
For paths $A$ and $C$ note that $\gamma'(t) = i \pi \gamma(t)$.
$$ \begin{align} & \int_{A} \frac{e^{i z}}{z} dz \\ =& - \int_0^1 \frac{e^{i (1/R) e^{i \pi t}}}{\gamma(t)} i \pi \gamma(t) dt \\ =& - i \pi \int_0^1 e^{i (1/R) e^{i \pi t}} dt \\ \to& -i \pi \end{align} $$
For the final part we will use estimation to show that
$$ \begin{align} & \int_{C} \frac{e^{i z}}{z} dz \\ =& \int_0^1 \frac{e^{i R e^{i \pi t}}}{\gamma(t)} i \pi \gamma(t) dt \\ =& \, i \pi \int_0^1 e^{i R e^{i \pi t}} dt \\ \to& \, 0 \end{align} $$
because
$$ \begin{align} & \left| \int_0^1 e^{i R e^{i \pi t}} dt \right| \\ \le& \int_0^1 \left| e^{i R e^{i \pi t}} \right| dt \\ \le& \int_0^1 \frac{\left| e^{i R \cos(\pi t)} \right|}{\left| e^{R \sin(\pi t)} \right|} dt \\ \le& \int_0^1 \frac{1}{\left| e^{R \sin(\pi t)} \right|} dt \\ \le& 2 \int_0^{1/2} \frac{1}{\left| e^{R \sin(\pi t)} \right|} dt \\ \le& 2 \int_0^{1/2} \frac{1}{\left| e^{R \pi t} \right|} dt \\ \to& \, 0 \end{align} $$