Showing $\int_{-\infty}^{\infty} \frac{\sin(ax)\sin(bx)}{x^2} dx = \frac{\pi}{2} \min(a, b)$ using residues I want to show that for $a, b > 0$,
$$ \int_{-\infty}^{\infty} \frac{\sin(ax)\sin(bx)}{x^2} dx = \frac{\pi}{2} \min(a, b). $$
One answer to this question is given here, in which it is mentioned that this can be done using residues as well. I am interested in seeing how this could be done. I am not even sure around which kind of contour I would be integrating here. In any case, we have
$$\int_{-\infty}^{\infty} \frac{\sin(ax)\sin(bx)}{x^2} dx =  \int_{-\infty}^{\infty} \frac{e^{iax} -  e^{-iax}}{2 i x} \cdot \frac{e^{ibx} -  e^{-ibx}}{2 i x}  dx \\
 =  \int_{-\infty}^{\infty} \frac{e^{iax}e^{ibx} - e^{iax}e^{-ibx} - e^{-iax}e^{ibx} + e^{-iax}e^{-ibx}}{-4x} dx \\
 =  \int_{-\infty}^{\infty} \frac{e^{ix(a+b)} + e^{-ix(a+b)}}{-4x} dx  + \int_{-\infty}^{\infty} \frac{- e^{ix(a-b)} - e^{ix(b-a)}}{-4x} dx \\
 =  \int_{-\infty}^{\infty} \frac{2\cos(x(a+b))}{-2x} dx  + \int_{-\infty}^{\infty} \frac{- e^{ix(a-b)} - e^{ix(b-a)}}{-4x} dx,$$
which seems more like something that looks like it could depend on the minimum value of $a, b$ (maybe by showing one of the summands equals zero?).
 A: First of all I think there's a mistake in your statement, the bounds for the integral should be 0 and $\infty$. Since you are integrating over an even function there is an easy fix, you just have to multiply the right hand side by 2, i.e., the result you want to show is
$$\int_{-\infty}^{\infty} \frac{\sin(ax)\sin(bx)}{x^2}dx = \pi \min(a,b) $$
Assume w.l.o.g. $a<b$. We start with the trigonometric equality
$$\frac{\sin{ax}\sin{bx}}{x^2} = \underbrace{\frac{1-\cos(x(a+b))}{2x^2}}_{A(x)}-\underbrace{\frac{1-\cos(x(a-b))}{2x^2}}_{B(x)}, $$
and we tackle each of the summands on the right-hand side individually. For $A(x)$, define the complex function
$$f(z) = \frac{1-e^{iz(a+b)}}{2z^2},$$
and notice that $\operatorname{Re}(f(z)) = A(z)$. Now we integrate $f(z)$ over an indented semicircle $\gamma$ in the upper half plane, where we write
$$\gamma = \gamma_R *\eta_1*\gamma_\varepsilon * \eta_2.$$
$\gamma_R$ denotes the large counterclockwise semicircle with radius $R$, $\gamma_\varepsilon$ denotes the small clockwise simicircle with radius $\varepsilon$, $\eta_1$ the line segment from $-R$ to $-\varepsilon$ and $\eta_2$ the line segment from $\varepsilon$ to $R$.
The function $f(z)$ is holomorphic except for a simple pole at $z = 0$, which lies outside of $\gamma$. Therefore by Cauchy's Integral Theorem we have that
$$\int_\gamma f dz = \int_{\gamma_R}fdz + \int_{\eta_1}fdz + \int_{\gamma_\varepsilon}fdz + \int_{\eta_2}fdz = 0. $$
Standard estimates show that $\int_{\gamma_R}fdz \rightarrow0$ as $R \rightarrow \infty. $ Also, as $R \rightarrow \infty$ and $\varepsilon \rightarrow 0$, we have that
$$\operatorname{Re}\left(\int_{\eta_1}fdz + \int_{\eta_2}fdz\right) \rightarrow \int_{-\infty}^{\infty}A(x)dx .$$
Thus, if we can compute the value of $\lim_{\varepsilon \to 0}\int_{\gamma_\varepsilon}fdz$ we get the value of $\int A dx$ by taking the real part of this value. For this we are going to use the fact that if we integrate on a semicircle around a simple pole we get half the residue. (In my Complex Analysis class, this was called the $\textit{Indentation Lemma}$, but I don't know if that is a standard name for this fact...).
By writing the function $f(z)$ as a Laurent-series we can find out that the residue of $f(z)$ at $z_0 = 0$ is
$$\operatorname{Res}(f,z_0) = -i\frac{a+b}{2}.$$
By the aforementioned Lemma, and the fact that we integrate in clockwise orientation we therefore have
$$\int_{\gamma_\varepsilon}fz = -\pi i \operatorname{Res}(f,z_0) = -\frac{\pi(a+b)}{2}.$$
So we can conclude that $\int A(x) dx = \frac{\pi(a+b)}{2}$.
If we want to do exactly the same for $B(x)$, we need to change the contour to an indented semi-circle in the lower half-plane, otherwise we can't bound $\int_{\gamma_R}fdz$. (This is because $a<b$, so $(a-b) < 0$.) The only thing that changes is that we are now integrating counterclockwise over $\gamma_\varepsilon$, so we get a different sign. More concretely, we can compute that $\int B(x) dx = -\frac{\pi(a-b)}{2}$, from which we can finally deduce (using the linearity of integrals):
$$\int_{-\infty}^{\infty}\frac{\sin(ax)\sin(bx)}{x^2}dx = \int_{-\infty}^{\infty}A(x)dx - \int_{-\infty}^{\infty}B(x)dx = \pi \frac{a+b + a -b}{2} = \pi a, $$
which since we assumed $a<b$ is exactly what we wanted.
I hope what I wrote here is correct and clear enough to understand. Contour Integration is fairly new to me, so it's possible there is a mistake somewhere. I also skipped some details (because the solution is long enough as it is...) but if you want some clarifications / more details feel free to ask!
