Contour integration of trigonometric functions I'm trying to show that:
$$ \int_0 ^{\infty} \frac{\sin(px)\sin(qx)}{x^2} dx = \frac{\pi}{2}\min{(p,q)}$$
With $p,q \ge 0$
So far I have considered the function $f(z) = \frac{e^{itz}}{z^2}$ and integrated this around a semi-circular contour, radius R, suitably indented at the origin. The residue at $z=0$, coming from a double pole I get as $it$. Taking the limit as $R \to \infty$ and then looking at the real part I obtain:
$$\int_0 ^{\infty} \frac{\cos(tx)}{x^2} = \frac{-\pi}{2}$$
Now writing $t = p+q$ I can expand the $cos$ however I am having difficulty seeing how $\min{(p,q)}$ could possibly come into this problem.
Any help is appreciated,
Thanks
 A: Hint: You are not looking for $\min(p,q)$ but for a term that looks like:
$$|p+q|-|p-q|=2\min(p,q)$$
There is a similar formula for $\max(p,q)$
$$|p+q|+|p-q|=2\max(p,q)$$
Also consider that we can write
$$\sin(px)\sin(qx) = \dfrac{\cos((p-q)x)-\cos((p+q)x)}{2}$$
I think you can see a clear resemblance in the formulae.
It is another important note that $$\int_0^{\infty} \dfrac{\cos(tx)}{x^2} dx$$ does not converge because of issues around zero. Instead consider $$\int_0^{\infty} \dfrac{\cos(ax)-\cos(bx)}{x^2} dx$$ 
A: By symmetry you can assume $p\geq q$. Then you simply expand out the sin(p x) and sin(q x) in terms of complex exponentials:
$$\sin(x)=\frac{\exp(i x)-\exp(-i x)}{2 i}$$
You then multiply out the exponentials. You can then treat each term using contour integration, but before you can split up the integral (from minus to plus infinity) into four parts, you must write the real integral as the principal part by leaving out a segment of length epsilon around the origin and taking the limit of epsilon to zero. Within the limit sign, you can split the integral into four parts and compute them separately. You must consider whether to close the contours in the upper or lower half plane, it here where the asymmetry between p and q arises.
