I found the following integral evaluation very interesting to me:
Integral of product of two error functions (erf)
and I hoped that I could use that result to evaluate the following integral:
$$
\int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\,\mathrm{erfc}\left(t-c\right)\,\mathrm{erfc}\left(d-t\right)\,\mathrm{d}t=\frac{4}{\pi}\int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\int_{t-c}^{\infty}\int_{d-t}^{\infty}\exp\left(-u^{2}-v^{2}\right)\,\mathrm{d}u\,\mathrm{d}v\,\mathrm{d}t
$$
So I note that $u\geq t-c$, $v\geq d-t$,
thus $t\leq u+c$ and $t\geq d-v$,
thus $d-v\leq t\leq u+c$ and $u+v\geq d-c$.
Hence
$$
\frac{4}{\pi}\int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\int_{d-t}^{\infty}\int_{t-c}^{\infty}\exp\left(-u^{2}-v^{2}\right)\,\mathrm{d}u\,\mathrm{d}v\,\mathrm{d}t=
$$
$$
\qquad\qquad =\frac{4}{\pi}\int\!\int_{u+v>d-c}\exp\left(-u^{2}-v^{2}\right)\,\int_{d-v}^{u+c}\exp\left(-t^{2}\right)\,\mathrm{d}t\,\mathrm{d}u\,\mathrm{d}v
$$
I know that
$$
\int_{d-v}^{u+c}\exp\left(-t^{2}\right)\,\mathrm{d}t=\frac{1}{2}\sqrt{\pi}\left(\mathrm{erf}\left(u+c\right)-\mathrm{erf}\left(d-v\right)\right)
$$
but I don't quite understand how I should deal with
$$\frac{4}{\pi}\int\!\int_{u+v>d-c}\exp\left(-u^{2}-v^{2}\right)\mathrm{d}u\,\mathrm{d}v\,.
$$
What limits of integration I should use there?
Thanks for any suggestions.
Best Answer
Let $c \in {\mathbb R}$ and $d \in {\mathbb R}$. Without loss of generality we can consider a slightly different function: \begin{equation} f(c,d):= \int\limits_{-\infty}^\infty \exp(-t^2) \mbox{erfc}(t-c) \mbox{erfc}(t-d) dt \end{equation} Now we differentiate with respect to $c$. We have: \begin{eqnarray} \partial_c f(c,d) &=& \lim\limits_{\epsilon \rightarrow 0} \frac{\sqrt{2}}{\sqrt{\pi}} \exp(-\frac{c^2}{2}) \left( \sqrt{\pi} + 2 \sqrt{\pi} T(\epsilon,\frac{1}{\sqrt{2}},\frac{2d-c}{\sqrt{2}}) - 2 \sqrt{\pi} T(\epsilon,\frac{1}{\sqrt{2}},\frac{-2d+c}{\sqrt{2}})\right)\\ &=&\sqrt{2} \exp(-\frac{c^2}{2}) \left( 1-erf(\frac{c-2 d}{\sqrt{6}})\right) \end{eqnarray} where $T(h,a,b)$ is the generalized Owen's T function Generalized Owen's T function .
Now, all we need to do is to integrate. Since $f(-\infty,d)=0$ we integrate over $c$ from minus infinity to $c$. We have: \begin{eqnarray} f(c,d) &=& \sqrt{2} \left( \sqrt{\frac{\pi}{2}}(1+erf(\frac{c}{\sqrt{2}}) + 2erf(\frac{d}{\sqrt{2}})) + \sqrt{2 \pi} 2 T(c,\frac{1}{\sqrt{3}},-\frac{2 d}{\sqrt{3}})\right) \\ &=& \frac{1}{3 \sqrt{\pi}} \left( 12 \pi T\left(c,\frac{c-2 d}{\sqrt{3} c}\right)+12 \pi T\left(d,\frac{d-2 c}{\sqrt{3} d}\right)-6 \arctan\left(\frac{c-2 d}{\sqrt{3} c}\right)-6 \arctan\left(\frac{d-2 c}{\sqrt{3} d}\right)+3 \pi \text{erf}\left(\frac{c}{\sqrt{2}}\right)+3 \pi \text{erf}\left(\frac{d}{\sqrt{2}}\right)+4 \pi\right) \end{eqnarray} where $T(h,a)$ is Owen's T function https://en.wikipedia.org/wiki/Owen%27s_T_function .
Update: Now let us take four real numbers $a_1 \in {\mathbb R}$, $a_2 \in {\mathbb R}$, $c\in {\mathbb R}$ and $d \in {\mathbb R}$ and consider a more general integral: \begin{equation} f^{(a_1,a_2)}(c,d):= \int\limits_{-\infty}^\infty \exp(-t^2) \mbox{erfc}(a_1 t-c) \mbox{erfc}(a_2 t-d) dt \end{equation} Then by doing the same calculations as above we easily arrive at the following formula: \begin{eqnarray} &&f^{(a_1,a_2)}(c,d)= \frac{1}{\sqrt{\pi}} \left(\right.\\ && 4 \pi T\left(\frac{\sqrt{2} c}{\sqrt{a_1^2+1}},\frac{a_1 a_2 c-\left(a_1^2+1\right) d}{c \sqrt{a_1^2+a_2^2+1}}\right)+4 \pi T\left(\frac{\sqrt{2} \sqrt{a_1^2+1} d}{\sqrt{a_1^2 a_2^2+a_1^2+a_2^2+1}},\frac{a_1 a_2 d-\left(a_2^2+1\right) c}{d \sqrt{a_1^2+a_2^2+1}}\right) +\\ &&-2 \arctan\left(\frac{a_1 a_2 c-\left(a_1^2+1\right) d}{c \sqrt{a_1^2+a_2^2+1}}\right)-2 \arctan\left(\frac{a_1 a_2 d-\left(a_2^2+1\right) c}{d \sqrt{a_1^2+a_2^2+1}}\right)+\\ &&\pi \text{erf}\left(\frac{\sqrt{a_1^2+1} d}{\sqrt{a_1^2 a_2^2+a_1^2+a_2^2+1}}\right)+\pi \text{erf}\left(\frac{c}{\sqrt{a_1^2+1}}\right)+\\ &&\pi +2 \arctan\left(\frac{a_1 a_2}{\sqrt{a_1^2+a_2^2+1}}\right)\\ &&\left.\right) \end{eqnarray}