2.79 Convert a matrix to row echelon form and to reduced row echelon form

Problem: Given a matrix A, convert it to REF and RREF. Below shows how to

convert the matrix A to RREF. To convert to REF (TODO). One reason to convert Matrix \(A\) to its row echelon form, is to find the rank of \(A\). If matrix \(A\) is a \(4\times 4\), and when converted to its row echelon form we find that one of the rows is all zeros, then the rank of \(A\) will be 3 and not full rank.

Mathematica

Remove["Global`*"] 
(mat={{1, 1, -2,  1}, 
      {3, 2,  4, -4}, 
      {4, 3,  3, -4}})//MatrixForm
 

\[ \left ( {\begin {array}{cccc} 1 & 1 & -2 & 1 \\ 3 & 2 & 4 & -4 \\ 4 & 3 & 3 & -4 \\ \end {array}} \right ) \]

MatrixForm[RowReduce[mat]]
 

\[ \left ( {\begin {array}{cccc} 1 & 0 & 0 & 2 \\ 0 & 1 & 0 & -3 \\ 0 & 0 & 1 & -1 \\ \end {array}} \right ) \]

 

Matlab

clear all; 
A=[1 1 -2 1 
   3 2 4  -4 
   4 3 3  -4]; 
rref(A)
 

ans = 
     1     0     0     2 
     0     1     0    -3 
     0     0     1    -1
 

 

Maple

A:=Matrix([ [1,1,-2,1],[3,2,4,-4],[4,3,3,-4]]); 
LinearAlgebra:-ReducedRowEchelonForm(A);
 

\[ \left [ {\begin {array}{cccc} 1&0&0&2\\ \noalign {\medskip }0&1&0&-3 \\ \noalign {\medskip }0&0&1&-1\end {array}} \right ] \]