# Evaluating $\int_{-\infty}^0 \log(\frac{1}{2}\operatorname{erfc}(x))\mathrm dx$

I am looking to evaluate

$$\int_{-\infty}^0 \log\left(\frac{1}{2}\operatorname{erfc}(x)\right)\mathrm dx = -0.337~668~477...$$

Both Maple and Mathematica have failed to give a closed-form expression but indicate the value is around $$−0.337~668~477...$$ which doesn't appear to be close to some well known quantity.

• What exactly is $\operatorname{erfc}(x)$, i.e. how do you define it in this context? – mrtaurho Feb 4 at 13:16
• @mrtaurho It is the complementary error function $\operatorname{erfc}(x) = 1-\operatorname{erf}(x) = \frac{2}{\sqrt{\pi}}\int_x^{\infty}e^{-t^2}dt$ as found in e.g mathworld.wolfram.com/Erfc.html – SweSnow Feb 4 at 13:25
• How do you know that there is an explicit closed form for this integral? – Frank W. Feb 4 at 14:56
• @FrankW. I do not know that a closed form exists but would very much hope it did. I don't really know of any helpful heuristics to determine if a closed form exists when the integrand is composed of non-elementary functions. – SweSnow Feb 4 at 15:57
• I really do hope there is a closed form solution... I'm lost at this stage as to how it could be found. – user150203 Feb 5 at 9:29

$$\textbf{Edition of 19.02.19}$$

Is known, that

$$\begin{cases} \operatorname{erf}x = \dfrac2{\sqrt\pi}\int\limits_0^x e^{-t^2}\,\mathrm dt,\quad \operatorname{erfc}x = \dfrac2{\sqrt\pi}\int\limits_x^\infty e^{-t^2}\,\mathrm dt,\\[4pt] \operatorname{erf}(-\infty) = -1,\quad \operatorname{erf}(0) = 0,\quad \operatorname{erf}(\infty) = 1,\\[4pt] \operatorname{erf}(-x) = - \operatorname{erf}x,\quad \operatorname{erfc}x = 1-\operatorname{erf}x,\quad \operatorname{erfc}(-x)+\operatorname{erfc}(x) = 2,\\[4pt] \operatorname{erfc}(-\infty) = 2,\quad \operatorname{erfc}(0) = 1,\quad \operatorname{erfc}(\infty) = 0.\tag1 \end{cases}$$

So $$I=\int\limits_{-\infty}^0 \log\left(\frac{1}{2}\operatorname{erfc}(x)\right)\mathrm dx = \int\limits_{-\infty}^0 \log\left(1-\frac{1}{2}\operatorname{erfc}(-x)\right)\mathrm dx =\int\limits_0^\infty \log\left(1-\frac{1}{2}\operatorname{erfc}(x)\right)\mathrm dx,$$ or, using Maclaurin series for logarithm in the form of

$$\log(1-x)=-\sum\limits_{n=1}^{\infty}\dfrac{x^n}n,\tag2$$

