Principal value of $\int_{-\infty}^{\infty} \frac{\cos x}{ a^{2} - x^{2}}dx$ using residue calculus The principal value has to be calculated for the following integral:
$$\int_{-\infty}^{\infty} \frac{\cos x}{ a^{2} - x^{2}}dx$$
for $a>0$ and $a$ is real. I set the pole to be $z=+a$ or $z=-a$, but I can't seem to get the required answer which is $π\sin(a)/a$. How can I go about solving this?
 A: In general if you have a rational function $R(z)$ that vanishes at $\infty$ and has simple poles $x_1,\dots,x_n$ on the real axis, then for $f(z)=R(z)e^{iz}$ we get $$\lim_{r\to\infty}\mathcal{P}\int_{-r}^r f(x)dx=2\pi i\sum_{\operatorname{Im} a>0}\operatorname{Res}_af+\pi i\sum_{k=1}^n \operatorname{Res}_{x_k}f$$
(exercise: prove this using the residue theorem) Here $\mathcal{P}\int$ denotes the Cauchy principal value.
Now apply this to the case $R(z)=\frac{1}{a^2-z^2}$ and use the fact that $\operatorname{Re}\frac{e^{ix}}{a^2-x^2}=\frac{\cos(x)}{a^2-x^2}$ for real $x$.
A: $$I=\int_{-\infty }^{\infty } \frac{\cos x}{a^2-x^2} \, dx=2 \pi  i \left(\text{res}\left(\frac{e^{i x}}{2 \left(a^2-x^2\right)},\{x,-a\}\right)+\text{res}\left(\frac{e^{i x}}{2 \left(a^2-x^2\right)},\{x,a\}\right)\right)$$
$$\text{res}\left(\frac{e^{i x}}{2 \left(a^2-x^2\right)},\{x,-a\}\right)=\underset{x\to a}{\text{lim}}\frac{e^{i x} (x-a)}{2 \left(a^2-x^2\right)}=\underset{x\to a}{\text{lim}}\frac{e^{i x} (x-a)}{2 (a+x)(a-x)}=-\frac{e^{i a}}{4 a}$$
Thus
$$I=2\pi i\left(-\frac{e^{i a}}{4 a}+\frac{e^{-i a}}{4 a}\right)= i \pi  \left(\frac{e^{-i a}}{2 a}-\frac{e^{i a}}{2 a}\right)=\frac{\pi}{a}\left(\frac{e^{ia}-e^{-ia}}{2i}\right)=$$
$$=\frac{\pi \sin a}{a}$$
A: Another aproach via Real methods.First factor the denominator
$$PV \,\int_{0}^{\infty} \frac{\cos  x}{a^{2}-x^{2}} d x=- PV \,\int_{-\infty}^{\infty} \frac{\cos  x}{(x-a)(x+a)} d x $$
then, by partial fractions
$$\frac{1}{(x-a)(x+a)}=\frac{1}{2 a}\left( \frac{1}{x-a} - \frac{1}{x+a} \right)$$
Therefore
$$\int_{-\infty}^{\infty} \frac{\cos  x}{a^{2}-x^{2}} d x=-\frac{1}{2 a}\int_{-\infty}^{\infty} \frac{\cos  x}{x-a} d x+\frac{1}{2 a}\int_{-\infty}^{\infty} \frac{\cos  x}{x+a} d x,\tag{1}  $$

To evaluate the first integral on the R.H.S. of $(1)$
$$J_1=\int_{-\infty}^{\infty} \frac{\cos  x}{x-a} d x$$
Let $t+a=x\, \Rightarrow dt=dx$
$$J_1=\int_{-\infty}^{\infty} \frac{\cos \left( t+a \right)}{t} d t$$
$$J_1=\cos \left( a \right)\int_{-\infty}^{\infty} \frac{\cos \left( t \right)}{t} d t-\sin \left( a\right)\int_{-\infty}^{\infty} \frac{\sin \left( t\right)}{t} d t\,\tag{2}$$

For the second integral on the R.H.S.
$$J_2=\int_{-\infty}^{\infty} \frac{\cos  x}{x+a} d x$$
Let $t-a=x\, \Rightarrow dt=dx$
$$J_2=\int_{-\infty}^{\infty} \frac{\cos ( t-a)}{t} d t$$
$$J_2=\cos \left( a \right)\int_{-\infty}^{\infty} \frac{\cos \left( t \right)}{t} d t+\sin \left( a\right)\int_{-\infty}^{\infty} \frac{\sin \left( t\right)}{t} d t,\tag{3}$$

Plugging (2) and (3) in (1) we get
$$\int_{-\infty}^{\infty} \frac{\cos a x}{b^{2}-x^{2}} d x=\frac{\sin \left( a\right)}{a}\int_{-\infty}^{\infty} \frac{\sin  t}{t} d t $$
The integral on the R.H.S. is equal to $\pi$
And finally
$$\boxed{ PV\,\int_{-\infty}^{\infty} \frac{\cos  x}{a^{2}-x^{2}} d x=\frac{\pi}{a} \sin (a )}$$

