Evaluate:
$$\int_{0}^{\infty} \frac{\cos(x)}{x^2 + 1} dx$$
Using only complex analysis.
$$I = \int_{0}^{\infty} \frac{\cos(x)}{x^2 + 1} dx = (\frac{1}{2})\int_{-\infty}^{\infty} \frac{\cos(x)}{x^2 + 1} dx$$
Consider a contour $C$ with a upper-axis semi-circle $B$ and the axis running from $-R \to R$
We will compute:
$$\oint_{C} \frac{\cos(z)}{z^2 + 1} dz$$
First:
$$z^2 + 1 = 0 \implies Z \in \{-i, i\}$$
Only, $z = i$ is in the semi circle region.
$$\text{Res}_{z=i} = \lim_{z \to i} (z-i)(f(i)) = \lim_{z \to i} \frac{\cos(z)}{z + i} = \frac{\cosh(1)}{2i}$$
Applying the residue theorem:
$$\oint_{C} \frac{\cos(z)}{z^2 + 1} dz = (2\pi i)\cdot \frac{\cosh(1)}{2i} = \pi\cdot\cosh(1)$$
$$\oint_{C} \frac{\cos(z)}{z^2 + 1} dz = \int_{-\infty}^{\infty} \frac{\cos(x)}{x^2 + 1} dx$$
But that is wrong, the answer for the full improper is:
$$\int_{-\infty}^{\infty} \frac{\cos(x)}{x^2 + 1} dx = \frac{\pi}{e}$$
What am I doing wrong?