$$I=-\sum\limits_{n=1}^{\infty}\dfrac1{2^n n} I_n,\tag3$$ wherein \begin{align} &I_n=\int\limits_0^\infty\operatorname{erfc}^n(x)\,\mathrm dx = \operatorname{erfc}^{n}(x)\cdot x\Bigg|_0^\infty -\dfrac{2n}{\sqrt\pi}\int\limits_0^\infty x e^{-x^2}\operatorname{erfc}^{n-1}(x)\,\mathrm dx,\\[4pt] \end{align} \begin{align} &I_n = \dfrac{2n}{\sqrt\pi}\int\limits_0^\infty x e^{-x^2}\operatorname{erfc}^{n-1}(x)\,\mathrm dx,\tag{4.1} \end{align} \begin{align} &I_1 = \dfrac2{\sqrt\pi}\int\limits_0^\infty\,x e^{-x^2}\,\mathrm dx = \dfrac1{\sqrt\pi}\approx0.56418\,95835\,47756,\tag{5.1} \end{align} \begin{align} &I_n= \dfrac{n}{\sqrt\pi}\int\limits_0^\infty \operatorname{erfc}^{n-1}(x)\,\mathrm d e^{-x^2}\\[4pt] &= \dfrac{n}{\sqrt\pi}\operatorname{erfc}^{n-1}(x)\,e^{-x^2} \Bigg|_0^\infty - \dfrac{2n(n-1)}\pi \int\limits_0^\infty e^{-2x^2}\operatorname{erfc}^{n-2}(x)\,\mathrm dx\\[4pt] \end{align} \begin{align} &I_n = \dfrac{n}{\sqrt\pi} - \dfrac{2n(n-1)}\pi \int\limits_0^\infty e^{-2x^2}\operatorname{erfc}^{n-2}(x)\,\mathrm dx,\quad n\geq2,\tag{4.2} \end{align} \begin{align} &I_2 = \dfrac{2}{\sqrt\pi} - \dfrac4\pi \int\limits_0^\infty e^{-2x^2}\,\mathrm dx = \dfrac{2}{\sqrt\pi} - \sqrt{\dfrac2\pi} \operatorname{erf}(x\sqrt2)\Bigg|_0^\infty, \end{align} \begin{align} &I_2 = \int\limits_0^\infty\operatorname{erfc}^2(x)\,\mathrm dx = \dfrac{2-\sqrt2}{\sqrt\pi}\approx0.33049\,46062\,92647,\tag{5.2} \end{align} \begin{align} &I_3 = \dfrac{3}{\sqrt\pi} - \dfrac{12}\pi \int\limits_0^\infty e^{-2x^2}\operatorname{erfc}(x)\,\mathrm dx,\\[4pt] & \int\limits_0^\infty e^{-2x^2}\operatorname{erfc}(x)\,\mathrm dx = \dfrac1{\sqrt2} \int\limits_0^\infty e^{-2x^2}\operatorname{erfc}(x)\,\mathrm d(x\sqrt2) =\dfrac1{\sqrt2} \int\limits_0^\infty e^{-x^2}\operatorname{erfc}\left(\dfrac x{\sqrt2}\right)\,\mathrm dx\\[4pt] & = \sqrt{\dfrac2\pi}\int\limits_0^\infty \int\limits_{\frac x{\sqrt2}}^\infty e^{-(x^2+y^2)}\,\mathrm dy\,\mathrm dx = \sqrt{\dfrac2\pi}\int\limits_0^\infty \int\limits_{\arctan\frac1{\sqrt2}}^{\large\frac\pi2} e^{-\rho^2}\rho \,\mathrm d\rho\,\mathrm d\varphi= \dfrac1{\sqrt{2\pi}}\arctan\sqrt2 ,\\[4pt] \end{align} \begin{align} &I_3 = \dfrac{3}{\sqrt\pi} - \dfrac{6\sqrt2}{\pi\sqrt\pi}\arctan\sqrt2\approx 0.23681\ 21373\ 68199\tag{5.3} \end{align} (see also Wolfram Alpha).

Numerical calculations confirm the correctness of the formula $$(3).$$ But it was not possible to get a closed form of $$I_n$$ for $$n>3.$$

At the same time, the integration of the issue integral by parts gives \begin{align} &I=\int\limits_0^\infty \log\left(1-\frac12\operatorname{erfc}(x)\right)\mathrm dx = \log\left(1-\frac12\operatorname{erfc}(x)\right)\cdot x\Bigg|_0^\infty -\frac1{\sqrt\pi}\int\limits_0^\infty \dfrac{xe^{-x^2}\,\mathrm dx}{1-\frac12\operatorname{erfc}(x)},\\[4pt] \end{align} \begin{align} &I = -\frac1{\sqrt\pi}\int\limits_0^\infty \dfrac{xe^{-x^2}\,\mathrm dx}{1-\frac12\operatorname{erfc}(x)},\tag6 \end{align} \begin{align} &I = -\frac1{\sqrt\pi}\int\limits_0^\infty \left(1 + \frac12\operatorname{erfc}(x) + \frac14\operatorname{erfc}^2(x) + \frac18\operatorname{erfc}^3(x) + \dots+\frac1{2^k}\operatorname{erfc}^k(x)+\dots\right) xe^{-x^2}\,\mathrm dx\\[4pt] &= -\left(\dfrac12I_1+\dfrac18I_2+\dfrac1{24}I_3 +\frac1{8\sqrt\pi}\int\limits_0^\infty \dfrac{\operatorname{erfc}^3(x)\,xe^{-x^2}\,\mathrm dx}{1-\frac12\operatorname{erfc}(x)}\right)\\[4pt] & = -\frac1{\sqrt\pi}\left(\frac12+\dfrac{2-\sqrt2}8+\dfrac1{24}\left(3-\dfrac{6\sqrt2\,\arctan\sqrt2}\pi\right) +\dfrac18\int\limits_0^\infty \dfrac{\operatorname{erfc}^3(x)\,xe^{-x^2}\,\mathrm dx}{1-\frac12\operatorname{erfc}(x)}\right), \end{align} \begin{align} &I = -\frac1{8\sqrt\pi}\left(7-\sqrt2\left(1+\dfrac2\pi\arctan\sqrt2\right) +\int\limits_0^\infty \dfrac{\operatorname{erfc}^3(x)\,xe^{-x^2}\,\mathrm dx}{1-\frac12\operatorname{erfc}(x)}\right)\tag7 \end{align} (see also Wolfram Alpha)

