# Equation involving an error and Gaussian functions

I am looking to solve the following expression for $x$:

$$\int_{0}^x e^{-t^2}dt=2xe^{-x^2}.$$

Multiplication of both sides by $2/\sqrt{\pi}$ yields error function on the LHS, while the RHS contains Gaussian function multiplied by $x$.

I have no idea what to do with this. I would love a closed-form solution or $x$ in terms of functions that are easily computable by MATLAB (like error or Bessel functions), but would be satisfied with a numerical method that is more efficient than searching for a zero of $2xe^{-x^2}-\int_{0}^x e^{-t^2}dt$ (using, say, fzero in MATLAB Optimization Toolbox). Any help?

Looking at the plots, the solution seems to be $x=1$.

If I differentiate both sides, I obtain $e^{-x^2}=2e^{-x^2}+2xe^{-x^2}$, which yields $x=1$. However, is that correct approach? I might be missing something very simple. Can anyone elucidate?

• I'm not sure differentiation is the correct approach here. Take for example $x^2 = 4$. We obviously know the solutions are $\pm2$. If we differentiate we get $2x=0$, with $x=0$ as the only solution. Differentiating changes solutions – Brevan Ellefsen Sep 30 '15 at 23:04
• I can tell you that your three solutions are $x=0$ and $x= ±0.989939082841905...$ – Brevan Ellefsen Sep 30 '15 at 23:05
• You are absolutely correct, the resolution on my graph wasn't high enough. The positive solution is clearly not $x=1$, and, yes, differentiating both sides makes no sense... – M.B.M. Sep 30 '15 at 23:10
• So what you want is to solve $\sqrt{\pi} erf(x) = 4 e^{-x^2} x$. Mathematica choked and died when I tried to solve this, telling me it lacks the methods necessary to solve it – Brevan Ellefsen Sep 30 '15 at 23:16
• Since there is a symmetry in the function, we can focus on $x$ greater than or equal to $0$, which yields $$\frac{e^{x^2}erf(x)}{4x} = \frac{1}{\pi}$$ $$\sum_{n=0}^{\infty} \frac{x^{2n}}{\Gamma(n+\frac{3}{2})} = \frac{4}{\pi}$$ I still can't figure out how to solve this though... I am starting to doubt the existence of an analytic solution – Brevan Ellefsen Sep 30 '15 at 23:37

If you can rapidly compute the special function $\mathrm{Erf}(x)$, then you can rapidly compute the zeros of this function by using Newton's method. If you're trying to find the first-order zeros of a differentiable function $F(x)$, recall that the iteration is

$$x_1 = x_0 - F(x_0) / F'(x_0)$$

In our case, $F(x) = \tfrac{1}{2} \sqrt{\pi} \mathrm{Erf}(x) - 2x e^{-x^2}$ (e.g. with Matlab), and its derivative is simply $F'(x) = -e^{-x^2} + 4x^2 e^{-x^2}$. Given an initial guess $x_0$, we can plug this into Matlab as

x = x - (sqrt(pi)/2 * erf(x) - 2 * x * exp(-x^2))/(-exp(-x^2) + 4*x^2 * exp(-x^2));


Repeatedly enter this line until convergence. Depending on whether $x_0 < 0.5$ or $x_0 > 0.5$ (not that you cannot use $x_0 = 0.5$), this converges to $0$ and $0.9899...$, and furthermore, it does so in only a few iterations.

• I have already given the OP the numerical estimate in my comment above. What the OP really needs is an analytic expression. If you need it solved to arbitrary precision just use WA, here's the link to the numerical solution wolframalpha.com/input/… – Brevan Ellefsen Sep 30 '15 at 23:18
• He also asked for a numerical method. Not to mention, this works for a variety of problems, whereas just providing the decimal value is not a generalizable solution. – Christopher A. Wong Sep 30 '15 at 23:20

Since there is a symmetry in the function, we can focus on $x$ greater than or equal to $0$, which yields $$e^{x^2}\text{erf}(x)\,x^{-1} = \frac{16}{\pi}$$ $$\sum_{n=0}^{\infty} \frac{x^{2n}}{\Gamma(n+\frac{3}{2})} = \frac{2}{\pi}$$ $$\sum_{n=1}^{\infty}\frac{(2x^2)^n}{(2n+1)!!}= \frac{2+\sqrt{\pi}}{\sqrt{\pi}}$$ These haven't led me anywhere though

This is not an answer but it is too long for a comment.

As you noticed, the solution is close to $x=1$. So, if you consider the function $$f(x)=\frac{1}{2} \sqrt{\pi } \,\text{erf}(x)-2\, xe^{-x^2}$$ and build the simplest $[1,1]$ Pade approximant at $x=1$, you will get $$f(x)\approx \frac{\frac{\left(22-e \sqrt{\pi } \text{erf}(1)\right) (x-1)}{6 e}+\frac{e \sqrt{\pi } \text{erf}(1)-4}{2 e}}{\frac{1-x}{3}+1}=\frac{1}{2} \sqrt{\pi } \text{erf}(1)+\frac{17-11 x}{e (x-4)}$$ the root of which being $$x=\frac{2 \left(2 e \sqrt{\pi }\, \text{erf}(1)-17\right)}{e \sqrt{\pi }\, \text{erf}(1)-22}\approx 0.98994022$$ Using the $[1,2]$ Pade approximant would give $$x=\frac{2 \left(7 e \sqrt{\pi }\,\text{erf}(1)+e^2 \pi \,\text{erf}(1)^2-98\right)}{3 \left(-4 e \sqrt{\pi } \,\text{erf}(1)+e^2 \pi \, \text{erf}(1)^2-36\right)}\approx 0.98993909$$