Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 17:17:22 rref_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 rref() computes the reduced row echelon form (RREF) of a matrix. The RREF is susceptible to roundoff error. With that in mind, it can be used to determine: * the rank of a square matrix; * the solution of a nonsingular square linear system; * the inverse of a nonsingular square matrix. * the determinant of a square matrix. * the column rank of a rectangular matrix; * the independent columns of a rectangular matrix * if a linear system is consistent; Test 1, just get the RREF. Matrix A: 1 3 0 2 6 3 1 -2 -6 0 -2 -8 3 1 3 9 0 0 6 6 2 -1 -3 0 1 0 9 3 A has rank 3 RREF of A: 1.0000 3.0000 0 0 2.0000 0 0 0 0 0 1.0000 2.0000 0 0 0 0 0 0 0 1.0000 0.3333 0 0 0 0 0 0 0 Test 2, look for inconsistency. Matrix A: 1 -2 3 -1 3 -6 9 -3 0 0 0 0 2 -2 0 1 6 -8 6 0 3 3 6 9 1 1 2 3 A has rank 3 RHS b1: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 [A;b1] has rank 4 Linear system A*x=b1 is INCONSISTENT. RHS b2: 1: 4 2: 12 3: 0 4: 2 5: 12 6: 9 7: 3 [A;b2] has rank 3 Linear system A*x2=b2 is CONSISTENT. Solution of A*x2=b2: 1: 1 2: 0 3: 1 4: 0 Compare b2 and A*x2: 1: 4 4 2: 12 12 3: 0 0 4: 2 2 5: 12 12 6: 9 9 7: 3 3 Test 3, inverse. Matrix A: 5 7 6 5 7 10 8 7 6 8 10 9 5 7 9 10 Estimated inverse of A: 68 -41 -17 10 -41 25 10 -6 -17 10 5 -3 10 -6 -3 2 Product A_inv * A: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Test 4, determinant. Matrix A: 5 7 6 5 7 10 8 7 6 8 10 9 5 7 9 10 Estimated determinant of A = 1: MATLAB det(A) = 1 Test 5, independent columns. Matrix A: 1 1 2 3 2 3 4 9 3 0 6 0 4 2 8 0 5 6 10 6 6 3 12 6 7 1 14 2 Number of independent columns is 3 Independent columns of A: 1 1 3 2 3 9 3 0 0 4 2 0 5 6 6 6 3 6 7 1 2 rref_test(): Normal end of execution. 13-May-2025 17:17:23