Consider an improper integral with a pole on the integration contour at say $z=1$,

$$ \tag{1} I = \int_{-\infty}^\infty \mathrm{d}z\ \frac{e^{-z^2}}{z-1+i\epsilon},~~~~~\epsilon>0. $$ Let $$f(z) = \frac{e^{-z^2}}{z-1+i\epsilon}$$ then $$ \sum_{residues~inside~\Gamma} = 0 = \oint_\Gamma f(z) = I+\left(\int_{\Gamma_\epsilon}+\int_{\Gamma_\infty} \right) f(z), $$ where the total contour is $\Gamma\equiv (-R,R)+\Gamma_\epsilon+\Gamma_\infty$ with $R\rightarrow \infty$.

Thus $$ I = - \left(\int_{\Gamma_\epsilon}+\int_{\Gamma_\infty} \right) f(z). $$ The contour $\Gamma_\epsilon$ is a semicircle centered about $z = 1$ of radius $\epsilon$. Its contribution is given by $$ \int_{\Gamma_\epsilon} \mathrm{d}z ~f(z) = i (\theta_2-\theta_1)~ \mathrm{Res}(f;z=1) = \frac{-i\pi}{e}. $$

Evaluating $(1)$ in Mathematica and taking the $\epsilon\rightarrow 0 $ limit gives $$ I = e^{(\epsilon +i)^2} \left(-\pi \text{erfi}(1-i \epsilon )+\log (-1+i \epsilon )+\log \left(\frac{i}{\epsilon +i}\right)-2 i \pi \right) \\ \longrightarrow -\frac{\pi (\text{erfi}(1)+i)}{e}~~~(\text{as}~ \epsilon \rightarrow 0). $$

Thus apparently, $$ \tag{2} \int_{\Gamma_\infty} \mathrm{d}z \, f(z) = \frac{2\pi i}{e}+\frac{\mathrm{erfi}(1)}{e}. $$

Can anyone derive this contribution from the semicircle at infinity? I.e. is $(2)$ correct and how about generalizations of $(1)$ to integrals of the form

$$\tag{3} I = \int_{-\infty}^\infty \mathrm{d}z\ \frac{z^n e^{-z^2}}{(z-a+i\epsilon)(z-b-i\epsilon)},~~~~~\epsilon>0,a,b\in\mathbb{R},n\in \mathbb{N}. $$

Note, erfi is defined as $\mathrm{erfi}(z) \equiv \mathrm{erf}(iz)/i$ with the familiar error function.

  • $\begingroup$ Why do you have $\Gamma_\epsilon$? There's no pole on or above the real axis. Also, even if there were, you should be shrinking the radius of that component towards that pole. $\endgroup$ Apr 23, 2018 at 13:11
  • $\begingroup$ I was thinking that for $\epsilon\rightarrow 0$ the pole is at $z=1$ i.e. on the real axis hence we must indent the contour over it. $\endgroup$ Apr 23, 2018 at 13:13
  • $\begingroup$ This happens for no nonzero $\epsilon$, so no deflection is needed. $\endgroup$ Apr 23, 2018 at 13:14
  • $\begingroup$ Finite you mean $\epsilon>0$? But I do take the zero limit in the above formulas. $\endgroup$ Apr 23, 2018 at 13:16
  • 1
    $\begingroup$ I have a bounty to give! Don't miss it! $\endgroup$ Apr 28, 2018 at 13:53

5 Answers 5


To check your work: if you care about a fast solution, start with considering $I(a)= \int_{-\infty}^{\infty}\frac{e^{-a(x^2-1)}}{x-1}\textrm{dx}$, where by differentiating with respect to $a$ and then integrating back, we're lead to $I(1)=-\sqrt{\pi}\int_0^1 \frac{e^a}{\sqrt{a}}\textrm{d}a=-\pi\operatorname{erfi}(1).$ Hence, we have $$\int_{-\infty}^{\infty}\frac{e^{-x^2}}{x-1}\textrm{dx}=-\frac{\pi}{e}\operatorname{erfi}(1).$$

Note: the integrals above have a meaning only in the CPV sense as seen described at https://en.wikipedia.org/wiki/Cauchy_principal_value.

