y=erf⁡xy = \operatorname{erf} x

The Error Function y=erf⁡xy = \operatorname{erf} x

The error function erf⁡x\operatorname{erf} x is a special function defined by integrating the Gaussian1.

erf⁡x=2π∫0xe−t2 dt\operatorname{erf} x = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}\,dt

The factor 2π\dfrac{2}{\sqrt{\pi}} in front is a normalizing constant, chosen so that the value approaches exactly 11 as x→∞x \to \infty. It is fixed by the Gaussian integral ∫0∞e−t2 dt=π2\int_0^{\infty} e^{-t^2}\,dt = \dfrac{\sqrt{\pi}}{2}.

Domain and range

  • The domain is all real numbers
  • The range is the open interval (−1,1)(-1, 1)
  • It increases monotonically
  • It is an odd function

The integrand e−t2e^{-t^2} is always positive, so the function increases monotonically.

Symmetry

The integrand is even, so the integral is odd. That is, erf⁡(−x)=−erf⁡(x)\operatorname{erf}(-x) = -\operatorname{erf}(x), and the graph has point symmetry about the origin.

Monotonicity and slope

By the fundamental theorem of calculus the derivative is the Gaussian itself.

ddxerf⁡x=2π e−x2\frac{d}{dx}\operatorname{erf} x = \frac{2}{\sqrt{\pi}}\,e^{-x^2}

It is always positive, so the function increases over the whole line. The slope is steepest at the origin, where it is 2π≈1.128\dfrac{2}{\sqrt{\pi}} \approx 1.128.

How fast it converges

xxerf⁡x\operatorname{erf} x
0.50.5≈0.5205\approx 0.5205
11≈0.8427\approx 0.8427
22≈0.9953\approx 0.9953
33≈0.99998\approx 0.99998

It has two horizontal asymptotes, y=±1y = \pm 1. The tails decay like e−x2e^{-x^2}, so the convergence is very fast: by x=3x = 3 the gap to 11 is already below 10−510^{-5}.

Inflection point

The second derivative is −4xπ e−x2-\dfrac{4x}{\sqrt{\pi}}\,e^{-x^2}, whose sign changes at x=0x = 0, so the origin is the only inflection point. The curve turns there from concave up to concave down.

Relations to other functions

It is tied to the distribution function Φ(x)\Phi(x) of the standard normal by the following.

Φ(x)=12(1+erf⁡x2)\Phi(x) = \frac{1}{2}\left(1 + \operatorname{erf}\frac{x}{\sqrt{2}}\right)

The 2\sqrt{2} appears because of a difference in the definitions: erf⁡\operatorname{erf} uses e−t2e^{-t^2} while the normal distribution uses e−t2/2e^{-t^2/2}. The quantity 1−erf⁡x1 - \operatorname{erf} x is called the complementary error function erfc⁡x\operatorname{erfc} x, used when the probability in a tail has to be handled accurately.

Series expansion

erf⁡x=2π(x−x33+x510−⋯ )\operatorname{erf} x = \frac{2}{\sqrt{\pi}}\left(x - \frac{x^3}{3} + \frac{x^5}{10} - \cdots\right)

It converges for every real number, but for large xx the terms swell badly along the way, so practical computation uses an asymptotic expansion or a rational approximation2.

Applications and history

As the name suggests, it grew out of the theory of observational error. Having no expression in elementary functions, it is treated as a special function in its own right.

  • Probability calculations with the normal distribution
  • Solutions of the heat and diffusion equations
  • The evaluation of the error rate of a communication channel
  1. Error function, Wikipedia
  2. Error Functions, Dawson's and Fresnel Integrals, NIST Digital Library of Mathematical Functions