I am trying to solve the integral $\int_0^{\infty} \frac{\sin{x}}{x}$ only by using complex analysis. Note, there are several posts already on this site about such an integral (and done via contour-integration).
To solve this question via contour integration, we have to consider the integral $\frac{e^{iz}-1}{z}$ over the indented semi-circle centered at 0. I am having trouble integrating over the outer semi-circle which is usually called $\gamma_R^+$ (positive orientation and radius is $R$).
I will outline my attempt and show that it is producing an incorrect answer but I am having trouble seeing where I am wrong.
We want to solve $\int_{\gamma_R^+} \frac{e^{iz}-1}{z}$ as $R\to\infty$. I know that $|e^{iz}|\leq 1$ for all complex numbers in the upper half plane. Therefore, $|e^{iz}-1|=|1-e^{iz}|\leq 2$ so that $\frac{e^{iz}-1}{z} \leq \frac{2}{|z|}$. Now, let $z(t) = Re^{it}$ so that $\frac{2}{|z|} = \frac{2}{Re^{it}}$ which then goes to 0 as $R\to\infty$. Looking at other correct solutions, it seems to be the case that $\int_{\gamma_R^+} f(z)dz = -\pi i$ (as $R\to\infty$) and not 0. Therefore, I have went wrong somewhere but cannot seem to figure out where. Any help is appreciated.
Also a further question, if you have time:
1) I am still not sure why we choose our function to be $\frac{e^{iz}-1}{z}$ and not something else. The only reason I knew to choose this function was because it was a hint in the book that this question was asked.
Some posts where the question on how to solve this integral has been asked:
Integrating $(e^{iz}-1)/z$ about a semi-circle to evaluate Dirichlet integral.
I am trying to show $\int^\infty_0\frac{\sin(x)}{x}dx=\frac{\pi}{2}$