How do I integrate $\int_{0}^{\infty}\frac{\cos(ax)-\cos(bx)}{x^2}\text{d}x$? How do I integrate $\int_{0}^{\infty}\frac{\cos(ax)-\cos(bx)}{x^2}\text{d}x$, for positive and real $a,b$?
I know the contour that I have to use is a semicircle with a small semicircle cut out near $0$, which leaves me to calculate only the integral along the small cut-out (the bigger circle goes to $0$ as the radius goes to infinity, and the two other contours are equal because cosine is even).
Even with this, I'm still having trouble calculating the integral. I've tried to plug in $\cos(x) = \frac{e^{ix}-e^{-ix}}{2}$ but it doesn't seem to simplify the integral. Does anyone see a better way? Thanks for your help.
 A: That's a typical case for recognizing the integrand as a definite integral of something else. In this case,
$$\cos ax - \cos bx = \int_a^b x\sin tx\,dt$$
Now exchange the order of integration and proceed. The $\int_0^\infty$ integral then has a well known solution and what's left is an elementary integral.
A: We have by parts$$\int_{0}^{\infty}\frac{\cos\left(ax\right)-\cos\left(bx\right)}{x^{2}}dx=-\left.\frac{\cos\left(ax\right)-\cos\left(bx\right)}{x}\right|_{0}^{\infty}+\int_{0}^{\infty}\frac{b\sin\left(bx\right)-a\sin\left(ax\right)}{x}dx.$$
 Now split the integral in 2 and put $y=ax$
  in the first and $y=bx$
  in the second. You have$$\int_{0}^{\infty}\frac{b\sin\left(bx\right)-a\sin\left(ax\right)}{x}dx=\left(b-a\right)\int_{0}^{\infty}\frac{\sin\left(y\right)}{y}dy=\left(b-a\right)\frac{\pi}{2}.$$
A: Here is another way to evaluate. Noting
$$ \int_0^\infty te^{-xt}dt=\frac1 {x^2}, \int_0^\infty e^{-xt}\cos (ax)dx=\frac1 {t^2+a^2}$$
and hence
\begin{eqnarray}
&&\int_{0}^{\infty}\frac{\cos\left(ax\right)-\cos\left(bx\right)}{x^{2}}dx\\
&=&\int_{0}^{\infty}\left(\int_{0}^{\infty}te^{-xt}dt\right)(\cos(ax)-\cos(bx)dx\\
&=&\int_{0}^{\infty}tdt\int_{0}^{\infty}e^{-xt}(\cos(ax)-\cos(bx)dx\\
&=&\int_{0}^{\infty}t\left(\frac{t}{t^2+a^2}-\frac{t}{t^2+b^2}\right)dt\\
&=&(b-a)\frac{\pi}{2}.
\end{eqnarray}
