Integrating a real function using complex analysis There is an integral given:
$$\int_0^{+\infty} \frac{\sin^2(x)}{x^2}\, \mbox{d}x.$$
Of course the integrand has no antiderivative so it's impossible to calculate the integral above using real-analysis methods. Fortunately we have some methods from complex analysis.
There is a tip which says that the integration of the complex function:
$$f(z) = \frac{1 - e^{2iz}}{z^2}$$
can lead us to the proper answer. 
I think it should be integrated over the half of a ring with the center at zero.
However I have no idea why there is $1-e^{2iz}$ in the nominator because:$$\sin^2(z) = \frac{-2+e^{2iz}+e^{-iz}}{-4}.$$
After solving this problem should I use the residue theory or just Cauchy's theorem? 
 A: First, use integration by parts:
\begin{align}
I=\int_0^{+\infty}\frac{\sin^2 x}{x^2}\,dx&=-\frac{\sin^2 x}{x}\Biggr|_0^{+\infty} +\int_0^{+\infty} \frac{\sin 2x}{x}\,dx \\
&=\int_0^{+\infty} \frac{\sin 2x}{x}\,dx  \qquad u=2x \\
&=\int_0^{+\infty} \frac{\sin u}{u}\,du
\end{align}
We can then use one of the properties of the Laplace Transform, which states that
$$\int_0^{+\infty} \frac{f(x)}{x}\,dx=\int_0^{+\infty} \mathcal{L}\{f(x)\}(s)\,dx$$
Choosing $f(x)=\sin x$ and noting that $$\mathcal{L}\{\sin x\}(s)=\frac{1}{s^2+1}$$
We can show that
\begin{align}
I&=\int_0^{+\infty} \frac{\sin u}{u}\,du \\
&=\int_0^{+\infty} \mathcal{L}\{\sin u\}(s)\,ds \\
&=\int_0^{+\infty} \frac{ds}{s^2+1} \\
&=\arctan s \Bigg|_0^{+\infty} \\
&=\boxed{\frac{\pi}{2}}
\end{align}
A: I do not know much about techniques in complex analysis, but I have already gone through a similar exercise in Fourier analysis. I post here my solution, I hope it can be useful - and encourage people to comment on that if it is wrong or can be modified.
Define the function $$f(x) = 
\begin{cases}
1, & x \in [-1,1] \\
0, &\text{otherwise}.
\end{cases}
$$
Its Fourier transform can be computed as follows:
$$\hat{f}(\xi) = \int_{\mathbb{R}}e^{-2\pi it\xi}f(t)\,dt = \int_{-1}^1 \cos(2\pi t\xi)-i\sin(2\pi t\xi)\,dt = \int_{-1}^1\cos(2\pi t\xi)\,dt = \frac{\sin 2\pi\xi}{\pi\xi}. $$
Now Plancherel theorem implies that
$$\int_{\mathbb{R}}\lvert \hat{f}(\xi)\rvert^2\,d\xi = \int_{\mathbb{R}}\lvert f(x)\rvert^2\,dx,$$
thus, setting $x = 2\pi\xi$ and observing that $\frac{\sin^2 x}{x^2}$ is an even function, you have
$$\int_0^{+\infty}\frac{\sin^2 x}{x^2}\,dx = \frac{2\pi}{8}\int_{-\infty}^{+\infty} \frac{\sin^2 2\pi\xi}{\pi^2\xi^2}\,d\xi = \frac{\pi}{4}\int_{-\infty}^{+\infty}\lvert f(x)\rvert^2\,dx = \frac{\pi}{4}\int_{-1}^1\,dx = \frac{\pi}{2}. $$
A: $$\int_{0}^{\infty}\frac{sin^2(x)}{x^2}dx$$
Apply the Integration By Parts:$u=sin^2(x),v^{\prime}=\frac{1}{x^2}$
$$=sin^2(x)(-\frac1x)-\int sin(2x)(-\frac1x)dx$$
$$=-\frac{sin^2(x)}{x}-\int-\frac{sin(2x)}{x}dx$$
Notice that $\int -\frac{sin(2x)}{x}dx=-Si(2x)$
$$=-\frac{sin^2(x)}{x}-(-Si(2x))$$
$$=-\frac{sin^2(x)}{x}+Si(2x)$$
Now apply the upper and lower bounds of the integral, then we get
$$\int_{0}^{\infty}\frac{sin^2(x)}{x^2}dx=\frac{\pi}{2}$$
