Error Function Calculator (erf, erfc, Inverse)
Enter any real number x to compute erf(x) and erfc(x) in one click. Switch to inverse mode and enter a probability p between -1 and 1 to find the x that gives erf(x) = p. The scaled complementary error function erfcx(x) is also provided for large-argument work. A live curve marks your input on the error function plot, and the steps panel shows exactly how the result is obtained.
Formula
Worked example
For x = 1: erf(1) = (2/sqrt(pi)) * integral from 0 to 1 of exp(-t^2) dt = 0.842701. erfc(1) = 1 - 0.842701 = 0.157299. erfcx(1) = e^1 * 0.157299 = 2.71828 * 0.157299 = 0.427584. Inverse check: erf^-1(0.842701) = 1.000000.
What is the error function?
The error function erf(x) is a special mathematical function defined as erf(x) = (2 / sqrt(pi)) * integral from 0 to x of exp(-t^2) dt. It appears throughout probability theory, statistics, and physics because it describes the cumulative probability of the Gaussian (normal) distribution up to a scaled argument. The factor 2/sqrt(pi) normalises the function so that it approaches 1 as x approaches positive infinity. Because the integrand exp(-t^2) has no elementary antiderivative, erf is computed numerically using polynomial or continued-fraction approximations. It is an odd function: erf(-x) = -erf(x), and it is bounded between -1 and 1 for all real x.
Complementary and scaled complementary error functions
The complementary error function erfc(x) = 1 - erf(x) gives the tail probability, which is often more useful than erf(x) itself when x is large and erf(x) is very close to 1. For large x, direct computation of 1 - erf(x) loses significant digits because two nearly equal numbers are subtracted. The scaled complementary error function erfcx(x) = exp(x^2) * erfc(x) avoids this underflow problem: it stays of order 1/(x * sqrt(pi)) as x grows, and multiplying by exp(-x^2) at the end recovers erfc(x) in a numerically stable way. erfcx is widely used in signal-processing, heat-transfer, and quantum-chemistry codes where erfc(x) would underflow to zero.
Inverse error function and how to use it
The inverse error function erf^-1(p) finds the argument x such that erf(x) = p, for any p strictly between -1 and 1. Its complement erfc^-1(p) = erf^-1(1 - p) finds x such that erfc(x) = p, for p in (0, 2). These inverses appear whenever a probability is known and the underlying variable must be recovered: in normal-distribution quantile calculations (the probit function equals sqrt(2) * erf^-1(2p - 1)), in Value-at-Risk calculations in finance, and in designing communication systems to a specified bit-error rate. To use inverse mode on this calculator, select "Inverse erf / erfc" and enter the probability p.
Relationship to the normal distribution
If Z is a standard normal variable (mean 0, variance 1), then P(-a <= Z <= a) = erf(a / sqrt(2)). Equivalently, the standard-normal CDF Phi(x) = (1 + erf(x / sqrt(2))) / 2, and the quantile function (probit) is sqrt(2) * erf^-1(2p - 1). This connection means erf tables were historically used to look up normal probabilities before computers, and the two functions are interchangeable through a simple rescaling. For a normal variable with mean mu and standard deviation sigma, P(mu - k*sigma <= X <= mu + k*sigma) = erf(k / sqrt(2)): the familiar 68-95-99.7 rule corresponds to k = 1, 2, 3, giving erf(0.707) = 0.6827, erf(1.414) = 0.9545, and erf(2.121) = 0.9973.
Applications in science and engineering
The error function appears in solutions to the heat equation and diffusion problems wherever the initial condition is a step function: the concentration or temperature profile at time t is a shifted erfc. In communications engineering, the bit-error probability of binary signalling over an additive white Gaussian noise channel is (1/2) * erfc(sqrt(SNR)), so erfc and Q-function tables are identical up to a factor of 2. In semiconductor physics, dopant profiles after diffusion are described by erfc. In statistics, erf is used in computing tail probabilities for normal, chi-squared, and t-distributions. In finance, the Black-Scholes option pricing formula uses the normal CDF, which is an erf in disguise.
Error function table: erf(x) and erfc(x)
| x | erf(x) | erfc(x) |
|---|---|---|
| 0 | 0 | 1 |
| 0.1 | 0.112463 | 0.887537 |
| 0.2 | 0.222703 | 0.777297 |
| 0.3 | 0.328627 | 0.671373 |
| 0.4 | 0.428392 | 0.571608 |
| 0.5 | 0.5205 | 0.4795 |
| 0.6 | 0.603856 | 0.396144 |
| 0.7 | 0.677801 | 0.322199 |
| 0.8 | 0.742101 | 0.257899 |
| 0.9 | 0.796908 | 0.203092 |
| 1 | 0.842701 | 0.157299 |
| 1.1 | 0.880205 | 0.119795 |
| 1.2 | 0.910314 | 0.089686 |
| 1.3 | 0.934008 | 0.065992 |
| 1.4 | 0.952285 | 0.047715 |
| 1.5 | 0.966105 | 0.033895 |
| 1.6 | 0.976348 | 0.023652 |
| 1.7 | 0.98379 | 0.01621 |
| 1.8 | 0.989091 | 0.010909 |
| 1.9 | 0.99279 | 0.00721 |
| 2 | 0.995322 | 0.004678 |
| 2.5 | 0.999593 | 0.000407 |
| 3 | 0.999978 | 0.000022 |
Standard values for non-negative x. Because erf is odd, erf(-x) = -erf(x) and erfc(-x) = 2 - erfc(x).
Frequently asked questions
What is the difference between erf and erfc?
erf(x) is the error function, a cumulative integral from 0 to x of the Gaussian kernel. erfc(x) = 1 - erf(x) is the complementary error function, giving the remaining area. For positive x, erf grows from 0 to 1 and erfc falls from 1 to 0. When x is large, erfc is preferred in computation because it avoids subtracting two nearly equal numbers.
What is erfcx and why is it useful?
erfcx(x) = exp(x^2) * erfc(x) is the scaled complementary error function. For large x, erfc(x) can underflow to exactly 0 in double-precision arithmetic (around x = 27), but erfcx remains around 1 / (x * sqrt(pi)), a perfectly representable number. If you then need erfc(x) back, you compute exp(-x^2) * erfcx(x), which is more accurate than evaluating erfc directly.
How is the error function related to the normal distribution?
If X is a standard normal variable, then P(|X| <= x * sqrt(2)) = erf(x). Equivalently, the standard-normal CDF Phi(x) = (1 + erf(x / sqrt(2))) / 2. So erf and the normal CDF are the same function, just with a factor of sqrt(2) scaling the argument and the output rescaled from (-1, 1) to (0, 1).
What is the inverse error function used for?
The inverse error function erf^-1(p) finds x such that erf(x) = p. It is used to compute normal-distribution quantiles (the probit function is sqrt(2) * erf^-1(2p - 1)), to design communication systems to a target bit-error rate, to invert diffusion-profile measurements, and in Monte Carlo simulations that need to sample from a Gaussian by inverting the CDF.
Is erf(0) = 0 and erf(infinity) = 1?
Yes. The integral from 0 to 0 is zero, so erf(0) = 0. As x approaches positive infinity, the integral from 0 to x of exp(-t^2) dt converges to sqrt(pi)/2, and the factor 2/sqrt(pi) scales this to exactly 1. So erf is bounded between -1 and 1 for all real x, with erf(-infinity) = -1.
Can erf be computed with a simple formula?
There is no closed-form antiderivative for exp(-t^2), so erf cannot be expressed in elementary functions. In practice it is approximated to high precision using rational polynomials (such as the Abramowitz and Stegun 7.1.26 approximation used in this calculator, which has a maximum error below 1.5 x 10^-7), continued fractions, or Taylor series. For very small x, erf(x) is well approximated by (2/sqrt(pi)) * x.
Why does erf give a value between -1 and 1?
Because it is an integral of a non-negative function (exp(-t^2) >= 0), erf is monotonically increasing. Starting from 0 at x = 0, it rises to 1 as x grows (the full integral of exp(-t^2) from 0 to infinity is sqrt(pi)/2, and the 2/sqrt(pi) prefactor cancels it). For negative x, erf is odd, so erf(-x) = -erf(x), giving the range (-1, 1). The endpoints -1 and 1 are only reached at plus or minus infinity.