# contour integration: $\int_{-\infty}^{\infty} \frac{\cos x + x \sin x}{1+x^2} dx$

I'm doing a self-study in learning contour integration in complex analysis and here's an example i came across:

$$\int_{-\infty}^{\infty} \frac{\cos x + x \sin x}{1+x^2} dx$$

How does this relate to the following integral over a semi-circle in the upper half plane ($0\leq t \leq \pi$)?

$$\int_{R e^{it}} \frac{e^{iz}}{z-i} dz$$

(This came from a hint in our notes)

-

Note that $$f(z) = \frac{e^{iz}}{z-i} = \frac{(z+i)e^{iz}}{(z+i)(z-i)} = \frac{(z+i)e^{iz}}{z^2+1}.$$

So, if $z=x$ is real, then $$f(x) = \frac{(x+i)(\cos x + i \sin x)}{x^2+1} = \frac{x\cos x - \sin x + i(\cos x + x\sin x)}{x^2+1}.$$

Let $\Gamma$ be the closed curve consisting of the interval $[-R,R]$ together with the semi-circle $C : z=Re^{it}$, $0 < t < \pi$ (for $R > 1$). By the residue theorem,

$$\int_{\Gamma} f(z)\,dz = \int_{[-R,R]} f(z)\,dz + \int_C f(z)\,dz = 2\pi i \operatorname{Res}(f;z=i)$$

(since $z=i$ is the only singularity of $f$ inside $\Gamma$). Finally, let $R\to\infty$.

The integral over $C$ will tend to $0$ by Jordan's lemma, and you will end up with

$$\int_{-\infty}^\infty \frac{x\cos x - \sin x}{x^2+1}\,dx + i \int_{-\infty}^\infty \frac{x\sin x + \cos x}{x^2+1}\,dx = 2\pi i \operatorname{Res}(f;z=i).$$

To finish off, compute the residue and look at the imaginary part of the equality above.

-