Integration using residues For the following problem from Brown and Churchill's Complex Variables, 8ed., section 84
Show that 
$$ \int_0^\infty\frac{\cos(ax) - \cos(bx)}{x^2} \mathrm{d}x= \frac{\pi}{2}(b-a)$$
where $a$ and $b$ are positive, non-zero constants, by integrating about a suitable indented contour. The contour in question is the upper half of an annulus bisected by the $x$-axis with an outer radius of $R$ and in inner radius of $\delta$, such that the singularity at $x = 0$ is completely avoided by the integration. 
I would expect the evaluation to involve the Cauchy-Goursat theorem to show that the integral about the entire region $\mathscr{D}$ which is enclosed by the half-annulus is $0$. 
However I'm having difficulty constructing the appropriate complex analogue. 
For example I know that the function $f(x) = \frac{1}{x^2} $ has the complex analogue $f(z) = \frac{1}{z^2}$ and that $\cos(x)$ can be obtained by extracting the real portion of the exponential function i.e. $\cos(x) = \mathrm{Re}(e^{ix})$.
What is the appropriate analogue for this function? Can you show that it would work?
 A: Note that there are no residues to consider.  Rather, consider
$$\oint_C dz \frac{e^{i a z}-e^{i b z}}{z^2}$$
where $C$ is that indented annulus, where the integral about the outer arc vanishes as the radius of that arc goes to $\infty$, we are left with
$$\int_{-\infty}^{-\epsilon} dx \frac{e^{i a x}-e^{i b x}}{x^2} + \int_{\epsilon}^{\infty} dx \frac{e^{i a x}-e^{i b x}}{x^2} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{i (a-b) \epsilon e^{i \phi}}{\epsilon^2 e^{i 2 \phi}} = 0$$
by Cauchy's theorem (i.e., no poles in $C$).  Taking the limit as $\epsilon \to 0$, we get
$$PV \int_{-\infty}^{\infty} dx \frac{e^{i a x}-e^{i b x}}{x^2} = \pi (b-a)$$
where $PV$ denote the Cauchy principal value.  Taking the real part of both sides and halving the interval, we get the sought result:
$$ \int_{0}^{\infty} dx \frac{\cos{a x}-\cos{b x}}{x^2} = \frac{\pi}{2} (b-a)$$
A: First write the integral as

$$ \int_0^\infty\frac{\cos(ax) - \cos(bx)}{x^2} \mathrm{d}x = \frac{1}{2}\int_{-\infty}^\infty\frac{\cos(ax) - \cos(bx)}{x^2} \mathrm{d}x. $$

So, basically you need to consider the principal value of the integral. That leads to consider the complex integral

$$ \int_{C}\frac{e^{iaz} -e^{ibz}}{z^2} dz $$

and note that, you have a simple pole at the origin.
