Main Content


Inverse complementary error function



erfcinv(x) returns the value of the Inverse Complementary Error Function for each element of x. For inputs outside the interval [0 2], erfcinv returns NaN. Use the erfcinv function to replace expressions containing erfinv(1-x) for greater accuracy when x is close to 1.


collapse all

ans = 0.7329

Find the inverse complementary error function of the elements of a vector.

V = [-10 0 0.5 1.3 2 Inf];
ans = 1×6

       NaN       Inf    0.4769   -0.2725      -Inf       NaN

Find the inverse complementary error function of the elements of a matrix.

M = [0.1 1.2; 1 0.9];
ans = 2×2

    1.1631   -0.1791
         0    0.0889

You can use the inverse complementary error function erfcinv in place of erfinv(1-x) to avoid round-off errors when x is close to 0.

Show how to avoid round-off by calculating erfinv(1-x) using erfcinv(x) for x = 1e-100. The original calculation returns Inf while erfcinv(x) returns the correct result.

x = 1e-100;
ans = Inf
ans = 15.0656

Input Arguments

collapse all

Input, specified as a real number, or a vector, matrix, or multidimensional array of real numbers. x cannot be sparse.

Data Types: single | double

More About

collapse all

Inverse Complementary Error Function

The inverse complementary error function erfcinv(x) is defined as erfcinv(erfc(x))=x.


  • You can also find the inverse standard normal probability distribution using the function norminv (Statistics and Machine Learning Toolbox). The relationship between the inverse complementary error function erfcinv and norminv is


  • For expressions of the form erfcinv(1-x), use the inverse error function erfinv instead. This substitution maintains accuracy. When x is close to 1, then 1 - x is a small number and might be rounded down to 0. Instead, replace erfcinv(1-x) with erfinv(x).

Extended Capabilities

Version History

Introduced before R2006a

See Also

| | |