Literature: related to Faddeeva function (it's sometimes referred to as the plasma dispersion function) - https://en.wikipedia.org/wiki/Faddeeva_function.

  • $\begingroup$ Let's forget about the $i\epsilon$ for a minute. I compute $PV\int_{-\infty}^\infty\frac{e^{-x^2}}{x-1} = -\pi e^{-1}\mathrm{erfi}(1) = + i \pi e^{-1} \mathrm{erf}(i)$. Indenting over the pole at $x=1$ gives $-i\pi \mathrm{Res}(f,1) = -i\pi e^{-1}$. Clearly these two don't cancel to yield zero as the closed loop integrals contains no poles, the total contribution should be zero. The only contribution left is that from the arc at infinity. $\endgroup$ Apr 23, 2018 at 16:45
  • 1
    $\begingroup$ @JustAsk I'm investigating the point. $\endgroup$ Apr 23, 2018 at 17:00
  • 1
    $\begingroup$ @JustAsk You're perfectly right. My investigations shows the contribution comes from the sum of the integrals $\int_{\Gamma_\infty, \theta \in [\pi/4,\pi/2]}$ and $\int_{\Gamma_\infty \theta \in [\pi/2,3\pi/4]}$ on the big arc. Again, both integrals must be viewed in terms of PVC, since separately both blow up to $\infty$. The reamining two integrals on the big arc vanish through the ML inequality. $\endgroup$ Apr 23, 2018 at 17:56
  • $\begingroup$ OK it would be nice if you'd write it up as an answer. $\endgroup$ Apr 23, 2018 at 18:04
  • $\begingroup$ @JustAsk What's curious to me is that you're fine with getting $PV\int_{-\infty}^\infty\frac{e^{-x^2}}{x-1}$ by real methods. I initially thought you wanted to compute everything by contour integration. Not sure why you would want to know what's happening on the big arc in this case. $\endgroup$ Apr 23, 2018 at 19:04

Near the top of the arc, the integrand blows up exponentially. I would avoid using that arc.

Real Method

By substituting $z\mapsto-z$, we get $$ \operatorname{PV}\int_{-\infty}^\infty\frac{e^{-z^2}}{z-1}\mathrm{d}z =-\operatorname{PV}\int_{-\infty}^\infty\frac{e^{-z^2}}{z+1}\mathrm{d}z\tag1 $$ Therefore, $$ \begin{align} \operatorname{PV}\int_{-\infty}^\infty\frac{e^{-z^2-1}e^{-2z}}{z}\mathrm{d}z &=-\operatorname{PV}\int_{-\infty}^\infty\frac{e^{-z^2-1}e^{2z}}{z}\mathrm{d}z\tag2\\ &=-\frac1e\int_{-\infty}^\infty e^{-z^2}\frac{\sinh(2z)}z\,\mathrm{d}z\tag3 \end{align} $$ Explanation:
$(2)$: substitute $z\mapsto z+1$ on the left and $z\mapsto z-1$ on the right of $(1)$
$(3)$: average the right and left of $(2)$

Setting $$ f(a)=\int_{-\infty}^\infty e^{-z^2}\frac{\sinh(az)}z\,\mathrm{d}z\tag4 $$ we have $f(0)=0$ and $$ \begin{align} f'(a) &=\int_{-\infty}^\infty e^{-z^2}\cosh(az)\,\mathrm{d}z\tag5\\ &=\int_{-\infty}^\infty e^{-z^2}e^{az}\,\mathrm{d}z\tag6\\ &=e^{a^2/4}\int_{-\infty}^\infty e^{-z^2}\,\mathrm{d}z\tag7\\[3pt] &=\sqrt\pi\,e^{a^2/4}\tag8 \end{align} $$ Explanation:
$(5)$: take the derivative under the integral
$(6)$: $\cosh(ax)$ is the even part of $e^{ax}$
$(7)$: substitute $z\mapsto z+a/2$
$(8)$: evaluate the integral

Thus, $$ \begin{align} \operatorname{PV}\int_{-\infty}^\infty\frac{e^{-z^2}}{z-1}\mathrm{d}z &=-\frac1e\int_{-\infty}^\infty e^{-z^2}\frac{\sinh(2z)}z\,\mathrm{d}z\tag9\\ &=-\frac{\sqrt\pi}e\int_0^2e^{a^2/4}\,\mathrm{d}a\tag{10}\\ &=-\frac{2\sqrt\pi}e\int_0^1e^{a^2}\,\mathrm{d}a\tag{11}\\[3pt] &=-\frac\pi{e}\,\operatorname{erfi}(1)\tag{12} \end{align} $$ Explanation:
$\phantom{0}(9)$: apply $(3)$
$(10)$: apply $(8)$
$(11)$: substitute $a\mapsto2a$
$(12)$: evaluate the integral

A Cleaner, But Still Real, Approach $$ \begin{align} \mathrm{PV}\int_{-\infty}^\infty\frac{e^{-x^2}}{x-1}\,\mathrm{d}x &=-\mathrm{PV}\int_{-\infty}^\infty\frac{e^{-x^2}}{x+1}\,\mathrm{d}x\tag{13}\\ &=\mathrm{PV}\int_{-\infty}^\infty\frac{e^{-x^2}}{x^2-1}\,\mathrm{d}x\tag{14}\\ &=\left.\frac1e\,\mathrm{PV}\int_{-\infty}^\infty\frac{e^{-a(x^2-1)}}{x^2-1}\,\mathrm{d}x\,\right]_{a=1}\tag{15}\\ &=\frac1e\,\mathrm{PV}\int_{-\infty}^\infty\frac1{x^2-1}\,\mathrm{d}x-\frac1e\int_0^1\int_{-\infty}^\infty e^{-a(x^2-1)}\,\mathrm{d}x\,\mathrm{d}a\tag{16}\\ &=0-\frac1e\int_0^1\sqrt{\frac\pi a}\,e^a\,\mathrm{d}a\tag{17}\\ &=-\frac{2\sqrt\pi}e\int_0^1e^{a^2}\,\mathrm{d}a\tag{18}\\ &=-\frac{2\sqrt\pi}e\frac{\sqrt\pi}2\,\operatorname{erfi}(1)\tag{19}\\[6pt] &=-\frac\pi e\,\operatorname{erfi}(1)\tag{20} \end{align} $$ Explanation:
$(13)$: substitute $x\mapsto-x$
$(14)$: average the left and right sides of $(13)$
$(15)$: set up for differentiation under the integral
$(16)$: write as the integral of the derivative under the integral
$(17)$: the PV can be evaluated using a simple contour integration
$\phantom{(17)\text{:}}$ evaluate the inner integral on the right
$(18)$: substitute $a\mapsto a^2$
$(19)$: evaluate the integral
$(20)$: simplify

