$\int_{0}^{\infty} \frac{\cos(x)}{1+x^2} dx$ and $\int_{0}^{\infty} \frac {\ln(x)}{x^2+b^2} dx$ 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.
 A: For the first, use the parity to write it as an integral over the entire real line, replace $\cos x$ by $e^{ix}$, and use the residue theorem to evaluate
$$\int_{-\infty}^\infty \frac{e^{iz}}{1+z^2}\,dz.$$
For the second integral, use a keyhole contour to integrate
$$\frac{(\log z)^2}{z^2+b^2}.$$
Since the values of $\log z$ differ by $2\pi i$ when approaching the positive half-axis from below and from above, after the cancelling of $\int_0^\infty \frac{(\log x)^2}{x^2+b^2}\,dx$, what remains is the desired integral (times a constant factor) and an integral of $\frac{C}{x^2+b^2}$ over the positive half-axis that poses no difficulty.
A: 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