On the other hand, \begin{align} &I=-\frac2{\sqrt\pi}\int\limits_0^\infty \dfrac{xe^{-x^2}\,\mathrm dx}{1 +\operatorname{erf}(x)} =\frac1{\sqrt\pi}\int\limits_0^\infty \dfrac{\mathrm de^{-x^2}}{1+\operatorname{erf}(x)}\\[4pt] &=\frac1{\sqrt\pi} \dfrac{e^{-x^2}}{\left(1+\operatorname{erf}(x)\right)}\Bigg|_0^\infty +\frac2\pi\int\limits_0^\infty \dfrac{\mathrm e^{-2x^2}}{\left(1+\operatorname{erf}(x)\right)^2}\mathrm dx\ =\frac2{\pi}\int\limits_0^\infty \dfrac{\mathrm e^{-2x^2}}{\left(1+\operatorname{erf}(x)\right)^2}\mathrm dx-\frac1{\sqrt\pi}\\[4pt] &=\frac1{\sqrt{2\pi}}\int\limits_0^\infty \dfrac{\mathrm d\operatorname{erf}(x\sqrt2)}{\left(1+\operatorname{erf}(x)\right)^2} -\frac1{\sqrt\pi}\\ &=\frac1{\sqrt{2\pi}}\dfrac{\operatorname{erf}(x\sqrt2)}{\left(1+\operatorname{erf}(x)\right)^2}\Bigg|_0^\infty +\frac1{\sqrt{2\pi}}\cdot2\cdot\frac2{\sqrt\pi}\int\limits_0^\infty \dfrac{e^{-x^2}\operatorname{erf}(x\sqrt2)}{\left(1+\operatorname{erf}(x)\right)^3}\,\mathrm dx -\frac1{\sqrt\pi}\\[4pt] &=\frac{2\sqrt2}\pi\int\limits_0^\infty \dfrac{e^{-x^2}\operatorname{erf}(x\sqrt2)}{\left(1+\operatorname{erf}(x)\right)^3}\,\mathrm dx-\frac1{\sqrt\pi}+\frac1{4\sqrt{2\pi}}.\\[4pt] \end{align} Binomial decomposition in the form of

$$\dfrac1{(1-y)^{m+1}} = \sum_{n=m}^{\infty}\binom nm y^{n-m}\tag8$$

allows the further transformations in the form of \begin{align} &I = \frac 1{2\pi\sqrt2}\int\limits_0^\infty \dfrac{e^{-x^2}\operatorname{erf}(x\sqrt2)}{\left(1-\frac12\operatorname{erfc} x\right)^3}\,\mathrm dx-\frac1{\sqrt\pi}+\frac1{4\sqrt{2\pi}}\\[4pt] & = \frac 1{2\pi\sqrt2}\int\limits_0^\infty e^{-x^2}\operatorname{erf}(x\sqrt2)\sum_{n=2}^{\infty}\dfrac{n(n-1)}{2^{n-2}}\,\operatorname{erfc}^{n-2} x\,\mathrm dx-\frac1{\sqrt\pi}+\frac1{4\sqrt{2\pi}}\\[4pt] & = \frac 1{2\pi\sqrt2}\sum_{n=0}^{\infty}\dfrac{(n+1)(n+2)}{2^n}\int\limits_0^\infty e^{-x^2}\operatorname{erf}(x\sqrt2)\,\operatorname{erfc}^n x\,\mathrm dx-\frac1{\sqrt\pi}+\frac1{4\sqrt{2\pi}}, \end{align}

$$I = -\frac1{\sqrt\pi}+\frac1{4\sqrt{2\pi}} + \dfrac{\arctan\sqrt2}{2\pi\sqrt{2\pi}}+\frac 1{2\pi\sqrt2}\sum_{n=1}^{\infty}\dfrac{(n+1)(n+2)}{2^n}J_n,\tag9$$ where $$J_n=\int\limits_0^\infty e^{-x^2}\operatorname{erf}(x\sqrt2)\,\operatorname{erfc}^n x\,\mathrm dx\tag{10}$$ (see also Wolfram Alpha).

Besides, can be used the presentations \begin{align} &I = \frac1{\sqrt\pi}\int\limits_0^\infty \dfrac{\mathrm d(e^{-x^2})}{1+\operatorname{erfc}(x)} = -\frac1{\sqrt\pi}\int\limits_0^1 \dfrac{\mathrm dz}{1+\operatorname{erf}(\sqrt{-\log z})}, \end{align} wherein $$\dfrac1{1+\operatorname{erf}\sqrt{-\log \dfrac{\sqrt\pi y}2}} =\dfrac1{1+y}\left(1+\dfrac\pi{12}\dfrac{y^3}{1+y}\left(1+\dfrac\pi{120}\dfrac{y^3-9y^2}{1+y}\right)\right)+\dots$$ (see also Wolfram Alpha).

However, closed form was not obtained.

I don't believe there is any simple formula. More precise evaluation yields (check 'WorkingPrecision' if using Mathematica):

$$-0.3376684770344218621827398500$$

This can be reverse looked up using this nice page: here, which checks it against (a lot of) symbolic expressions evaluated very precisely. No hits there, so if anything it'll probably be a rather complicated expression.

This is by no means conclusive. Good luck on Your hunt!