VOOZH about

URL: https://www.geeksforgeeks.org/matlab/reduced-row-echelon-form-rref-matrix-in-matlab/

⇱ Reduced Row Echelon Form (rref) Matrix in MATLAB - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Reduced Row Echelon Form (rref) Matrix in MATLAB

Last Updated : 23 Jul, 2025

Reduced Row Echelon Form of a matrix is used to find the rank of a matrix and further allows to solve a system of linear equations. A matrix is in Row Echelon form if

  • All rows consisting of only zeroes are at the bottom.
  • The first nonzero element of a nonzero row is always strictly to the right of the first nonzero element of the row above it.

Example :

A matrix can have several row echelon forms. A matrix is in Reduced Row Echelon Form if

  • It is in row echelon form.
  • The first nonzero element in each nonzero row is a 1.
  • Each column containing a nonzero as 1 has zeros in all its other entries.

Example:

Where a1,a2,b1,b2,b3 are nonzero elements.

A matrix has a unique Reduced row echelon form. Matlab allows users to find Reduced Row Echelon Form using rref() method. Different syntax of rref() are:

  • R = rref(A)
  • [R,p] = rref(A)

Let us discuss the above syntaxes in detail:

rref(A)

It returns the Reduced Row Echelon Form of the matrix A using the Gauss-Jordan method.

Output :

👁 Image

rref(A)

  • It returns Reduced Row Echelon Form R and a vector of pivotsp
  • p is a vector of row numbers that has a nonzero element in its Reduced Row Echelon Form.
  • The rank of matrix A is length(p).
  • R(1:length(p),1:length(p)) (First length(p) rows and length(p) columns in R) is an identity matrix.

Output :

👁 Image

Finding solutions to a system of linear equations using Reduced Row Echelon Form:

The System of linear equations is 

Coefficient matrix A is 

Constant matrix B is 

Then Augmented matrix [AB] is 

Output :

👁 Image

Then the reduced equations are 

It has infinite solutions, one can be .

Comment