# Solving equation involving error function and normal distribution

Let $\phi(x)$ be a normal distribution, that is $\phi=\frac{1}{\sigma}\phi(x|\mu,\sigma^2)$ and $\Phi(x)$ be the CDF of $\phi$, i.e., $\Phi(x|\mu,\sigma^2)=\frac{1}{2}[1+erf(\frac{x-\mu}{\sqrt{2}\sigma})]$, where erf is the error function). Given some fixed constant $a$, how can I get a good approximation (ideally solve) for x that satisfies the equation
$x=[\phi(x)/\Phi(x)]-a$?

• Given $\mu,\sigma,a$ ? – Claude Leibovici Mar 16 '17 at 12:57
• Yes given $\mu,\sigma,a$. – Doron Mar 18 '17 at 6:51

## 1 Answer

So, you want to solve for $x$ the equation $$x=\frac{\sqrt{\frac{2}{\pi }} e^{-\frac{(x-\mu )^2}{2 \sigma ^2}}}{\sigma \left(1+\text{erf}\left(\frac{x-\mu }{\sigma }\right)\right)}-a$$ For simplicity, let $x=\mu +\sigma y$ which makes $$\sigma (a+\mu) +\sigma^2 y=\sqrt{\frac{2}{\pi }}\frac{ e^{-\frac{y^2}{2}}}{1+\text{erf}(y)}$$ which means that you search for the intersection of a straight line (given by the lhs) with a nice monotonic curve (given by the rhs).

For sure, there is no analytical solution and numerical method should be required (Newton being probably the simplest to use).

We can approximate the rhs using Pade approximants; for example $$\frac{ e^{-\frac{y^2}{2}}}{1+\text{erf}(y)}\approx\frac{1+\frac{4 \sqrt{\pi } }{3 (\pi -8)}y+\frac{(8-3 \pi ) }{6 (\pi -8)}y^2}{1+\frac{2 (5 \pi -24) }{3 (\pi -8) \sqrt{\pi }}y}$$ would let you with a quadratic equation in $y$. But, gain, this is an approximation.

• That was really helpful! – Doron Mar 19 '17 at 12:34