How to Find Reduced Row Echelon Form MATLAB
This tutorial will discuss finding the reduced row Echelon form of a matrix using the rref()
function in Matlab.
Find the Reduced Row Echelon Form of a Matrix Using the rref()
Function in MATLAB
The reduced row Echelon form is used to solve the system of linear equations using Matlab. Reduced row Echelon form means that the gauss elimination has operated on the rows. You can use the Matlab built-in function rref()
to find a matrix’s reduced row Echelon form. For example, Let’s create a matrix using the magic()
function and find its reduced row Echelon form using the function in Matlab. See the code below.
MyMatrix = magic(6)
RREF = rref(MyMatrix)
Output:
MyMatrix =
35 1 6 26 19 24
3 32 7 21 23 25
31 9 2 22 27 20
8 28 33 17 10 15
30 5 34 12 14 16
4 36 29 13 18 11
RREF =
1 0 0 0 0 -2
0 1 0 0 0 -2
0 0 1 0 0 1
0 0 0 1 0 2
0 0 0 0 1 2
0 0 0 0 0 0
We can also add the pivot tolerance, which will be used to find the reduced row Echelon form. We can also find the non-zero pivots and the reduced row Echelon form if we add another argument as an output. For example, let’s find the non-zero pivots of the above matrix using the function rref()
in Matlab. See the code below.
MyMatrix = magic(6)
[RREF,P] = rref(MyMatrix)
Output:
MyMatrix =
35 1 6 26 19 24
3 32 7 21 23 25
31 9 2 22 27 20
8 28 33 17 10 15
30 5 34 12 14 16
4 36 29 13 18 11
RREF =
1 0 0 0 0 -2
0 1 0 0 0 -2
0 0 1 0 0 1
0 0 0 1 0 2
0 0 0 0 1 2
0 0 0 0 0 0
P =
1 2 3 4 5
As you can see in the above output, the rref()
function has also generated the non-zero pivots.