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?

  • 1
    $\begingroup$ 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. $\endgroup$ Apr 18, 2013 at 18:54
  • $\begingroup$ So am I calculating a Cauchy principal value? $\endgroup$ Apr 18, 2013 at 18:56
  • 1
    $\begingroup$ 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. $\endgroup$ Apr 18, 2013 at 19:05

4 Answers 4


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-Schlömilch substitution (see arXiv:1004.2445).

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

Out[68]= True
  • $\begingroup$ My experience is that it generally works as long as there are no branch-cuts involved. $\endgroup$
    – Sasha
    Apr 18, 2013 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

  • $\begingroup$ Your answer appears to be be off by a factor of 2. $\endgroup$
    – user40314
    Apr 18, 2013 at 18:44
  • $\begingroup$ @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. $\endgroup$
    – user17762
    Apr 18, 2013 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.


$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{{\displaystyle #1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\sr}[2]{\,\,\,\stackrel{{#1}}{{#2}}\,\,\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} & \color{#44f}{\int_{-\infty}^{\infty} {\cos\pars{x -1/x}\over 1 + x^{2}}\,\dd x} = 2\int_{0}^{\infty} {\cos\pars{x -1/x}\over 1 + x^{2}}\,\dd x \\[5mm] \sr{x\ =\ \expo{\theta}}{=} & 2\int_{-\infty}^{\infty} {\cos\pars{2\sinh\pars{\theta}}\over 1 + \expo{2\theta}}\expo{\theta}\,\dd\theta \\[5mm] = & \ 2\int_{0}^{\infty} {\cos\pars{2\sinh\pars{\theta}}\over 1 + \sinh^{2}{\theta}}\cosh\pars{\theta}\,\dd\theta \\[5mm] \sr{\sinh\pars{\theta}\ =\ t}{=} & \ \int_{-\infty}^{\infty}{\cos\pars{2t}\over 1 + t^{2}}\,\dd t = \Re\int_{-\infty}^{\infty}{\expo{2t\ic}\over \pars{t + \ic}\pars{t - \ic}}\,\dd t \\[5mm] = & \ \Re\pars{2\pi\ic\,{\expo{-2} \over 2\ic}} = \bbx{\color{#44f}{\pi \over \expo{2}}} \approx 0.4252\\ & \end{align}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .