How are the Error Function and Standard Normal distribution function related?

If the Standard Normal PDF is $$f(x) = \frac{1}{\sqrt{2\pi}} e^{-x^2/2}$$

and the CDF is $$F(x) = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^x e^{-x^2/2}\mathrm{d}x\,,$$

how does this turn into an error function of $z$?

Answer

Because this comes up often in some systems (for instance, Mathematica insists on expressing the Normal CDF in terms of $\text{Erf}$), it’s good to have a thread like this that documents the relationship.


By definition, the Error Function is

$$\text{Erf}(x) = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2} \mathrm{d}t.$$

Writing $t^2 = z^2/2$ implies $t = z / \sqrt{2}$ (because $t$ is not negative), whence $\mathrm{d}t = \mathrm{d}z/\sqrt{2}$. The endpoints $t=0$ and $t=x$ become $z=0$ and $z=x\sqrt{2}$. To convert the resulting integral into something that looks like a cumulative distribution function (CDF), it must be expressed in terms of integrals that have lower limits of $-\infty$, thus:

$$\text{Erf}(x) = \frac{2}{\sqrt{2\pi}}\int_0^{x\sqrt{2}} e^{-z^2/2}\mathrm{d}z = 2\left(\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{x\sqrt{2}}e^{-z^2/2}\mathrm{d}z – \frac{1}{\sqrt{2\pi}}\int_{-\infty}^0 e^{-z^2/2}\mathrm{d}z\right).$$

Those integrals on the right hand size are both values of the CDF of the standard Normal distribution,

$$\Phi(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^x e^{-z^2/2} \mathrm{d}z.$$

Specifically,

$$\text{Erf}(x) = 2(\Phi(x\sqrt{2}) – \Phi(0)) = 2\left(\Phi(x\sqrt{2}) – \frac{1}{2}\right) = 2\Phi(x\sqrt{2}) – 1.$$

This shows how to express the Error Function in terms of the Normal CDF. Algebraic manipulation of that easily gives the Normal CDF in terms of the Error Function:

$$\Phi(x) = \frac{1 + \text{Erf}(x/\sqrt{2})}{2}.$$


This relationship (for real numbers, anyway) is exhibited in plots of the two functions. The graphs are identical curves. The coordinates of the Error Function on the left are converted to the coordinates of $\Phi$ on the right by multiplying the $x$ coordinates by $\sqrt{2}$, adding $1$ to the $y$ coordinates, and then dividing the $y$ coordinates by $2$, reflecting the relationship

$$\Phi(x\sqrt{2}) = \frac{\text{Erf}(x) + 1}{2}$$

in which the notation explicitly shows these three operations of multiplication, addition, and division.

Figure

Attribution
Source : Link , Question Author : TH4454 , Answer Author : whuber

Leave a Comment