TITLE: $\int_{0}^{\infty} \frac{\cos(x)}{1+x^2} dx$ and $\int_{0}^{\infty} \frac {\ln(x)}{x^2+b^2} dx$
QUESTION [5 upvotes]: Prove that $$\int_{0}^{\infty} \frac{\cos(x)}{1+x^2} dx = \frac {\pi}{2e}$$
My approach would be $$\lim_{n \to \infty} \int_{0}^{n} \frac{\cos(x)}{1+x^2} dx$$ and evaluate the limits of the sine and cosine integral functions, but I'm pretty sure there is an easier way.
The second integral is $$\int_{0}^{\infty} \frac {\ln(x)}{x^2+b^2} dx, b > 0$$
My approach; Let $f$ be an analytic function $$f(z)=\frac {\ln(z)}{z^2+b^2}$$ then the poles of $f$ would be at $$z=ib, z=-ib$$
Now I don't know what contour to draw and what would be inside it.

REPLY [4 votes]: For the second one, 
We have to compute, 
$$\int_{0}^{\infty}\frac{\ln(x)}{x^2+b^2} dx $$
Let us compute the simpler case($b=1$) . 
i.e $$ I = \int_{0}^{\infty}\frac{\ln(x)}{x^2+1} dx  $$
Substituting, $u= \frac{1}{x} \implies dx = \frac{-1}{u^2}du $
So our integral $$I = \int_{0}^{\infty}\frac{-\ln(u)}{u^2+1} du  = -I \implies I=0 $$
Now, coming back to this problem, we substitute, $x=\frac{b}{u}$ in 
$$ J = \int_{0}^{\infty}\frac{\ln(x)}{x^2+b^2} dx $$
Substitution will give us 
$$ J = \int_{0}^{\infty}\frac{\ln(b)}{x^2+b^2} dx - I $$
Since $I=0$ , we have 
$$ J  = \ln(b)\int_{0}^{\infty}\frac{1}{x^2+b^2} dx  = \frac{\ln(b)}{b} \times \frac{\pi}{2} \Box$$

First one is extremely famous question, it is posted here many times.
See here