# Integral of product of two error functions (erf)

In the course of my research I came across the following integral:

$$\int\nolimits_{-\infty}^{\infty}\operatorname{erf}(a+x)\operatorname{erf}(a-x)dx$$

where $$\operatorname{erf}(x)=\frac{2}{\sqrt{\pi}}\int_{0}^{x}e^{-t^2}dt$$ is the familiar error function.

Does anyone know if this is solvable? If so, a suggestion on how to do this would be very much appreciated. I can tolerate a solution in terms of $\operatorname{erf}$ functions of $a$. I have tried my usual sources in these matters (G&R, the tables on the Wolfram website, Abramowitz's Handbook of Mathematical Formulas, the web) but couldn't find anything of use.

Thank you!

• Perhaps you are interested in $$\int_{-\infty}^\infty \left( \text{erf}(a+x) \text{erf}(a-x)+1 \right)\ dx = \frac{2 \sqrt{2}}{\sqrt{\pi}} e^{-2 a^2} + 4 a\ \text{erf}(\sqrt{2} a)$$ – Robert Israel Sep 9 '11 at 5:45
• This came from trying to find an expression the differential entropy of a random variable that is distributed as the sum of a uniform random variable $\mathcal{U}[-\delta,\delta]$ and a zero-mean Gaussian. I would be satisfied to find a meaningful lower bound on differential entropy. Perhaps I should ask about that in a separate question? – M.B.M. Sep 9 '11 at 20:12
• Let $X∼\mathcal{U}[-\delta,\delta]$ and $Y \sim \mathcal{N}(0,\sigma^2)$ be independent. By the entropy-power inequality (lower-bound) and the maximum-entropy property of the normal distribution (upper bound), we get that $$\frac{1}{2}\log_2(4 \delta^2 + 2\pi e\sigma^2) \leq h(X+Y) \leq \frac{1}{2} \log_2( 2\pi e \delta^2 / 3 + 2\pi e \sigma^2) \> .$$ How much tighter of a bound do you need? (NB: $2 \pi e /3 \approx 5.693$.) – cardinal Sep 10 '11 at 5:54
• The integral you request does not converge. $\lim\limits_{x\to-\infty}\operatorname{erf}(x)=-1$ and $\lim\limits_{x\to\infty}\operatorname{erf}(x)=1$, thus when $|x|$ is big, the product $\operatorname{erf}(a-x)\operatorname{erf}(a+x)\cong-1$. What you must want is the integral suggested by Robert Israel. – robjohn Sep 10 '11 at 9:06
• @cardinal: Special thank you with help on the lower bound for differential entropy of the sum of a uniform and a Gaussian! I did not know about the entropy-power inequality, so, thank you for adding that tool to my arsenal! – M.B.M. Sep 12 '11 at 0:13

$\operatorname{erf}(x)$ is an odd function, therefore, \begin{align} \int_{-\infty}^\infty(\operatorname{erf}(a+x)+\operatorname{erf}(a-x))\;\mathrm{d}x &=\lim_{L\to\infty}\;\int_{-L}^L(\operatorname{erf}(x+a)-\operatorname{erf}(x-a))\;\mathrm{d}x\\ &=\lim_{L\to\infty}\;\int_{-L+a}^{L+a}\operatorname{erf}(x)\;\mathrm{d}x-\lim_{L\to\infty}\;\int_{-L-a}^{L-a}\operatorname{erf}(x)\;\mathrm{d}x\\ &=\lim_{L\to\infty}\;\int_{L-a}^{L+a}\operatorname{erf}(x)\;\mathrm{d}x-\lim_{L\to\infty}\;\int_{-L-a}^{-L+a}\operatorname{erf}(x)\;\mathrm{d}x\\ &=4a\tag{1} \end{align} since $\lim\limits_{x\to\infty}\operatorname{erf}(x)=1$ and $\lim\limits_{x\to-\infty}\operatorname{erf}(x)=-1$.

Furthermore, \begin{align} \int_{-\infty}^\infty\left(\operatorname{erf}(a+x)\operatorname{erf}(a-x)+1 \right)\;\mathrm{d}x &=\int_{-\infty}^\infty(\operatorname{erf}(a+x)+1)(\operatorname{erf}(a-x)+1)\;\mathrm{d}x\\ &-\int_{-\infty}^\infty(\operatorname{erf}(a+x)+\operatorname{erf}(a-x))\;\mathrm{d}x\tag{2} \end{align} To evaluate \begin{align} \int_{-\infty}^\infty(\operatorname{erf}(a+x)+1)(\operatorname{erf}(a-x)+1)\;\mathrm{d}x &=\frac{4}{\pi}\int_{-\infty}^\infty\int_{-\infty}^{a+x}\int_{-\infty}^{a-x}e^{-s^2-t^2}\;\mathrm{d}s\;\mathrm{d}t\;\mathrm{d}x \end{align} note that $s\le a+x$ and $t\le a-x$; i.e. $s-a\le x\le a-t$ and $s+t\le2a$. Thus, \begin{align} \frac{4}{\pi}\int_{-\infty}^\infty\int_{-\infty}^{a+x}\int_{-\infty}^{a-x}e^{-s^2-t^2}\;\mathrm{d}s\;\mathrm{d}t\;\mathrm{d}x &=\frac{4}{\pi}\int\int_{s+t\le2a}\int_{s-a}^{a-t}e^{-s^2-t^2}\;\mathrm{d}x\;\mathrm{d}s\;\mathrm{d}t\\ &=\frac{4}{\pi}\int_{-\infty}^\infty\int_{-\infty}^\infty(2a-s-t)_+\;e^{-s^2-t^2}\;\mathrm{d}s\;\mathrm{d}t \end{align} Change variables: $u=(s+t)/\sqrt{2}$ and $v=(s-t)/\sqrt{2}$ so that $s=(u+v)/\sqrt{2}$ and $t=(u-v)/\sqrt{2}$: \begin{align} \frac{4}{\pi}\int_{-\infty}^\infty\int_{-\infty}^\infty(2a-s-t)_+\;e^{-s^2-t^2}\;\mathrm{d}s\;\mathrm{d}t &=\frac{4}{\pi}\int_{-\infty}^\infty\int_{-\infty}^\infty(2a-\sqrt{2}u)_+\;e^{-u^2-v^2}\;\mathrm{d}u\;\mathrm{d}v\\ &=\frac{4}{\sqrt{\pi}}\int_{-\infty}^{\sqrt{2}a}(2a-\sqrt{2}u)\;e^{-u^2}\;\mathrm{d}u\\ &=4a(\operatorname{erf}(\sqrt{2}a)+1)-\frac{4}{\sqrt{\pi}}\int_{-\infty}^{\sqrt{2}a}\sqrt{2}u\;e^{-u^2}\;\mathrm{d}u\\ &=4a(\operatorname{erf}(\sqrt{2}a)+1)-\frac{2\sqrt{2}}{\sqrt{\pi}}\int_{-\infty}^{\sqrt{2}a}\;e^{-u^2}\;\mathrm{d}u^2\\ &=4a(\operatorname{erf}(\sqrt{2}a)+1)+\frac{2\sqrt{2}}{\sqrt{\pi}}\;e^{-2a^2} \end{align} Therefore, $$\int_{-\infty}^\infty\left(\operatorname{erf}(a+x)+1\right)\left(\operatorname{erf}(a-x)+1\right)\;\mathrm{d}x =4a\left(\operatorname{erf}(\sqrt{2}a)+1\right)+\frac{2\sqrt{2}}{\sqrt{\pi}}\;e^{-2a^2}\tag{3}$$ Thus, the convolution of $\operatorname{erf}(x)+1$ with itself is $2x(\operatorname{erf}(x/\sqrt{2})+1)+\frac{2\sqrt{2}}{\sqrt{\pi}}e^{-x^2/2}$.

Subtract $4a$ from $(3)$ using $(1)$ and $(2)$ to get $$\int_{-\infty}^\infty\left(\operatorname{erf}(a+x)\operatorname{erf}(a-x)+1 \right)\;\mathrm{d}x =4a\operatorname{erf}(\sqrt{2}a)+\frac{2\sqrt{2}}{\sqrt{\pi}}\;e^{-2a^2}\tag{4}$$ My guess is you want either $(3)$ or $(4)$.

• Thank you for the neat derivation of an interesting definite integral -- and, yes, as you pointed out, the original integral does diverge. However, cardinal's comment above helped me solve the underlying problem. Thank you all for your help with this! – M.B.M. Sep 12 '11 at 0:17
• $$\Im\left\{\int_0^1 \frac{1}{x+x^i} \ dx\right\}$$ – user 1357113 Oct 9 '14 at 19:59
• This is the integral on chat $$\int_0^1 \frac{\displaystyle \sin\left(\log\left(\frac{1}{x}\right)\right)}{x^2+2x\cos(\log(x))+1} \ dx=\Im\left\{\int_0^1 \frac{1}{x+x^i} \ dx\right\}$$ – user 1357113 Oct 9 '14 at 20:40
• In the course of doing some convolution calculations, I came across a related integral identity: $$\int_{-\infty}^\infty \left[\text{erf}(x+a)-\text{erf}(x-a)\right]^2\,dx = 8 u\, \text{erf}\left(u \sqrt{2}\right)-4 \sqrt{\frac{2}{\pi }} \left(1-e^{-2 u^2}\right)$$ Presumably some of the ideas that were applicable here could be used; for instance, we can chop the integrand up as $$(\text{erf}(x+a)^2-1)+2(\text{erf}(x-a)\text{erf}(x+a)+1)+(\text{erf}(x-a)^2-1),$$ and each term has a finite integral. – Semiclassical Oct 16 '17 at 17:48
• In fact, one has $$\int_{-\infty}^\infty (\text{erf}(x+a)^2-1)\,dx=\int_{-\infty}^\infty (\text{erf}(x-a)^2-1)\,dx=\int_{-\infty}^\infty (\text{erf}(x)^2-1)\,dx,$$ and apparently that last integral equals $-2\sqrt{2/\pi}$. That eliminates the outer terms, and the inner term corresponds to your identity (4). So all of those together give my identity---neat. – Semiclassical Oct 16 '17 at 18:01

$\int_{-\infty}^\infty 4/\pi \int_0^{a+x} e^{-t^{2}} dx$ . $\int_0^{a-x} e^{-t^{2}}$ dx $= \int_{-\infty}^\infty 4/\pi [-(1/2t) e^{-t^{2}}]_0^{a+x} [-(1/2t) e^{-t^{2}}]_0^{a-x}$ = $\int_{-\infty}^\infty (4/\pi) ((1/2a) e^{-a^{2}})^{2} - ((1/2x) e^{-x^{2}})^{2}$ = $[-((1/2x) e^{-x^{2}})^{2}]_{-\infty}^\infty$ = $\int_{-\infty}^\infty -((1/2x) e^{-x^{2}})^{2}$= $\int_{-\infty}^\infty -((1/4x^{2}) e^{-2x^{2}})]$ = $[-(1/4x) e^{-2x^{2}}]_{-\infty}^\infty - \int_{-\infty}^\infty e^{-2x^{2}}$ = $[-(1/4x) e^{-2x^{2}}$+$(1/4x) e^{-2x^{2}}]_{-\infty}^\infty$ =0

• Um, what? The antiderivative of $e^{-t^2}$ is not $\frac{-1}{2t} e^{-t^2}$. – Rahul Sep 10 '11 at 5:41
• @Angela, at the very least, it would be good of you to rewrite what you've posted in a (more) readable format. At present, it reminds me of this. – cardinal Sep 10 '11 at 5:51