MATLAB rref
Reduced Row Echelon Form (rref) takes the Gauss-Jordan elimination method one step further by operating scaling EROs on all rows so that the aii coefficients on the diagonal all become ones.
Reduced Row Echelon Form take this one step further to result in all 1’s rather than the a’, so that the column of b’s is the solution:
MATLAB has built-in function to do this, known as rref. For example, for the preceding examples:
The solutions are found from the last column, so x1 = -2, x2 = 1, and x3 = 3. To get this in the column vector in MATLAB:
Finding Matrix Inverse by reducing an Augmented Matrix
For the system of equations larger than a 2×2 system, one method of finding inverse of a matrix A mathematically contains augmenting the matrix with an identity matrix of a similar size and then reducing it.
The algorithm is:
- Augment the matrix with I: [A I]
- Reduce it to the method [I X]; X will be A-1.
For example, in MATLAB we can starts with a matrix, augmented it with an identity matrix, and then use the rref functions to reduce it.