Compute $\int_{-\infty}^{+\infty} \frac{cos(px)-cos(qx)}{x^2+\epsilon^2}dx$ where $\epsilon,p,q>0$ 
(a) For $p,q >0$, compute, $$\int_{-\infty}^{+\infty} \frac{cos(px)-cos(qx)}{x^2+\epsilon^2}dx,$$ where $\epsilon>0$.
(b) For $p,q >0$, compute, $$\int_{-\infty}^{+\infty} \frac{cos(px)-cos(qx)}{x^2}dx.$$
(c) Is it true that,
$$\lim_{\epsilon \to 0+} \int_{-\infty}^{+\infty} \frac{cos(px)-cos(qx)}{x^2+\epsilon^2} = \int_{-\infty}^{+\infty} \frac{cos(px)-cos(qx)}{x^2}dx.$$

I have to do this exercise but am a bit stuck. This is what I have so far:
Complex function: We want to contour integrate it so first we consider the complex function,
$$f(z) = \frac{cos(pz)-cos(qz)}{z^2 + \epsilon^2}=  \frac{cos(pz)-cos(qz)}{(z + i\epsilon)(z-i\epsilon)}.$$
Note that this has poles for $\pm i\epsilon$.
Consider the contour $\gamma$ thats equal to $[-R,R]$ and the semi-circle $C_R$ with radius R on the upper plane.
Note that $+i\epsilon$ is a pole in the contour. Using the residue theorem we see,
$$\oint_\gamma f(z) dz = 2\pi i \, \text{Res}_{i\epsilon}f(z).$$
We calculate the residue,
\begin{align}
\text{Res}_{i\epsilon}f(z) &= \lim_{z \to i\epsilon} (z-i\epsilon)\frac{cos(pz)-cos(qz)}{(z + i\epsilon)(z-i \epsilon)}\\
&=\frac{cos(pi\epsilon)-cos(qi\epsilon)}{2i\epsilon},
\end{align}
I don't know how I can simplify this anymore so just left it like this.
Then we know
$$\oint f(z) dz = \int_{-R}^R f(z)dz + \int{C_R} f(z) dz.$$
So we calculate the integral over the semi-circle, we use the parameterisation $z(t) = re^{it}$,
\begin{align}
\int{C_R} f(z) dz &= \int_0^\pi \frac{cos(pz)-cos(qz)}{z^2+\epsilon^2}dz\\
&=\int_0^\pi \frac{cos(pre^{it})-cos(qre^{it})}{re^{2it}+\epsilon^2}rie^{it}dt\\
&=ri \Big[ \int_0^\pi \frac{cos(pre^{it})e^{it}}{re^{2it}+\epsilon^2}dt - \int_0^\pi \frac{cos(qre^{it})e^{it}}{re^{2it}+\epsilon^2}dt \Big].
\end{align}
I am trying to upperbound both of them so that the limit is zero, but I can't get the right answer:
\begin{align}
|ri| \, \Big| \int_0^\pi \frac{cos(pre^{it})e^{it}}{re^{2it}+\epsilon^2}dt \Big| &\leq \pi \, R \, \sup_{z \in C_R}|f(z)|\\
&\leq R \, \Big| \frac{Ri}{R^2+\epsilon^2\Big|}
\end{align}
But in the limit  of $R \to \infty$, I don't get 0.
Can anyone help me out further, do I have the wrong complex function or how am I supposed to get an upperbound for the integral? Can I get a different answer for the residue.
 A: The problem with the analysis in the OP is that $\int_{C_R}\frac{\cos(pz)-\cos(qz)}{z^2}\,dz$ does not vanish as $R\to \infty$.  This is a consequence of the fact that  $$\left|\cos(|a|Re^{i\phi})\right|=\left|\cos(|a|R\cos(\phi))\cosh(|a|R\sin(\phi))-i\sin(|a|R\cos(\phi))\sinh(|a|R\sin(\phi))\right|$$
grows exponentially as $R\to\infty$.

To proceed around this issue, we use Euler's identity and write
$$\begin{align}
\int_{-\infty}^\infty \frac{\cos(px)-\cos(qx)}{x^2+\varepsilon^2}\,dx&=\text{PV}\int_{-\infty}^\infty \frac{e^{ipx}-e^{iqx}}{x^2+\varepsilon^2}\,dx\tag1
\end{align}$$
Next, setting $R>\varepsilon>0$, we examine the contour integral $I$, defined by
$$\begin{align}
I&=\oint_{C} \frac{e^{ipz}-e^{iqz}}{z^2+\varepsilon^2}\,dz\\\\
&=\int_{-R}^{R}\frac{e^{ipx}-e^{iqx}}{x^2+\varepsilon^2}\,dx+\int_0^\pi \frac{e^{ip R e^{i\phi}}-e^{iq R e^{i\phi}}}{(R e^{i\phi})^2+\varepsilon^2}\,iR e^{i\phi}\,d\phi\tag 2
\end{align}$$
As $R\to \infty$, the first integral on the right-hand side of $(2)$ tends to the Principal Value Integral on the right-hand side of $(1)$ while the second integral on the right-hand side of $(2)$ vanishes.
Moreover, the Residue guarantees that
$$I=\pi \left(\frac{e^{-p\varepsilon}-e^{-q\varepsilon}}\varepsilon\right)$$
Therefore, we have
$$\int_{-\infty}^\infty \frac{\cos(px)-\cos(qx)}{x^2+\varepsilon^2}\,dx=\pi \left(\frac{e^{-p\varepsilon}-e^{-q\varepsilon}}\varepsilon\right)$$
Interestingly, as $\varepsilon\to 0^+$, we see that
$$\lim_{\varepsilon\to 0^+}\int_{-\infty}^\infty \frac{\cos(px)-\cos(qx)}{x^2+\varepsilon^2}\,dx =\pi (q-p)$$
