# Evaluating the integral $\int_{-\infty}^{\infty} \frac{\cos \left(x-\frac{1}{x} \right)}{1+x^{2}} \ dx$

I'm curious about the proper way to evaluate $$\int_{-\infty}^{\infty} \frac{\cos \left(x-\frac{1}{x} \right)}{1+x^{2}} \, dx = \text{Re} \int_{-\infty}^{\infty} \frac{e^{i(x- \frac{1}{x})}}{1+x^{2}} \, dx$$ using contour integration.

If I let $f(z) = \frac{e^{i(z- \frac{1}{z})}}{1+z^{2}}$, there is an essential singularity at the origin.

So if I integrate around a closed semicircle in the upper half-plane, the contour goes right through the singularity.

Can you indent a contour around an essential singularity?

• You can indent your contour around the essential singularity at $0$ in the upper half plane. It doesn't matter whether $0$ is an essentially singularity or not. What matter is on the infinitesimal semi-circle around $0$ in the upper half plane, $| e^{i(z - \frac{1}{z})} | \le 1$. You will only get into trouble if your place the semi-circle in lower half plane. – achille hui Apr 18 '13 at 18:54
• So am I calculating a Cauchy principal value? – Random Variable Apr 18 '13 at 18:56
• In certain sense, yes. You are calculating the Cauchy principal value. However, since $\cos(x - \frac{1}{x})$ remains bounded as $x \to 0$, the original integral over $\mathbb{R}$ exists and equal to the Cauchy principal value you just calculated. – achille hui Apr 18 '13 at 19:05

Using the symmetry: $$\int_{\mathbb{R}} \frac{\cos\left(x-\frac{1}{x}\right)}{1+x^2} \mathrm{d}x = 2 \int_0^\infty \frac{\cos\left(x-\frac{1}{x}\right)}{1+x^2} \mathrm{d}x$$ Now, making the change of variables $u = x-\frac{1}{x}$ there are two solutions: $$x = x_{\pm}(u) = \frac{u}{2} \pm \sqrt{1 + \frac{u^2}{4}}$$ Changing variables: $$2 \int_0^\infty \frac{\cos\left(x-\frac{1}{x}\right)}{1+x^2} \mathrm{d}x = \int_{-\infty}^\infty \frac{2 \cos(u)}{1+x_+(u)^2} \frac{x_+^\prime(u)}{2} \mathrm{d}u + \int_{-\infty}^\infty \frac{2 \cos(u)}{1+x_-(u)^2} \frac{x_-^\prime(u)}{2} \mathrm{d}u$$ Combining these, with some simple algebra: $$\begin{eqnarray} 2 \int_0^\infty \frac{\cos\left(x-\frac{1}{x}\right)}{1+x^2} \mathrm{d}x &=& \int_{-\infty}^\infty \frac{2 \cos(u)}{4+u^2} \mathrm{d}u = \\ &=& \Re \int_{-\infty}^\infty \frac{2 \mathrm{e}^{i u}}{4+u^2} \mathrm{d}u = \Re\left( 2 \pi i \operatorname{Res}_{u=2i} \frac{2 \mathrm{e}^{i u}}{4+u^2}\right) = \frac{\pi}{\mathrm{e}^2} \end{eqnarray}$$ Note, that the above substitution is related to the Cauchy-Schmlolich substitution (see arXiv:1004.2445).

Numerical check:

In:= N[
NIntegrate[Cos[x - 1/x]/(1 + x^2), {x, -Infinity, Infinity},
WorkingPrecision -> 20]] == Pi/E^2

Out= True

• My experience is that it generally works as long as there are no branch-cuts involved. – Sasha Apr 18 '13 at 18:40

Let $x-1/x = t$. Now note that $t^2 = x^2 + \dfrac1{x^2} -2 \implies \left(x+\dfrac1x \right)^2 = t^2+4$. We then get that $$\left(1 + \dfrac1{x^2} \right)dx = dt \implies \dfrac{dx}{1+x^2} = \dfrac{x^2}{(1+x^2)^2} dt = \dfrac{dt}{\left(x+1/x \right)^2} = \dfrac{dt}{t^2+4}$$ Hence, the integral becomes $$\int_{-\infty}^{\infty} \dfrac{\cos(x-1/x)}{x^2+1} dx = 2 \int_{0}^{\infty} \dfrac{\cos(x-1/x)}{x^2+1} dx = 2\int_{-\infty}^{\infty} \dfrac{\cos(t)}{t^2+4} dt = \dfrac{\pi}{e^2}$$ where the last integral can be obtained from the post below.

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

• Your answer appears to be be off by a factor of 2. – user40314 Apr 18 '13 at 18:44
• @user40314 Thanks. That was because I made a mistake. The change of variable needs to be done a bit carefully since the function is not one to one on the entire real line (It is one to one for $x \in \mathbb{R}^+$). Now I have changed it. – user17762 Apr 18 '13 at 18:50

You're right that the residue calculation is sufficient. Note that

$$\left|\int_0^\pi \frac{e^{i(z-z^{-1})}}{1+z^2} \times ir e^{i\theta}\mathrm{d}\theta\right|$$

is bounded by

$$r\left|\int_0^\pi e^{-\frac{1}{r} \times \sin\theta}\mathrm{d}\theta\right| < r\pi \to 0$$

Hence indenting the contour around the origin makes for no difference between the real integral and the complex one. Then note the integrand is meromorphic within the region with this boundary. The behaviour outside of this contour is irrelevant, essential singularities or otherwise.

Thus the residue at $i$, $\boxed{\pi/e^2}$, is the correct value.

The argument does not work for e.g. a contour passing through the origin since the function is non-analytic at the origin, so Cauchy's theorem does not apply.