which agrees with $(12)$.

  • $\begingroup$ It would be nice finding a way of getting the value of the integral over the real line by contour integration exclusively. $\endgroup$ Apr 25, 2018 at 17:35
  • $\begingroup$ @Waiting: I agree, but I don't think it is going to use the big arc as that way madness lies. SInce erfi is involved, it might be difficult to find a significantly different path. $\endgroup$
    – robjohn
    Apr 25, 2018 at 18:24
  • $\begingroup$ King Lear? Interesting that my requirements make you think of the Shakespeare literature (due to the development of things on the big arc). :-) $\endgroup$ Apr 26, 2018 at 15:44
  • 1
    $\begingroup$ @Waiting: I tried again for quite some time yesterday to try finding a contour integration solution for this problem, but was unable. Since you've awarded the bounty to me, I will continue looking and hopefully find a way to earn it. $\endgroup$
    – robjohn
    May 3, 2018 at 14:09
  • 1
    $\begingroup$ sure, no need to hurry with that. I think this is an interesting question whose answer might open the gate for solutions to more difficult questions similar to this one. After all, I'm glad I could give you the bounty. :-) (some questions simply need more thinking time) $\endgroup$ May 3, 2018 at 15:11

The contribution from the (superfluous) deformation of the segment on $[0,2]$ to a semicircle is cancelled by other parts of the integral along the real axis. This deformation crosses no poles, so the path integral along $\Gamma_\epsilon + [0,2]$ is zero.

So what's going on? In your expression $$ I+\left(\int_{\Gamma_\epsilon}+\int_{\Gamma_\infty} \right) f(z) \text{,} $$ you have two paths from $0$ to $2$. One runs along the real axis and is contributed by $I$. The other runs along $\Gamma_\epsilon$. It should come as no surprise that this contribution is overcounted in the result you have.


