# Calculating the integral $\int_0^\infty \frac{\cos x}{1+x^2}\, \mathrm{d}x$ without using complex analysis

Suppose that we do not know anything about the complex analysis (numbers). In this case, how to calculate the following integral in closed form?
$$\int_0^\infty\frac{\cos x}{1+x^2}\,\mathrm{d}x$$

This can be done by the useful technique of differentiating under the integral sign.

In fact, this is exercise 10.23 in the second edition of “Mathematical Analysis” by Tom Apostol.

Here is the brief sketch (as laid out in the exercise itself).

Let $$F(y) = \int\limits_{0}^{\infty} \frac{\sin xy}{x(1+x^2)} \ dx \ \ \text{for} \quad\quad y > 0$$

Show that

$\displaystyle F”(y) – F(y) + \pi/2 = 0$ and hence deduce that $\displaystyle F(y) = \frac{\pi(1-e^{-y})}{2}$.

Use this to deduce that for $y > 0$ and $a > 0$

$$\displaystyle \int_{0}^{\infty} \frac{\sin xy}{x(x^2 + a^2)} \ dx = \frac{\pi(1-e^{-ay})}{2a^2}$$

and

$$\int_{0}^{\infty} \frac{\cos xy}{x^2 + a^2} dx = \frac{\pi e^{-ay}}{2a}$$