Evaluate $\int_0^{\infty } e^{-x^2+2 x} \text{erf}(x+1) \, dx$

definite integralserror functiongaussian-integral

I am interested in evaluating:

$$\int_0^{\infty } e^{-x^2+2 x} \text{erf}(x+1) \, dx$$

By using change of variable $x\to 1+\frac{y}{\sqrt{2}}$, this is transformed into:

$$\int_{-\sqrt{2}}^{\infty } \frac{e \exp \left(-\frac{y^2}{2}\right)
\text{erf}\left(2+\frac{y}{\sqrt{2}}\right)}{\sqrt{2}} \, dy$$

Splitting about $0$ we get:

$$\int_{-\sqrt{2}}^0 \frac{e \exp \left(-\frac{y^2}{2}\right) \text{erf}\left(2+\frac{y}{\sqrt{2}}\right)}{\sqrt{2}} \,
dy+\int_0^{\infty } \frac{e \exp \left(-\frac{y^2}{2}\right) \text{erf}\left(2+\frac{y}{\sqrt{2}}\right)}{\sqrt{2}}
\, dy$$

I could compute the second integral to be: $-\frac{1}{4} e \sqrt{\pi } \left(\text{erfc}\left(\sqrt{2}\right)^2-2\right)$

However I do not know how to evaluate the first one.
Any help is appreciated.

Best Answer

The problem can be reduced to $$I= \frac{1}{\sqrt{\pi}} \left(\text{e}\pi - f(1,1) - \frac{1}{\text{e}} f(2,\infty) \right), $$ where $f(a,b) = \int_0^b \text{e}^{-ax^2} \frac{1}{1+x^2}\text{d}x$. These integrals look a bit more common, and following @Conreu's insight, they can actually be solved exactly (at least for the needed $b=1$ and $b=\infty$) -- see the second edit.

Now to show the above relation: Write $$I = \text{e} \int_{-1}^\infty \text{e}^{-x^2} \text{erf}(x+2)\text{d}x = \frac{2\text{e}}{\sqrt{\pi}} \int_{-1}^\infty \int_0^{x+2} \text{e}^{-x^2-y^2}\text{d}x\text{d}y.$$ Switching to polar coordinates with $x=r\cos\phi$ and $y=r\sin\phi$ gives $$I = \frac{2\text{e}}{\sqrt{\pi}} \int_{0}^\pi \int_0^{r(\phi)} \text{e}^{-r^2}r\text{d}r\text{d}\phi,$$ where the complexity of the integration region is hidden in $r(\phi)$. The inner integral is trivial, and we get $$I = \frac{\text{e}}{\sqrt{\pi}} \int_0^\pi \left(1-\text{e}^{-r(\phi)^2} \right)\text{d}\phi. $$ Looking at the boundaries, we have $$r(\phi) = \begin{cases} \infty & 0\le \phi < \pi/4 \\\\ \frac{2}{\sin(\phi)-\cos(\phi)} & \pi/4 < \phi < 3\pi/4 \\\\ \frac{1}{\cos(\phi)} & 3\pi/4 < \phi < \pi \end{cases}.$$ Thus, $$I = \frac{\text{e}}{\sqrt{\pi}} \left( \pi - \int_{3\pi/4}^\pi \text{e}^{-\sec(\phi)^2} \text{d}\phi - \int_{\pi/4}^{3\pi/4} \text{e}^{-4[\sin(\phi) - \cos(\phi)]^{-2}} \text{d}\phi \right).$$ Some more trigonometry and substituting $x=\tan(\phi)$ in the first integral and $x=\cot(\phi)$ in the second one then gives the form stated above. The numerical results for the three terms are \begin{align*} \text{e}\sqrt{\pi} &= 4.818029\dots,\\\\ \frac{1}{\sqrt{\pi}}f(1,1) &= \frac{1}{\sqrt{\pi}}\int_0^1 \text{e}^{-x^2} \frac{1}{1+x^2}\text{d}x = 0.349133\dots,\\\\ \frac{1}{\text{e}\sqrt{\pi}}f(2,\infty) &= \frac{1}{\text{e}\sqrt{\pi}}\int_0^\infty \text{e}^{-2x^2} \frac{1}{1+x^2}\text{d}x = 0.109611\dots, \end{align*} and $I=4.359285\dots$.

