This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Reduced row echelon form (Gauss-Jordan elimination)


R = rref(A)
[R,jb] = rref(A)
[R,jb] = rref(A,tol)


R = rref(A) produces the reduced row echelon form of A using Gauss Jordan elimination with partial pivoting. A default tolerance of (max(size(A))*eps *norm(A,inf)) tests for negligible column elements.

[R,jb] = rref(A) also returns a vector jb such that:

  • r = length(jb) is this algorithm's idea of the rank of A.

  • x(jb) are the pivot variables in a linear system Ax = b.

  • A(:,jb) is a basis for the range of A.

  • R(1:r,jb) is the r-by-r identity matrix.

[R,jb] = rref(A,tol) uses the given tolerance in the rank tests.

Roundoff errors may cause this algorithm to compute a different value for the rank than rank, orth and null. Additionally, use mldivide to solve linear systems when high precision is required.


Use rref on a rank-deficient magic square:

A = magic(4), R = rref(A)

A =
   16    2    3   13
    5   11   10    8
    9    7    6   12
    4   14   15    1

R =
    1    0    0    1
    0    1    0    3
    0    0    1   -3
    0    0    0    0

See Also

| |

Introduced before R2006a

Was this topic helpful?