Compute the integral $$\int_0^\infty \frac{\sin(x)}{x}dx$$ via complex integration of the meromorphic function $f(z) = e^{iz}/z$.
My attempt:
$\int_0^\infty \frac{\sin(x)}{x} dx = \lim_{R \to\infty} \int_0^R \frac{\sin(x)}{x} dx$
Consider $[0,R]$ contained in $\mathbb R$ parametrized as $\gamma$: $[0,R]\to \mathbb C$ defined by $\gamma$$(t)$ = $t$
Hence $\int_{\gamma} f(z) dz = \int_0^R \frac{e^{it}}{t} dt$
$f$ has a pole of order 1 at $z=0$, so residue at $0 = \lim_{z\to 0} (z-0)f(z) = 1$
Let $\lambda_R = \gamma_R U C_R$, where $C_R$ is the semi-circle of radius $R/2$
So $\int_{\lambda_R} f(z) dz = 2\pi i \times \operatorname{res}_0 f = 2\pi i$
Now, for $z \in C_R$, $|z| = |x+iy| = R/2$, and $|f(z)| = \frac{|e^{-y}|}{|x+iy|} \leq \frac{1}{R/2} = 2/R$
Hence, $|\int_{C_R} f(z) dz| \leq \max_{z \in C_R} |f(z)|\times \text{length} (C_R) \leq 2/R \times \pi R/2 = \pi$ which tends to $\pi$ as $R/2$ tends to infinity.
Therefore, $\int_{\gamma_R} f(z) dz = \int_{\lambda_R} f(z) dz - \int_{C_R} f(z) dz = 2\pi i - \pi$
Finally, $\int_0^∞ \frac{\sin(x)}{x} dx = \lim_{R \to \infty} \int_0^R \frac{\sin(x)}{x} dx = 2\pi i - \pi$
Is my attempt correct? Please any other solutions.
Hint
For $a>0$, define $$f(a)=\int_0^\infty e^{-ax}\frac{\sin(x)}{x}dx$$hence$$f'(x)=\int_0^\infty -xe^{-ax}\frac{\sin(x)}{x}dx=-\int_0^\infty e^{-ax}{\sin(x)}dx$$which can be easily solved using $$ \sin x={e^{ix}-e^{-ix}\over 2i} $$