Evaluating $\int_0^\infty\frac{\cos(ax)}{x^2+1}dx$ without complex analysis or Fourier Transform? I've been trying to see if there are any real methods of evaluating $$I(a)=\int_0^\infty\frac{\cos(ax)}{x^2+1}dx$$ without invoking the Fourier Transform. I thought about differentiating $I(a)$ but it did not lead me anywhere. Are there any ways to evaluate this integral without using complex analysis or Fourier Transform?
 A: Let us write
$$J(a)=\int_{-\infty}^\infty\frac{\cos{(ax)}}{x^2+1}\mathrm{d}x=2I(a)$$
Then we have
$$\begin{align}
J'(a)
&=\int_{-\infty}^\infty\frac{\partial}{\partial a}\left(\frac{\cos{(ax)}}{x^2+1}\right)\mathrm{d}x\\
&=\int_{-\infty}^\infty\frac{-x\sin{(ax)}}{x^2+1}\mathrm{d}x\\
&=-\int_{-\infty}^\infty\frac{x^2\sin{(ax)}}{x(x^2+1)}\mathrm{d}x\\
&=-\int_{-\infty}^\infty\frac{(x^2+1-1)\sin{(ax)}}{x(x^2+1)}\mathrm{d}x\\
&=-\int_{-\infty}^\infty\frac{\sin{(ax)}}{x}-\frac{\sin{(ax)}}{x(x^2+1)}\mathrm{d}x\\
&=-\int_{-\infty}^\infty\frac{\sin{(ax)}}{x}+\int_{-\infty}^\infty\frac{\sin{(ax)}}{x(x^2+1)}\mathrm{d}x\\
&=-\pi+\int_{-\infty}^\infty\frac{\sin{(ax)}}{x(x^2+1)}\mathrm{d}x \,\,\text{ for }a\gt0\\
\end{align}$$
Continuing gives
$$J''(a)=\int_{-\infty}^\infty\frac{\partial}{\partial a}\left(\frac{\sin{(ax)}}{x(x^2+1)}\right)\mathrm{d}x=J(a)$$
$$\therefore J''(a)-J(a)=0$$
Which allows $J(a)$ to be found by solving the above ODE;
$$J(a)=Ae^a+Be^{-a}$$
$$J'(a)=Ae^a-Be^{-a}$$
Then using the initial conditions $J(0)=\pi$ and $J'(0)=-\pi$ gives
$$A+B=\pi$$
$$A-B=-\pi$$
$$\implies A=0,B=\pi$$
Hence
$$J(a)=\pi e^{-a}\,\,\text{ for }a\gt0$$
As the function $J(a)$ is even we have that $J(a)=J(-a)$ and hence
$$J(a)=\pi e^{-|a|} \,\,\text{ for all }a\in\mathbb{R}$$
because the value where $a=0$ is also consistent with the above formula. Thus the function required $I(a)=\frac12J(a)$ is given by
$$I(a)=\int_0^\infty\frac{\cos{(ax)}}{x^2+1}\mathrm{d}x=\frac12 \pi e^{-|a|}$$
A: Writing
$$\frac{\cos (a x)}{x^2+1}=\frac{\cos (a x)}{(x+i)(x-i)}=\frac i 2\left(\frac{\cos (a x)}{x+i}-\frac{\cos (a x)}{x-i}\right)$$ and using twice
$$\int \frac{\cos (a x)}{x+b}\,dx=\cos (a b)\, \text{Ci}(a (b+x))+\sin (a b)\, \text{Si}(a (b+x))$$
$$\int_0^\infty \frac{\cos (a x)}{x+b}\,dx=\frac{1}{2} (\pi -2 \text{Si}(b |a|)) \sin (b |a|)-\cos (a b) \text{Ci}(b |a|)$$ we should end with
$$\int_0^\infty \frac{\cos (a x)}{x^2+1}\,dx=\frac{\pi}{2}   (\cosh (|a|)-\sinh (|a|))=\frac{\pi}{2} e^{-|a|}$$
