# 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$$

-
Study complex analysis, and come back to the problem with fresh ideas. –  Yuval Filmus Nov 8 '10 at 7:52
@Yuval Filmus, that is a bad comment. –  anon Nov 8 '10 at 10:21
Complex analysis methods: math.stackexchange.com/questions/100616/… –  Aryabhata Jan 20 '12 at 2:52

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}$$

-
+1: as usual, Moron does a great job! –  user1709 Nov 8 '10 at 8:20
Very nice. –  user02138 Nov 8 '10 at 8:22
Reminds me of how people were so amazed at Feynman because he could differentiate under the integral. ;) –  Ｊ. Ｍ. Nov 8 '10 at 10:21
@JM: yes, i remembered reading that story about Feynman ;-) when i saw Moron's answer. –  user1709 Nov 8 '10 at 17:01
Beauty!!! Thanks! –  Martin Gales Nov 9 '10 at 6:10

Since $$\frac{x}{1+x^2}=\int_{0}^{\infty}e^{-y}\sin (xy)dy,$$ we have that $$I=\int_{0}^{\infty}\frac{\cos bx}{1+x^2}dx=\int_{0}^{\infty}\frac{\cos bx}{x}dx\int_{0}^{\infty}e^{-y}\sin (xy)dy.$$ Changing the order of integration (which can be justified by the standard method) yields $$I=\int_{0}^{\infty}e^{-y}dy\int_{0}^{\infty}\frac{\sin xy}{x} \cos bx dx.$$ The calculation of the integral (a.k.a. the discontinuous Dirichlet factor) $$\int_{0}^{\infty}\frac{\sin xy}{x} \cos bx dx=\begin{cases}0, & 0 < y < b \\ \ \\ \pi/2, & 0 < b < y, \end{cases}$$ can be easily reduced to the calculation of the standard Dirichlet integral. Therefore, $$I=\frac{\pi}{2}\int_{b}^{\infty}e^{-y}dy=\frac{\pi}{2}e^{-b}.$$

-
+1: Very nice :-) –  Aryabhata Nov 8 '10 at 18:55
Very inspiring solution! I learned a lot. Thanks! –  Martin Gales Nov 9 '10 at 6:10
@Martin Gales: You're welcome. –  Andrey Rekalo Nov 9 '10 at 7:51
The previous answer is not correct. If you use the Taylor expansion of cosine and integrate termwise you consider integrals of the following form: \begin{eqnarray} \int_{0}^{\infty} \frac{x^{a} \ dx}{1 + x^{2}} = \tfrac{\pi}{2} \sec (\tfrac{\pi a}{2}) \end{eqnarray} which is only well-defined if $-1 < a < 1$.
You can try using the Taylor expansion of $\cos$.