This refers back to $\int_{-\infty}^\infty \frac{\sin x}{x} \mathrm{d}x = \frac\pi2$ already posted.
How do I arrive at $\frac\pi2$ using the residue theorem?
I'm at the following point: $$\int \frac{e^{iz}}{z} - \int \frac{e^{iz}}{z},$$
and I would appreciate any help.
Before we use $\sin(x)=\frac{e^{ix}-e^{-ix}}{2i}$, we should move the contour so that it does not cross the origin. One way to do this is to use the contour $$ [-R,R]\cup\color{#C0C0C0}{[R,R-i]}\cup[R-i,-R-i]\cup\color{#C0C0C0}{[-R-i,-R]} $$ and notice that since $\frac{\sin(x)}{x}$ has no poles, the integral along the contour is $0$. Furthermore, the integral along the grayed out pieces tend to $0$ as the integrand is $\sim\frac1R$ along a length of $1$. This tells us that $$ \int_{-\infty}^\infty\frac{\sin(x)}{x}\,\mathrm{d}x =\int_{-\infty-i}^{\infty-i}\frac{\sin(x)}{x}\,\mathrm{d}x $$ Now, we can use $\sin(x)=\frac{e^{ix}-e^{-ix}}{2i}$. We will use the contours $$ U=[-R-i,R-i]\cup Re^{[0,i\pi]}-i $$ and $$ L=[-R-i,R-i]\cup Re^{[0,-i\pi]}-i $$ Since the integrands vanish quickly on the circular parts, we get $$ \begin{align} \int_{-\infty}^\infty\frac{\sin(x)}{x}\,\mathrm{d}x &=\frac1{2i}\int_U\frac{e^{iz}}{z}\,\mathrm{d}z-\frac1{2i}\int_L\frac{e^{-iz}}{z}\,\mathrm{d}z\\ &=\frac1{2i}2\pi i-\frac1{2i}0\\[9pt] &=\pi \end{align} $$ Since $U$ circles the pole at $0$ with residue $1$ once counterclockwise, and $L$ contains no poles.
Since $\frac{\sin(x)}{x}$ is an even function, we get $$ \begin{align} \int_0^\infty\frac{\sin(x)}{x}\,\mathrm{d}x &=\frac12\int_{-\infty}^\infty\frac{\sin(x)}{x}\,\mathrm{d}x\\ &=\frac\pi2 \end{align} $$