Contour Integration: non-convergent integral The question is 
$$I=\int_{-\infty}^{\infty} \frac{\sin^2{x}}{x^2} dx$$
My attempt:
$$I=-\frac{1}{4}\int_{-\infty}^{\infty} \frac{e^{2ix}-2+e^{-2ix}}{x^2} dx$$
$$I=-\frac{1}{4} \Big[ \int_{-\infty}^{\infty} \frac{e^{2ix}}{x^2} dx - \int_{-\infty}^{\infty} \frac{2}{x^2} dx +\int_{-\infty}^{\infty} \frac{e^{-2ix}}{x^2} dx \Big] $$
Now I use contours as mentioned in this question.
If we write 
$$I=-\frac{1}{4}\Big[A+B+C\Big]$$ where $A,B,C$ are the corresponding integrals.
For, $A$, and $C$ they can be worked out using Jordan's lemma and the residue theorem.
I run into a problem with $B$, as it does not converge.
Any ideas?
 A: 
Consider, 
$$j(a) = \int_{0}^{\infty} e^{-ax^2}\sin^2(x)\mathrm{d}x$$
$$= \int_{0}^{\infty} e^{-ax^2}\frac{1-\cos(2x)}{2}\mathrm{d}x$$
$$= \int_{0}^{\infty} e^{-ax^2}\frac{1-\cos(2x)}{2}\mathrm{d}x$$
$$= \frac{\sqrt{\pi}}{4} a^{-1/2} - \frac{\sqrt{\pi}}{4} e^{-1/a} a^{-1/2}. $$
Now let $J(a)$ be an antiderivative of $j(a)$. 
$$ J(a) = \frac{\sqrt{\pi}}{2} a^{1/2} - \frac{\pi}{2} \mathrm{erf}(1/\sqrt{a})-\frac{\sqrt{\pi}}{2}\sqrt{a}e^{-1/a}+C$$
$$= \frac{\sqrt{\pi}}{2} a^{1/2}\left(1-e^{-1/a}\right) - \frac{\pi}{2} \mathrm{erf}(1/\sqrt{a})+C$$
We can see that,
$$\lim_{a\rightarrow \infty} J(a) = C. $$
The definition of $J$ suggests that we can identify it with the integral, 
$$ J(a)=-\int_{0}^{\infty} e^{-ax^2} \frac{\sin^2(x)}{x^2} \mathrm{d}x,$$
this integral clearly goes to $0$ in the limit as $a\rightarrow \infty$ so we choose $C=0$. 
$$ J(a) = \frac{\sqrt{\pi}}{2} a^{1/2}\left(1-e^{-1/a}\right) - \frac{\pi}{2} \mathrm{erf}(1/\sqrt{a}) $$

Now assuming that $J(a)$ equals the integral we get, 
$$ \int_{0}^{\infty} \frac{\sin^2(x)}{x^2} \mathrm{d}x =- \lim_{a\rightarrow 0} J(a)$$
$$ = -\lim_{a\rightarrow 0} \left(\frac{\sqrt{\pi}}{2} a^{1/2}\left(1-e^{-1/a}\right) - \frac{\pi}{2} \mathrm{erf}(1/\sqrt{a})\right),$$
$$ = \pi/2 $$
A: We can use Parseval's theorem to solve the integral. 
The rectangle function is, 
$$\Pi(x) = \begin{cases} 1 \quad |x|<1/2 \\ 0 \quad \text{otherwise} \end{cases}$$
The Fourier transform of the rectangle function is the $\mathrm{sinc}$ function. 
$$ \hat{\Pi}(k) = \mathrm{sinc}(k) = \frac{1}{\sqrt{2\pi}}\frac{\sin(k)}{k}.$$
Parseval's theorem tells us that, 
$$\frac{1}{2\pi}\int_{-\infty}^\infty \mathrm{sinc}^2(k) = \int_{-\infty}^\infty \Pi^2(x) dx = \frac12,$$
which gives us,
$$ \boxed{\int_{-\infty}^\infty \mathrm{sinc}^2(k) = \pi}.$$
A: Write
$$ \sin^2{x} = \frac{1}{2}(1-\cos{2x}), $$
then
$$ I = \int_{-\infty}^{\infty} \frac{1-\cos{2x}}{2x^2} \, dx. $$
Now, you can either consider this as the real part of $(1-e^{2ix})/x^2$, and then do the contour integral as usual with $(1-e^{2iz})/z^2$ around a circle in the upper half-plane, taking care with the simple pole at $z=0$, or you can integrate by parts:
$$ \int_{-\infty}^{\infty} \frac{1-\cos{2x}}{2x^2} \, dx = \left[ \frac{1-\cos{2x}}{-2x} \right]_{-\infty}^{\infty}-\int_{-\infty}^{\infty} \frac{\sin{2x}}{-x} \, dx, $$
which you've no doubt seen how to do before.
(It's surprising how often people forget you can do that when they're taught to do real integrals using residue calculus! I had a group of students the other day with much the same problem.)
