Using the Cauchy Principal Value, I need to compute the following integral $$\int_{-\infty}^\infty\frac{\cos(ax) - \cos(bx)}{x^2}dx$$
I have used the standard semi-circle contour with an indentation around the singularity at $x=0$. However integrating around the outer semicircle and smaller one around $0$, I find they have no contribution to the integral and the residue is also $0$. However I know the integral is not equal to $0$.
Where have I gone wrong?
Consider the contour of a semi-circle that avoids the singularity at $(0,0)$ of radius $\varepsilon$. Notice the line integral of the arc of radius $\lim_{R \to \infty} R$ equals 0 from Jordan's lemma. Also, consider $\cos{x}=\Re{\left(e^{ix}\right)}$, so we will take the real part of the integral. By Cauchy's 1st theorem you're left with: $$I=\int_{-\infty}^{\infty}\frac{\cos{ax}-\cos{bx}}{x^2} \; dx =-\int_{\pi}^0 \frac{e^{ia \varepsilon e^{i \theta}}-e^{ib \varepsilon e^{i \theta}}}{{\left(\varepsilon e^{i \theta}\right)}^2} \; i\varepsilon e^{i \theta} d\theta$$ Use the maclaurin series of $e^x$: $$I=i\int_0^{\pi} \frac{ia \varepsilon e^{i \theta}-ib \varepsilon e^{i \theta}}{\varepsilon e^{i \theta}} \; d\theta$$ $$I=-\int_0^{\pi} {a -b } \; d\theta$$ $$I=\Re{\left(\pi \left(b-a\right)\right)}=\boxed{\pi \left(b-a\right)}$$