Step 2 - Divide the cursor row by the cursor entry (in step 1 we made sure that the cursor entry was NONZERO, so
we know we won't cause an error dividing by it).
Division works just like scalar multiplication:
A(cursor row, :) = A(cursor row, :)/cursor entry
Step 3 - Eliminate all other entries in the cursor column, by subtracting suitable multiples of the cursor row
from all other rows.
Since all the rows have the same dimensions (all are single rows with the same amount of columns), we can use our techniques for
addition (and subtraction) of matrices. We want to subtract from our non-cursor rows, the cursor row multiplied
by this row's entry in the cursor column:
A(non-cursor row, :) = A(non-cursor row, :) - A(cursor row, :)*(entry in cursor column)
Step 4 - Move the cursor down one row and over one column. If the new cursor entry and all entries below are
zero, move the cursor to the next column (remaining in the same row). Repeat the last step if necessary.
Again, choosing the cursor has nothing to do with MATLAB, it is simply there for our own usage to keep straight which rows/columns/entries
we are working with.
Return to Step 1 - The process ends when we run out of rows or columns. Then, the matrix is in Reduced Row-Echelon Form (rref).