How do I find a closed form of $$\int_0^\infty1-\text{erf}(x)dx\tag{1}$$? A follow up is $$\int_0^\infty x(1-\text{erf}(x))dx\tag{2}$$Where $$\text{erf}(x)=\frac2{\sqrt{\pi}}\int_0^xe^{-t^2}dt$$The second integral seems to be $\frac14$ according to desmos. I also found that the first integral is $\frac1{\sqrt{\pi}}$. I have solved these integrals (I will post them in an answer) but I wonder if there are other solutions.
Closed form for the similar integrals $\int_0^\infty1-\text{erf}(x)dx$ and $\int_0^\infty x(1-\text{erf}(x))dx$
calculuserror functionintegration
Related Solutions
$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}% \newcommand{\dd}{{\rm d}}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\fermi}{\,{\rm f}}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\half}{{1 \over 2}}% \newcommand{\ic}{{\rm i}}% \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\ol}[1]{\overline{#1}}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
$\ds{I \equiv \int_{0}^{\infty}x^{2}\expo{-x^{2}}{\rm erf}\pars{x}\ln\pars{x} \,\dd x}$. Let's $\ds{{\cal I}\pars{\mu} \equiv \int_{0}^{\infty}x^{\mu}\expo{-x^{2}}{\rm erf}\pars{x}\,\dd x}$ such that $\ds{I = \lim_{\mu \to 2}\totald{{\cal I}\pars{\mu}}{\mu}}$
Since $\ds{{\rm erf}\pars{x} \stackrel{{\rm def.}}{=}{2 \over \root{\pi}}\int_{0}^{x}\expo{-y^{2}}\,\dd y}$: \begin{align} {\cal I}\pars{\mu}&=\int_{0}^{\infty}x^{\mu}\expo{-x^{2}} {2 \over \root{\pi}}\int_{0}^{\infty}\Theta\pars{x - y}\expo{-y^{2}}\,\dd y\,\dd x \\[3mm]&= {2 \over \root{\pi}}\int_{0}^{\pi/2}\dd\theta\,\cos^{\mu}\pars{\theta} \Theta\pars{\cos\pars{\theta} - \sin\pars{\theta}} \overbrace{\int_{0}^{\infty}\dd r\,r^{\mu + 1}\expo{-r^{2}}} ^{\Gamma\pars{1 + \mu/2}/2} \\[3mm]&={1 \over \root{\pi}}\,\Gamma\pars{1 + {\mu \over 2}} \int_{0}^{\pi/4}\dd\theta\,\cos^{\mu}\pars{\theta} \end{align}
\begin{align} I&=\lim_{\mu \to 2}\totald{{\cal I}\pars{\mu}}{\mu}= {1 \over 2\root{\pi}}\,\overbrace{\Psi\pars{2}}^{\ds{1 - \gamma}}\ \overbrace{\int_{0}^{\pi/4}\dd\theta\,\cos^{2}\pars{\theta}}^{\ds{\pars{\pi + 2}/8}} \\[3mm]&+ {1 \over \root{\pi}}\,\overbrace{\Gamma\pars{2}}^{\ds{1}} \overbrace{% \int_{0}^{\pi/4}\dd\theta\,\cos^{2}\pars{\theta}\ln\pars{\cos\pars{\theta}}} ^{\ds{\braces{4G + \pi - 2\bracks{1 + \ln\pars{2}} - \pi\ln\pars{4}}/16}} \end{align} $\Gamma\pars{z}$ and $\Psi\pars{z}$ are the $\it Gamma$ and $\it Digamma$ functions, respectively. $\gamma$ and $G$ are the $\it Euler-Mascheroni$ and Catalan constants, respectively.
$$ \begin{array}{|l|}\hline \mbox{}\\ \quad{\displaystyle\int_{0}^{\infty}x^{2}\expo{-x^{2}} \,\mathrm{erf}\pars{x}\ln\pars{x}\,\dd x}\quad \\[2mm] = \quad{{\displaystyle\quad\pars{\pi + 2}\pars{1 - \gamma} + 4G + \pi - 2\bracks{1 + \ln\pars{2}} - \pi\ln\pars{4}\quad} \over {\displaystyle 16\root{\pi}}}\quad \\ \mbox{}\\ \hline \end{array} \approx 0.0436462 $$
Best Answer
Note that the function $t \mapsto \frac{2}{\sqrt{\pi}}e^{-t^2}$ is nothing but the density of random variable $Y=|X|$, where $X$ has $\mathcal N(0,\frac{1}{2})$ distribution (i.e. gaussian/normal with mean $0$ and variance $\frac{1}{2}$).
Then, $1-\text{erf}(x)$ is nothing but $\mathbb P(|X| > x)$.
Moreover, we have a formula for $p'$th absolute moment in terms of CDF, i.e. $$ \mathbb E|X|^p = \int_0^\infty pt^{p-1} \mathbb P(|X|>t)dt.$$
Hence, $$ \int_0^\infty (1-\text{erf}(x))dx = \int_0^\infty \mathbb P(|X|>x)dx = \mathbb E|X| = \frac{1}{\sqrt{2}} \mathbb E|\mathcal N(0,1)| = \frac{1}{\sqrt{\pi}}$$ and $$ \int_0^\infty x(1-\text{erf}(x))dx = \frac{1}{2} \int_0^\infty 2x^{2-1}\mathbb P(|X|>x)dx = \frac{1}{2} \mathbb E|X|^2 = \frac{1}{4}.$$
More generally, given any $p>0$ you have $$ \int_0^\infty x^p (1-\text{erf}(x))dx = \frac{1}{p+1} \int_0^\infty(p+1) x^{p+1 - 1}\mathbb P(|X|>x)dx $$ $$ = \frac{1}{p+1} \mathbb E|X|^{p+1} = \frac{\mathbb E|\mathcal N(0,1)|^{p+1}}{(p+1) 2^{\frac{p+1}{2}}} = \frac{1}{\sqrt{\pi}(p+1)} \Gamma\left(\frac{p}{2}+1\right) = \frac{p\Gamma\left(\frac{p}{2}\right)}{2(p+1)\sqrt{\pi}},$$ where $$\Gamma(a) = \int_0^\infty x^{a-1}e^{-x}dx, \quad a>0$$ is the Euler-Gamma function.