# rref_test

rref_test, a MATLAB code which calls rref(), which evaluates the reduced row echelon form (RREF) of a matrix, which can be singular or rectangular.

While the RREF is often used in introductory linear algebra courses, it is very susceptible to roundoff error, and hence the results of many of the tasks which it is used to illustrate can only be relied on when the matrix is small, contains only integer entries, and care is taken to avoid any division operation that is not exact.

The RREF can be regarded as a form of Gauss-Jordan elimination, applied to a general MxN matrix.

A matrix is in reduced row echelon form if:

• The first nonzero entry in each row is 1.
• The leading 1 in a given row occurs in a column to the right of the leading 1 in the previous row.
• Rows which are entirely zero must occur last.
• Each column containing a leading 1 has no other nonzero entries.

MATLAB includes a build in function

```        R = rref ( A );
```
which returns in R the RREF of matrix A. It also uses a tolerance to try to mitigate the susceptibility of the algorithm to roundoff.

The RREF can be used to determine:

• the rank of a square matrix;
• the column rank of a rectangular matrix;
• the independent columns of a rectangular matrix;
• if a linear system is consistent;
• the inverse of a square invertible matrix.

### Languages:

rref_test is available in a MATLAB version.

### Related Data and Programs:

llsq, a MATLAB code which solves the simple linear least squares (LLS) problem of finding the formula of a straight line y=a*x+b which minimizes the root-mean-square (RMS) error to a set of N data points.

polyominoes, a MATLAB code which defines, solves, and plots a variety of polyomino tiling problems, which are solved by a direct algebraic approach involving the reduced row echelon form (RREF) of a specific matrix, instead of the more typical brute-force or backtracking methods.

qr_solve, a MATLAB code which computes the linear least squares (LLS) solution of a rectangular linear system A*x=b.

test_lls, a MATLAB code which implements linear least squares (LLS) test problems which seek a vector x which minimizes the error in the rectangular linear system A*x=b.

### Reference:

1. Charles Cullen,
An Introduction to Numerical Linear Algebra,
PWS Publishing Company, 1994,
ISBN: 978-0534936903,
LC: QA185.D37.C85.

### Source Code:

Last revised on 07 December 2018.