# Convolution of a gaussian and the derivative of the inverse error function

Problem Definition

I need to calculate the convolution between a Gaussian function $$g(x)$$ and $$d(x)$$, the derivative of the inverse error function,

$$d(x) * g(x) = \int_{-\infty}^{\infty} d(\tau) g(x-\tau) \text{d}\tau = \int_{-\infty}^{\infty} d(x-\tau) g(\tau) \text{d}\tau$$

with

$$g(x) = \frac{1}{\sqrt{2 \pi}} \text{e}^{-\frac{1}{2} x^2},$$

$$d(x) = \left\{ \begin{array}{ll} 0 & x < a \\ \frac{\text{d}}{\text{d}x} erf^{-1}(x) & -a\leq x\leq a \\ 0 & x > a \\ \end{array} \right.$$

with the constant $$a<1$$.

Since $$d(x)$$ is only non-zero on the interval $$x \in [-a, a]$$ I assume I can take these as limits for the convolution integral instead of $$[-\infty, \infty]$$ (please correct me here).

Attempted solution:

Since $$d(x)$$ is defined as the derivative of a function, I thought about using integration by parts:

$$\int_{-a}^{a} \frac{\text{d}}{\text{d}\tau} erf^{-1}(\tau) g(x-\tau) \text{d}\tau = \Big[ erf^{-1}(\tau) g(x-\tau) \Big]_{-a}^{a} - \int_{-a}^{a} erf^{-1}(\tau) \frac{\text{d}}{\text{d}\tau} g(x-\tau) \text{d}\tau$$

Then, using the convolution-derivative theorem (see below), we see that the last term is equal to the negative original term,

$$\frac{\text{d}}{\text{d}x} erf^{-1}(x) * g(x) = erf^{-1}(x) * \frac{\text{d}}{\text{d}x} g(x)$$

Moreover, $$erf^{-1}(-x) = - er^{-1}(x)$$ (property of an odd function).

Rearranging:

$$2 \frac{\text{d}}{\text{d}\tau} erf^{-1}(x) * g(x) = 2 erf^{-1}(a)\Big[g(x-a) + g(x+a) \Big],$$

so, (surprisingly!) the result is a sum of two Gaussian functions,

$$d(x)*g(x) = erf^{-1}(a)\Big[g(x-a) + g(x+a) \Big]$$

I believe this can not be correct, as the numerical convolution doesn't look like a sum of Gaussians at all (see attached plots). There has to be a mistake in my math! Can anyone please point it out to me? Also, if you have suggestions on how to attack the problem, let me know!

Convolution-derivative theorem:

For any two functions $$f_1(x)$$ and $$f_2(x)$$, with ' denoting the derivative $$\frac{\text{d}}{\text{d}x}$$:

$$( f_1(x) * f_2(x) )' = f_1(x) * f_2'(x) = f_1'(x) * f_2(x)$$

If it helps, I found that the derivative of the inverse funciton is defined as follows:

$$\frac{\text{d}}{\text{d}u} erf^{-1}(u) = \frac{1}{\frac{\text{d}}{\text{d}u} erf\Big(erf^{-1}(u)\Big)},$$

with

$$\frac{\text{d}}{\text{d}u} erf(u) = \frac{2}{\sqrt{\pi}} \text{e}^{-x^2}.$$

This would give

$$d(x) = \frac{\sqrt{\pi}}{2} \text{e}^{\Big(\text{erf}^{-1}(u) \Big)^2},$$

and the following integral for the convolution,

$$d(x) * g(x) = \frac{\sqrt{\pi}}{2} \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} \text{e}^{\Big(\text{erf}^{-1}(\tau) \Big)^2} \text{e}^{-\frac{1}{2} (x-\tau)^2} \text{d}\tau.$$

It looks difficult to attach directly, which is why I'm guessing playing with the derivatives might be the way to go.

