We want to compute the integral \(I=\int_{-\infty}^\infty dx \frac{\sin^2 x}{x^2 }\) in various ways.
A complex contour integration
As it is typically done, we first upgrade real valued parameter \(x\) to a complex number \(z\), and use the following equality: \[\begin{eqnarray} \frac{\sin^2 z}{z^2}=\frac{\left(e^{i z}-e^{-i z}\right)^2}{-4 z^2}=-\frac{e^{2i z}-2+e^{-2i z}}{4 z^2}=\frac{1-e^{-2i z}}{4 z^2}+\frac{1-e^{2i z}}{4 z^2}. \tag{1} \end{eqnarray}\] We can evaluate the integrals of the terms on the right hand side using appropriate closed contours. \(e^{iz}\) term, for example, requires us to close the contour from above, as in Fig. 1, such that the imaginary part of \(z\) is positive, which implies \(Re(iz)<0\). As \(R\rightarrow \infty\), the integral over the large circle vanishes.
Let’s evaluate the integral of \(\frac{1-e^{2i z}}{ z^2}\) over \(C_U\) first. \[\begin{eqnarray} I_{U}&\equiv&\oint_{C_U} dz\frac{1-e^{2 i z}}{4 z^2}\nonumber\\ &=&\int_{-R}^\varepsilon dx\frac{1-e^{2 i x}}{4 x^2}+ \int_{\varepsilon_{U,C}} dz \frac{1-e^{2i z}}{ 4 z^2}+\int_\varepsilon^R dx \frac{1-e^{2i x}}{4 x^2} + \cancel{\int_{0}^{\pi}R id\phi e^{i\phi} \frac{1-e^{2 i R e^{i\phi}}}{4 R^2 e^{2 i\phi}}}\nonumber\\ &=&\int_{-R}^R dx\frac{1-e^{2i x}}{4 x^2}+\int_{\varepsilon_{U,C}} dz \frac{1-e^{2i z}}{ 4 z^2}, \tag{2} \end{eqnarray}\] where the integral on the large circle vanishes in the \(R\rightarrow \infty\). The second term in the last line, \(\int_{\varepsilon_{U,C}}\), is to be evaluated on the upper part of the small circle in the clockwise direction, but we can flip its direction by the change of variable \(z\rightarrow -z\) \[\begin{eqnarray} \int_{\varepsilon_{U,C}} dz \frac{1-e^{-2i z}}{ 4 z^2}=\int_{\varepsilon_{U,CC}} dz \frac{1-e^{2i z}}{ 4 z^2}, \tag{3} \end{eqnarray}\] which will be useful later.
Let’s look at the second piece in Eq. (1), and integrate it over the contour Fig. 2.
\[\begin{eqnarray} I_{L}&\equiv&\oint_{C_L} dz\frac{1-e^{-2 i z}}{4 z^2}\nonumber\\ &=&\int_{-R}^\varepsilon dx\frac{1-e^{-2 i x}}{4 x^2}+ \int_{\varepsilon_{L,CC}} dz \frac{1-e^{-2i z}}{ 4 z^2}+\int_\varepsilon^R dx \frac{1-e^{-2i x}}{4 x^2} + \cancel{\int_{0}^{\pi}R id\phi e^{-i\phi} \frac{1-e^{-2 i R e^{i\phi}}}{4 R^2 e^{-2 i\phi}}}\nonumber\\ &=&\int_{-R}^R dx\frac{1-e^{-2i x}}{4 x^2}+\int_{\varepsilon_{L,CC}} dz \frac{1-e^{-2i z}}{ 4 z^2}. \tag{4} \end{eqnarray}\]
Adding Eqs. (2) and (4) we get
\[\begin{eqnarray} I_{U}+I_{L}&=& \int_{-R}^R dx\left(\frac{1-e^{-2i x}}{4 x^2}+\frac{1-e^{2i x}}{4 x^2}\right)+\left(\int_{\varepsilon_{U,CC}}+\int_{\varepsilon_{L,CC}}\right) dz \frac{1-e^{-2i z}}{ 4 z^2}\nonumber\\ &=& \int_{-R}^R dx\frac{\sin^2 x}{x^2}+\oint_{\varepsilon_{CC}} dz \frac{1-e^{-2i z}}{ 4 z^2}=\int_{-R}^R dx\frac{\sin^2 x}{x^2}+2 \pi i \left[\frac{d}{dz}\frac{1-e^{-2i z}}{4} \right]_{z=0}\nonumber\\ &=&\int_{-R}^R dx\frac{\sin^2 x}{x^2} -\pi. \tag{5} \end{eqnarray}\] We know that none of the closed contours we used enclose any poles which means \(I_{U}+I_{L}=0\). Therefore: \[\begin{eqnarray} \int_{-\infty}^\infty dx\frac{\sin^2 x}{x^2} =\pi. \tag{6} \end{eqnarray}\]
Another complex contour integration
Note that the difficulty we had in the previous section can be traced back to the fact that we split the pole at \(z=0\) so that it was kind of shared between two contours. At the end of the day, the parts came together to give us a closed contour integral. We can get around this by shifting the contours downward as in Fig. 3Now the top contour includes the pole and the bottom one excludes it. Evaluating and adding the contour integrals we get: \[\begin{eqnarray} I_{U}&\equiv&\oint_{C_U} dz\frac{1-e^{2 i z}}{4 z^2}=\lim\limits_{R\to \infty}\int_{-R}^R dx\frac{1-e^{2i x}}{4 x^2} + \cancel{\lim\limits_{R\to \infty}\int_{0}^{\pi}R id\phi e^{i\phi} \frac{1-e^{2 i R e^{i\phi}}}{4 R^2 e^{2 i\phi}}}\nonumber\\ &=&2 \pi i \left[\frac{d}{dz}\frac{1-e^{-2i z}}{4}\right]=\pi ,\nonumber\\ I_{L}&\equiv&\oint_{C_U} dz\frac{1-e^{-2 i z}}{4 z^2}=\lim\limits_{R\to \infty}\int_{-R}^R dx\frac{1-e^{-2i x}}{4 x^2} + \cancel{\lim\limits_{R\to \infty}\int_{0}^{\pi}R id\phi e^{i\phi} \frac{1-e^{2 i R e^{i\phi}}}{4 R^2 e^{2 i\phi}}}\nonumber\\ &=&0,\nonumber\\ I_{U}+I_{L}&=&\lim\limits_{R\to \infty}\left[\int_{-R}^R dx\frac{1-e^{2i x}}{4 x^2}+\int_{-R}^R dx\frac{1-e^{-2i x}}{4 x^2}\right]=\int_{-\infty}^\infty dx\frac{\sin^2 x}{x^2} =\pi. \tag{7} \end{eqnarray}\]
Fourier transform
If you have ever taken any Signals&Systems Engineering classes, or quantum physics classes, you will remember that Fourier transform of a window function goes like \(\frac{\sin w}{w}\) in the frequency domain. Coupling this information with the Parseval’s identity, we can solve the integral in the time domain. Let’s go through some definitions:
\[\begin{eqnarray} F(w)&=&\frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty dt e^{-iwt}f(t),\nonumber\\ f(t)&=&\frac{1}{\sqrt{2\pi}} \int_{-\infty}^\infty dw e^{iwt}F(w). \tag{8} \end{eqnarray}\] And the Parseval’s identity is easy to prove
\[\begin{eqnarray} \int_{-\infty}^\infty dw F^*(w)F(w)&=&\frac{1}{2\pi}\int_{-\infty}^\infty dw \int_{-\infty}^\infty dt \int_{-\infty}^\infty d\tilde t e^{-iw(t-\tilde t)}f(t) f^*(\tilde t)\nonumber\\ &=&\frac{1}{2\pi} \int_{-\infty}^\infty dt \int_{-\infty}^\infty d\tilde t \left[\int_{-\infty}^\infty dw e^{-iw(t-\tilde t)}\right]f(t) f^*(\tilde t),\nonumber\\ &=&\frac{1}{2\pi} \int_{-\infty}^\infty dt \int_{-\infty}^\infty d\tilde t 2\pi \delta(t-\tilde t)f(t) f^*(\tilde t)=\int_{-\infty}^\infty dt |f^2(t)|. \tag{9} \end{eqnarray}\] If we can find a function, \(f(t)\), Fourier transform of which gives \(\frac{\sin w}{w}\), we can evaluate \(\int_{-\infty}^\infty dt |f^2(t)|\) rather than \(\int_{-\infty}^\infty dx \frac{\sin^2 x}{x^2}\), and Parseval’s identity ensures that the results will be the same. One can verify that the follwing function is what we are looking for: \[\begin{eqnarray} f(t)=\sqrt{\frac{\pi}{2}}\left[\theta(t-1)-\theta(t+1)\right], \tag{10} \end{eqnarray}\] where \(\theta(t)\) is the unit step function. \(f(t)\) is simply equals to \(1\) for \(-1<t<1\) and \(0\) elsewhere. Using the Parseval’s identity we get: \[\begin{eqnarray} \int_{-\infty}^\infty dx \frac{\sin^2 x}{x^2}=\int_{-\infty}^\infty dt |f^2(t)|=\frac{\pi}{2}\int_{-1}^{1} dt=\pi. \tag{11} \end{eqnarray}\]
A sneaky method
As you fool around with such integrals, you will develop various tricks to generalize them by inserting a parameter inside the integrand. Consider the following object: \[\begin{eqnarray} I(\alpha)=\int_{-\infty}^\infty dx\frac{\sin^2 \alpha x}{x^2}, \tag{12} \end{eqnarray}\] which looks even harder to evaluate. How about \(\frac{dI}{d\alpha}\)? Let’s try: \[\begin{eqnarray} \frac{dI(\alpha)}{d\alpha}=\int_{-\infty}^\infty dx\frac{d\sin^2 \alpha x}{d\alpha} {x^2}=\int_{-\infty}^\infty dx\frac{\sin (2\alpha x)}{x}=\int_{-\infty}^\infty dy\frac{\sin (y)}{y}, \tag{13} \end{eqnarray}\] where \(\int_{-\infty}^\infty dy\frac{\sin (y)}{y}\) is an easier integral to compute, and its value is \(\pi\) (see this post for various ways to evaluate the integral.)
Since we know \(\frac{dI(\alpha)}{d\alpha}\), we can integrate to get \[\begin{eqnarray} I(\alpha)=\int_0^\alpha d\tilde \alpha \frac{dI(\tilde \alpha)}{d\tilde \alpha}=\alpha \pi +I(0). \tag{14} \end{eqnarray}\] But we know that the integrand vanishes at \(\alpha=0\), that is \(I(0)=0\), and the integral we are looking for is at \(\alpha=1\). So the result is \[\begin{eqnarray} \int_{-\infty}^\infty dx\frac{\sin^2 x}{x^2}=I(1)=\pi. \tag{15} \end{eqnarray}\]
There you have it, four different ways of evaluating this lovely integral.