$\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{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} \mrm{P.V.}\int_{-\infty}^{\infty}{\expo{-z^{2}} \over z - 1}\,\dd z & = \mrm{P.V.}\int_{-\infty}^{\infty}{\expo{-\pars{z + 1}^{2}} \over z}\,\dd z = \int_{0}^{\infty} {\expo{-\pars{z + 1}^{2}} - \expo{-\pars{z - 1}^{2}} \over z}\,\dd z \\[5mm] & = \sum_{\sigma = \pm 1}\sigma\int_{0}^{\infty} \expo{-\pars{z + \sigma}^{2}}\pars{\int_{0}^{\infty}\expo{-zx}\dd x}\,\dd z \\[5mm] & = \sum_{\sigma = \pm 1}\sigma\int_{0}^{\infty}\int_{0}^{\infty} \exp\pars{-\bracks{z^{2} + 2\sigma z + 1 + xz}}\,\dd z\,\dd x \\[5mm] & = \sum_{\sigma = \pm 1}\sigma\int_{0}^{\infty}\int_{0}^{\infty} \exp\pars{-\bracks{z + \sigma + {x \over 2}}^{2} - 1 + \sigma^{2} + \sigma x + {x^{2} \over 4}}\,\dd z\,\dd x \\[5mm] & = \sum_{\sigma = \pm 1}\sigma\int_{0}^{\infty} \exp\pars{\sigma x + {x^{2} \over 4}}\int_{\sigma + x/2}^{\infty} \exp\pars{-z^{2}}\,\dd z\,\dd x \\[5mm] & = \int_{0}^{\infty}\exp\pars{-z^{2}} \sum_{\sigma = \pm 1}\sigma\int_{0}^{2z - 2\sigma} \exp\pars{{1 \over 4}\braces{\bracks{x + 2\sigma}^{\, 2} - 4\sigma^{2}}} \,\dd x\,\dd z \\[5mm] & = \expo{-1}\int_{0}^{\infty}\exp\pars{-z^{2}} \sum_{\sigma = \pm 1}\sigma\int_{2\sigma}^{2z}\exp\pars{x^{2} \over 4} \,\dd x\,\dd z \\[5mm] & = 2\expo{-1}\int_{0}^{\infty}\exp\pars{-z^{2}} \sum_{\sigma = \pm 1}\sigma\int_{\sigma}^{z}\exp\pars{x^{2}} \,\dd x\,\dd z \\[5mm] & = -2\expo{-1}\int_{0}^{\infty}\exp\pars{-z^{2}} \bracks{\int_{-1}^{z}\exp\pars{x^{2}}\,\dd x - \int_{1}^{z}\exp\pars{x^{2}}\,\dd x}\,\dd z \\[5mm] & = -2\expo{-1}\ \overbrace{\bracks{\int_{0}^{\infty}\exp\pars{-z^{2}}\dd z}} ^{\ds{\root{\pi} \over 2}}\ \overbrace{\int_{-1}^{1}\exp\pars{x^{2}}\,\dd x} ^{\ds{\mbox{Set}\ x = -\ic t}} \\[5mm] & = -2\expo{-1}\root{\pi}\int_{0}^{\ic}\exp\pars{-t^{2}}\pars{-\ic}\,\dd t \\[5mm] & = \ic\pi\expo{-1} \bracks{{2 \over \root{\pi}}\int_{0}^{\ic}\exp\pars{-t^{2}}\dd t} = \bbx{\ic\pi\expo{-1}\mrm{erf}\pars{\ic}} \end{align}

Note that $\ds{\,\mrm{erf}\pars{\ic} = \ic\,\mrm{erfi}\pars{1}}$.


$$I=-pv.\int_{-\infty }^{\infty }\frac{e^{-x^2}}{x-1}dx=-\sum_{n=1}^{\infty }\Gamma (\frac{1-2n}{2})\\ \\ \\ =-\sum_{n=1}^{\infty }(-1)^n\frac{2^n.\sqrt{\pi }}{\prod_{n=1}^{\infty }(2m-1)}=-\sum_{n=1}^{\infty }(-1)^n\frac{2^n\sqrt{\pi }}{\frac{2^n.\Gamma (n+\frac{1}{2})}{\sqrt{\pi }}}\\ \\ \\ \therefore I=-\sum_{n=1}^{\infty }(-1)^n\frac{\pi }{\Gamma (n+\frac{1}{2})}=-\sqrt{\pi }\sum_{n=1}^{\infty }(-1)^n\frac{\Gamma (n).\Gamma (\frac{1}{2})}{\Gamma (n)\Gamma (n+\frac{1}{2})}\\ \\ \\ =-\sqrt{\pi }\sum_{n=1}^{\infty }(-1)^n\int_{0}^{1}\frac{(1-x)^{n-1}}{\sqrt{x}(n-1)!}dx\\ \\ \\ \therefore I=-\frac{\pi }{e}.ierf(i)=\frac{\pi }{e}erfi(1$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.