Skip to content

rref

Reduced Row Echelon Form

rref(A)

  • A is a matrix, i.e., ndims(A) == 2.
  • It returns the reduced row echelon form of a matrix A.
  • It uses the default tolerance to determine if an element is negligibly small:
max(size(A))*eps(norm(A, inf)).
  • An element is considered zero if it's absolute value is less than this tolerance.

rref(A, tol)

  • A is as specified in the description of rref(A) above.
  • It returns the reduced row echelon form of a matrix A using a user-specified tolerance tol.
  • tol should be a non-negative, real scalar.

Example 1: A has different rrefs with different tolerances.

A =[16.00 2.000 3.000 13.00
5.000 11.00 10.00 8.000
9.000 7.000 6.000 12.00
4.000 14.00 15.00 1.000]

% U is the row echelon form.
[L,U]=lu(A);
U, U(4,4)

% U(4,4) ~1e-15 is very small, which
% is considered zero when the
% default tolerance is used.
% This results in rank 3.
R=rref(A)

% However, when a smaller tolerance
% is used, it is considered non-zero.
% This results in rank 4.
R=rref(A,1e-17)
A =
16.00   2.000   3.000   13.00
5.000   11.00   10.00   8.000
9.000   7.000   6.000   12.00
4.000   14.00   15.00   1.000

U =
16.00   2.000   3.000   13.00
0.000   13.50   14.25  -2.250
0.000   0.000  -1.889   5.667
0.000   0.000   0.000   0.000

ans = 1e-15 ×
3.553

R =
1.000   0.000   0.000   1.000
0.000   1.000   0.000   3.000
0.000   0.000   1.000  -3.000
0.000   0.000   0.000   0.000

R =
1.000   0.000   0.000   0.000
0.000   1.000   0.000   0.000
0.000   0.000   1.000   0.000
0.000   0.000   0.000   1.000

[R, b] = rref(A)

  • A is the same as specified above for rref(A).
  • It returns the reduced row echelon form R and a vector b that contains indexes of A's basis in the column space.
  • It uses the default tolerance to determine if an element is negligibly small:
max(size(A))*eps(norm(A, inf)).
  • An element is considered zero if it's absolute value is less than this tolerance.

Example 2: The vector b suggests that the first 3 columns of A form a basis of the column space.

A=[1 -5 2 -2;
-1 4 0 3;
1 -1 2 2]
[R,b]=rref(A)
A =
 1.000  -5.000   2.000  -2.000
-1.000   4.000   0.000   3.000
 1.000  -1.000   2.000   2.000

R =
 1.000   0.000   0.000   1.000
 0.000   1.000   0.000   1.000
 0.000   0.000   1.000   1.000

b =
 1.000   2.000   3.000

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

  • A is the same as specified above for rref(A).
  • It returns the reduced row echelon form R and a vector b that contains indexes of A's basis in the column space.
  • It uses the user-defined tolerance to determine if an element is negligibly small.