Edit: As requested, a few more details on the trigonometry: Note that $\sin(\phi)-\cos(\phi) = \sqrt{2} \sin(\phi-\pi/4)$, so the second integral is $$\int_{\pi/4}^{3\pi/4} \text{e}^{-2\sin(\phi-\pi/4)^{-2}} \text{d}\phi = \int_{0}^{\pi/2} \text{e}^{-2\csc(\phi)^{2}} \text{d}\phi.$$ Now use $\csc(\phi)^2=1+\cot(\phi)^2$ and substitute $x=\cot(\phi)$.

Edit2: Exact solutions for $f(a,b)$ for special $b$ (again, credit to @Conreu).

Let's start with $b=\infty$ and write $I(a)=f(a,\infty)$. Then $$I'(a) = -\int_0^\infty \text{e}^{-ax^2} \frac{x^2}{1+x^2}\text{d}x = I(a) - \int_0^\infty \text{e}^{-ax^2}\text{d}x = I(a) - \frac{1}{2} \sqrt{\frac{\pi}{a}}.$$ The solution of this ODE is of the form $I(a)=c(a)\text{e}^a$, and inserting this yields $c'(a)\text{e}^a = - \frac{1}{2} \sqrt{\frac{\pi}{a}}$, which can readily be integrated to give $$c(a)=c_0 - \frac{\pi}{2}\text{erf}(\sqrt{a}).$$ Thus, we find $I(a) = \left(c_0 - \frac{\pi}{2}\text{erf}(\sqrt{a}) \right) \text{e}^a$, and with $a=0$ giving $I(0)=\frac{\pi}{2}$, we finally have $$f(a,\infty) = \frac{\pi}{2} \text{erfc}(\sqrt{a}) \text{e}^a.$$ Similarly, for $I(a)=f(a,b=1)$, differentiating gives $$I'(a) = -\int_0^1 \text{e}^{-ax^2} \frac{x^2}{1+x^2}\text{d}x = I(a) - \int_0^1 \text{e}^{-ax^2}\text{d}x = I(a) - \frac{1}{2} \sqrt{\frac{\pi}{a}} \text{erf}(\sqrt{a}).$$ Using $\int \text{e}^{-x} \text{erf}(\sqrt{x}) \frac{1}{\sqrt{x}}\text{d}x = \frac{\sqrt{\pi}}{2} \text{erf}(\sqrt{x})$ and $I(0) = \frac{\pi}{4}$, we then find $$f(a,1) = \frac{\pi}{4} \left(1 - \text{erf}(\sqrt{a})^2 \right) \text{e}^a.$$ Combining all the results gives the exact answer \begin{align} I &= \frac{1}{\sqrt{\pi}} \left(\text{e}\pi - \frac{\pi}{4} \left(1 - \text{erf}(1)^2 \right) \text{e} - \frac{1}{\text{e}} \frac{\pi}{2} \text{erfc}(\sqrt{2}) \text{e}^2 \right) \\\\ &= \text{e}\sqrt{\pi}\left( \frac{3}{4} - \frac{1}{2} \text{erfc}(\sqrt{2}) + \frac{1}{4} \text{erf}(1)^2 \right) = 4.359285\dots \end{align} Edit3: Final edit, my intuition about the $f$-integrals was correct. These are actually known as Owen's T function, which are defined as $$T(h,b) = \frac{1}{2\pi} \int_0^b \text{e}^{-\frac{1}{2} h^2 (1+x^2)}\frac{1}{1+x^2} \text{d}x,$$ and we have $f(a,b) = 2\pi \text{e}^a T(\sqrt{2a}, b)$. The result then also follows from special cases of this function known in the literature.