Showing that $\int_0^\infty \frac{\sin(px)\sin(qx)}{x^2}\,dx=\frac{\pi}{2}\min(p,q)$, for $p, q>0$, perhaps using Cauchy's Residue Theorem 
Show that
  $$\int_0^\infty \frac{\sin(px)\sin(qx)}{x^2}\,dx\;=\; \frac{\pi}{2}\min(p,q)$$ 
  where $p,q>0$.

I need to use Cauchy's Residue theorem, I think, but I can't see what function to apply it to since the integrand in the question has only removable singularities. Also, I'm struggling to see where the $\min(p,q)$ term in the solution comes from.
Can anyone help me solve this question? Thanks
 A: Since $$\sin px\sin qx=\frac12\left(\cos(p-q)x-\cos(p+q)x\right)=\sin^2\frac{(p+q)x}{2}-\sin^2\frac{(p-q)x}{2}$$ and $$\int_0^\infty\frac{\sin^2 kx}{x^2}dx=\frac{|k|\pi}{2}$$(in particular, you can use the CRT or various other methods to prove $\int_0^\infty\frac{\sin^2 x}{x^2}dx=\frac{\pi}{2}$ or $\int_{-\infty}^\infty\frac{\sin^2 x}{x^2}dx=\pi$), your integral is$$\frac{\pi}{4}\left(|p+q|-|p-q|\right).$$If $p\ge q>0$, this simplifies to $\frac{\pi}{4}(p+q-p+q)=\frac{\pi q}{2}=\frac{\pi}{2}\min\{p,\,q\}$. The case $q>p>0$ follows by the original problem's $p\leftrightarrow q$-symmetry.
A: The integrand is even, so integrate over the whole real line and divide by $2$.
You could try replacing one of the sine terms (say, $\sin(px)$) with $-ie^{ipx}$. The real part is still what you want, and the imaginary part gives rise to an integral with an odd integrand, so that should give a zero. Except there is now a pole at the origin. Play around with semicircles, one large and one small centered at the origin, and joined by paths along the real axis.