I think the convolution-derivative theorem assumes that your functions vanish at the boundary, so in that sense where you are mistaken is in $$\int_{-a}^{a} \frac{\text{d}}{\text{d}\tau} erf^{-1}(\tau) g(x-\tau) \text{d}\tau = \Big[ erf^{-1}(\tau) g(x-\tau) \Big]_{-a}^{a} - \int_{-a}^{a} erf^{-1}(\tau) \frac{\text{d}}{\text{d}\tau} g(x-\tau) \text{d}\tau$$ which - after changing the $$\tau$$-derivative against the negative $$x$$-derivative - just becomes your convolution-derivative theorem when you neglect the boundary term. So I think you can not apply this theorem here in that form or you have to assume $$\pm \infty$$ as boundary in which case it vanishes. I think you have a sign error also, since you add these terms up to 2 times, but they actually cancel.
Also note that the integral as you wrote it above actually diverges for $$a=1$$, so you have to either keep track of the boundary term or use the derivative with respect to $$x$$ on the Gaussian.
In any case for the integration of the original problem I doubt you will find closed form. But you can get some approximation for $$a\rightarrow 1$$ by first substituting $$t={\rm erf}^{-1}(\tau)$$ and then integrating by parts \begin{align} &\quad \, \, \int_{-a}^{a} {\rm erf}^{-1}(\tau) \, \frac{{\rm e}^{-\frac{(x-\tau)^2}{2}}}{\sqrt{2\pi}} \, {\rm d}\tau \tag{1} \\ &= \int_{-{\rm erf}^{-1}(a)}^{{\rm erf}^{-1}(a)} \frac{{\rm e}^{-\frac{(x-{\rm erf}(t))^2}{2}}}{\sqrt{2\pi}} \, \frac{2t}{\sqrt{\pi}} \, {\rm e}^{-t^2} \, {\rm d}t \\ &= -\frac{{\rm e}^{-\frac{(x-{\rm erf}(t))^2}{2}}}{\sqrt{2\pi}} \, \frac{ {\rm e}^{-t^2}}{\sqrt{\pi}} \Bigg|_{-{\rm erf}^{-1}(a)}^{{\rm erf}^{-1}(a)} - \frac{2}{{\pi}} \frac{{\rm d}}{{\rm d}x} \int_{-{\rm erf}^{-1}(a)}^{{\rm erf}^{-1}(a)} \frac{{\rm e}^{-\frac{(x-{\rm erf}(t))^2}{2}}}{\sqrt{2\pi}} \, {\rm e}^{-2t^2} \, {\rm d}t \, . \end{align}
Approximating $${\rm erf}(t) \approx {\alpha t}$$ with $$\alpha=\frac{2}{\sqrt{\pi}}$$ the latter integral becomes \begin{align} &\quad \,\, \frac{2}{\pi} \int_{-{\rm erf}^{-1}(a)}^{{\rm erf}^{-1}(a)} \frac{{\rm e}^{-\frac{(x-{\rm erf}(t))^2}{2}}}{\sqrt{2\pi}} \, {\rm e}^{-2t^2} \, {\rm d}t \\ &\approx \frac{2}{\pi} \int_{-{\rm erf}^{-1}(a)}^{{\rm erf}^{-1}(a)} \frac{{\rm e}^{-\frac{\left(x-{\alpha t}\right)^2}{2}}}{\sqrt{2\pi}} \, {\rm e}^{-2t^2} \, {\rm d}t \\ &=\frac{{\rm e}^{-\frac{2 x^2}{4+\alpha^2}}}{\pi\sqrt{4+\alpha^2}} \left\{ {\rm erf}\left( \frac{x \alpha + T(4+\alpha^2)}{\sqrt{2(4+\alpha^2)}} \right) - {\rm erf}\left( \frac{x \alpha - T(4+\alpha^2)}{\sqrt{2(4+\alpha^2)}} \right) \right\} \end{align} where $$T={\rm erf}^{-1}(a)$$. For $$a=1$$ this yields $$\sim \frac{2}{\pi} \frac{{\rm e}^{-\frac{2 x^2}{4+\alpha^2}}}{\sqrt{4+\alpha^2}} \tag{2} \, .$$ The result fits qualitatively, but underestimates a little bit for $$\alpha=\frac{2}{\sqrt{\pi}}$$. In fact by choosing $$\alpha=\frac{1.685}{\sqrt{\pi}}$$ you get an almost perfect match. I doubt you get much closer with any other approximation. In the below figure you don't see the difference between $$-\frac{{\rm d}}{{\rm d}x} (2)$$ and the exact result of (1). For the derivative of the inverse error function as in your question you finally need to derive (1) with respect to $$x$$ another time as in the convolution-derivative theorem.