Write a Matrix in Reduced Row Echelon Form

We present the definition of a matrix in row echelon form and a matrix in reduced row echelon form. We then solve examples on how to write a given matrix in row echelon form and then in reduced row echelon form using the three row operations . More questions with detailed solutions are also included.


Matrix in Row Echelon Form (REF)

A matrix in row echelon form follows the following rules:

  1. If a row does not contain only zeros, the first non zero number, called the pivot, in it is a 1 also called the leading 1. (Note that some authors do not require that this non zero number is a 1, check with your instructor!).
  2. For two successive rows with leading 1's, the 1 in the lower row is to the right of the 1 in the upper row.
  3. Any rows with zeros only are located at the bottom of the matrix.


Example 1
For each matrix, use the rules above to explain whether it is row echelon form or not.
Matrices in Row Echelon Form

Solution to Example 1
a) The matrix in part a) is not in row echelon form because rule 2 is violated: the leading 1 in row 3 is to the left of the leading 1 in row 2; it should be to the right.
b) The matrix in part b) is not in row row echelon form because rule 3 is violated: row 2 has zeros only and is not at the bottom.
c) The matrix in part c) is in row echelon form.
d) The matrix in part d) is not in row echelon form because rules 2 and 3 are violated. The top row is all zeros and it should at the bottom, row 3 has a leading 1 that is to the left of the leading 1 in row 2. It should be to the right.
e) The matrix in part e) is in row echelon form.



Matrix in Reduced Row Echelon Form (RREF)

A matrix is in reduced row echelon form if it is in row echelon form and with zeros above and below the leading 1's.

Example 2
Which of the following matrices is in row echelon form and which are in reduced row echelon form?
Matrices in Reduced Row Echelon Form

Solution to Example 2
Row echelon form:     a) b) d)   because they obey the rules of row echelon form
Reduced row echelon form:     b) d)   because they obey the rules of row echelon form and they have zeros below and above leading one's in each row.
Note that matrix in a) is in row echelon form but not reduced because above the leading 1 in row 2 there is a 1.


Row Operations to Write a Matrix in Row Echelon Form

We now use the three row operations listed below to write a given matrix in row echelon form.

  1. Interchange two rows
  2. Add a multiple of one row to another
  3. Multiply a row by a non zero constant


Example 3
Use any of the three row operations above to write the matrices in parts a) b) and d) of example 1 in row echelon form.
\( \)\( \)\( \)\( \) Solution to Example 3
a) Interchange row 2 and 3 and rewrite the matrix as
  \(\begin{bmatrix} 1 & 1 & - 1 & -3\\ 0 & 1 & - 6 & - 12 \\ 0 & 0 & 1 & 2 \end{bmatrix} \)

b) Interchange row 2 and 3 and rewrite the matrix as
  \(\begin{bmatrix} 1 & -1 & 2 & 0\\ 0 & 0 & 1 & -9 \\ 0 & 0 & 0 & 0 \end{bmatrix} \)

d) Interchange row 1 and row 3 and rewrite the matrix as
  \(\begin{bmatrix} 1 & 6 & - 1 & -1 \\ 0 & 1 & -4 & 0\\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \)



Example 4
Use any of the three row operations above, or any combinations, to write the matrix \(\begin{bmatrix} 3 & 0 & -3 & 6 \\ 2 & 0 & -4 & 2\\ 0 & 1 & 1 & 3\\ 1 & 1 & -2 & 1 \end{bmatrix} \) in reduced row echelon form.

Solution to Example 4
Given \(\begin{bmatrix} 3 & 0 & -3 & 6 \\ 2 & 0 & -4 & 2\\ 0 & 1 & 1 & 3\\ 1 & 1 & -2 & 1 \end{bmatrix} \)

There are two parts in the process of rewriting a matrix in reduced row echelon form.

Part 1: We first rewrite the given matrix in row echelon form

We proceed per column starting from the leftmost one.

STEP 1: Find a leading 1, called the pivot, in column 1 if any and zeros below it
We need a row with a non zero in column (1) and place at the top.
There are many choices here: rows (1), (2) and (4) may be used. The simplest way here is to multiply all terms of row (1) by \( \dfrac{1}{3} \) and simplify
\( \begin{matrix} \color{red}{\frac{1}{3} R_1} \\ \\ \\ \\ \end{matrix} \) \( \begin{bmatrix} 3 & 0 & -3 & 6 \\ 2 & 0 & -4 & 2\\ 0 & 1 & 1 & 3\\ 1 & 1 & -2 & 1 \end{bmatrix} \) = \( \begin{bmatrix} 1 & 0 & -1 & 2 \\ 2 & 0 & -4 & 2\\ 0 & 1 & 1 & 3\\ 1 & 1 & -2 & 1 \end{bmatrix} \)

We now need 0's below the leading 1 in row (1).
Row (2) has a 2 in column (1) and one way to make it equal to zero is to add it to -2. One way is to add -2 times row (1) to row (2).
Also, row (4) has a one in column (1) and one way to make it equal to zero is to add -1 to it. One way is to add -1 times row (1) to row (4)
\( \begin{matrix} \\ \color{red}{R_2 - 2 R_1}\\ \\ \color{red}{R_3 - R_1}\\ \end{matrix} \) \( \begin{bmatrix} 1 & 0 & -1 & 2 \\ \color{red}{2 - 2} & \color{red}{0 - 0} & \color{red}{-4 + 2} & \color{red}{2 - 4}\\ 0 & 1 & 1 & 3\\ \color{red}{1 - 1} & \color{red}{1 - 0} & \color{red} {-2 - (-1)} & \color{red} {1 - 2} \end{bmatrix} \) = \( \begin{bmatrix} \color{blue}1 & 0 & -1 & 2 \\ \color{magenta}0 & 0 & - 2 & - 2\\ \color{magenta}0 & 1 & 1 & 3\\ \color{magenta}0 & 1 & -1 & -1 \end{bmatrix} \)

STEP 2: Find a leading 1, called the pivot, in column 2 if any and zeros below it
We now need a row among rows (2), (3) and (4) with a non zero in column (2); two choices rows (3) or (4). Interchange rows (2) and (4)
\( \begin{matrix} \\ \color{red}{R_4}\\ \\ \color{red}{R_2}\\ \end{matrix} \) \( \begin{bmatrix} 1 & 0 & -1 & 2 \\ 0 & 1 & -1 & -1\\ 0 & 1 & 1 & 3\\ 0 & 0 & - 2 & - 2 \end{bmatrix} \)

Row (2) has a 1, which is the pivot, in column (2) and therefore row (3) must have a zero in column (2). Add -1 times row (2) to row (3) and simplify.
\( \begin{matrix} \\ \\ \color{red}{R_3 - R_2}\\ \\ \end{matrix} \) \( \begin{bmatrix} 1 & 0 & -1 & 2 \\ 0 & 1 & -1 & -1\\ \color{red}{0-0}& \color{red}{1-1}& \color{red}{1-(-1)} & \color{red}{3-(-1)}\\ 0 & 0 & - 2 & - 2 \end{bmatrix} \) = \( \begin{bmatrix} \color{blue}1 & 0 & -1 & 2 \\ \color{magenta}0 & \color{blue}1 & -1 & -1\\ \color{magenta}0 & \color{magenta}0 & 2 & 4\\ \color{magenta}0 & \color{magenta}0 & - 2 & - 2 \end{bmatrix} \)

STEP 3: Find a leading 1, called the pivot, in column 3 if any and zeros below it
Now we have a non zero in clomun (3) row (3) , we need to have a zero in column (3) of row (4). This can be done by simply adding row (3) to row (4).
\( \begin{matrix} \\ \\ \\ \color{red}{R_4+R_3}\\ \end{matrix} \begin{bmatrix} 1 & 0 & -1 & 2 \\ 0 & 1 & -1 & -1\\ 0 & 0 & 2 & 4\\ 0+ 0 & 0+0 & - 2+2 & - 2+4 \end{bmatrix} \) = \( \begin{bmatrix} 1 & 0 & -1 & 2 \\ 0 & 1 & -1 & -1\\ 0 & 0 & 2 & 4\\ 0 & 0 & 0 & 2 \end{bmatrix} \)


A leading 1 in row (3) which also the pivot of column (3) and a leading 1 in row (4) are obtained by multiplying row (3) by \( \dfrac{1}{2} \) and row (4) by \( \dfrac{1}{2} \).
\( \begin{matrix} \\ \\ \color{red}{\frac{1}{2} R_3}\\ \color{red}{\frac{1}{2} R_4}\\ \end{matrix} \begin{bmatrix} 1 & 0 & -1 & 2 \\ 0 & 1 & -1 & -1\\ 0 & 0 & 2 & 4\\ 0 & 0 & 0 & 2 \end{bmatrix} \) = \( \begin{bmatrix} \color{blue}1 & 0 & -1 & 2 \\ \color{magenta}0 & \color{blue}1 & -1 & -1\\ \color{magenta}0 & \color{magenta}0 & \color{blue}1 & 2\\ \color{magenta}0 & \color{magenta}0 & \color{magenta}0 & \color{blue}1 \end{bmatrix} \)

Conclusion: Our matrix has been written in row echelon form.

Part 2: We now continue to rewrite it in reduced row echelon form


We proceed per column starting from the rightmost column with a pivot.
STEP 4: All numbers above the leading one in row 4 must be zero
Add -2 times row 4 to row 1; add row 4 to row 1 and add -2 times row 4 to row 3.
\( \begin{matrix} \color{red}{R_1 - 2 R_4}\\ \color{red}{R_2 + R_4} \\ \color{red}{R_3 - 2 R_4} \\ \\ \end{matrix} \begin{bmatrix} \color{blue}1 & 0 & -1 & \color{magenta}0 \\ 0 & \color{blue}1 & -1 & \color{magenta}0\\ 0 & 0 & \color{blue}1 & \color{magenta}0\\ 0 & 0 & 0 & \color{blue}1 \end{bmatrix} \)

STEP 5: All numbers above the leading one in row 3 must be zero
Add row 3 to row 1; add row 3 to row 2
\( \begin{matrix} \color{red}{R_1 + R_3}\\ \color{red}{R_2 + R_3} \\ \\ \\ \end{matrix} \begin{bmatrix} \color{blue}1 & \color{magenta}0 & \color{magenta}0 & \color{magenta}0 \\ 0 & \color{blue}1 & \color{magenta}0 & \color{magenta}0\\ 0 & 0 & \color{blue}1 & \color{magenta}0\\ 0 & 0 & 0 & \color{blue}1 \end{bmatrix} \)
The number above the 1 in row 2 is already zero and no calculations are needed.
Conclusion: The matrix given in example 4 was first written in row echelon form in part 1 and then we continued and wrote it in reduced row echelon form in part 2.

A calculator to row reduce matrices is included.

Questions with Solution

Part 1
a) Which of the following matrices are NOT in row echelon form? Explain why.
b) Of the matrices that are in row echelon, which are NOT in reduced row echelon form? Explain why.

  1. \(\begin{bmatrix} 1 & -1 & 0 & 0 & -1\\ 0 & 1 & 2 & -3 & 1\\ 0 & 0 & 1 & 0 & -1 \\ 0 & 1 & 0 & 1 & -2 \end{bmatrix} \)

  2. \(\begin{bmatrix} 1 & -1 & 2 & -1\\ 0 & 1 & 2 & 1\\ 0 & 0 & 1 & -1 \\ \end{bmatrix} \)

  3. \(\begin{bmatrix} 1 & 0 & -3 \\ 1 & 1 & 2 \\ \end{bmatrix} \)

  4. \(\begin{bmatrix} 1 & 0 & 0 & 0 & -2\\ 0 & 1 & 0 & 0 & 3\\ 0 & 0 & 1 & 0 & -1 \\ 0 & 0 & 0 & 1 & -4 \end{bmatrix} \)

  5. \(\begin{bmatrix} 1 & 0 & 0 & -9\\ 0 & 1 & 1 & -2\\ 0 & 0 & 1 & 0 \\ \end{bmatrix} \)

  6. \(\begin{bmatrix} 1 & 0 & -2 \\ 0 & 1 & 2 \\ \end{bmatrix} \)

Part 2
Rewrite in row reduced form the following matrices.

  1. \(\begin{bmatrix} 2 & 4 & 2 \\ -1 & 2 & 0 \end{bmatrix} \)


  2. \(\begin{bmatrix} -1 & 2 & 1 & 0\\ 2 & 1 & 0 & -1\\ 5 & 0 & -2 & 6 \end{bmatrix} \)


  3. \(\begin{bmatrix} -1 & 2 & 0 & 1 & 1\\ 1 & -2 & -1 & 2 & 3\\ 0 & 1 & 2 & -2 & 1 \\ -1 & 3 & 4 & 2 & 0 \end{bmatrix} \)



Solutions to the Above Questions

Part 1
a) Matrices 1. and 3.
In matrix 1., the 1 in column (2) of row(4) makes that matrix NOT a row echelon form.
In matrix 3., the 1 in column (1) of row (2) makes that matrix NOT a row echelon form
b) Matrices 2. and 5.
In matrix 2., the -1 and 2 in row (1) and the 2 in row (2) make that matrix NOT a reduced row echelon form.
In matrix 5., the 1 in column (3) of row (2) makes that matrix NOT a reduced row echelon form.

Part 2
1)
Write the given matrix in row echelon form
\( \begin{matrix} \color{red}{\frac{1}{2} R_1} \\ \\ \end{matrix} \begin{bmatrix} 1 & 2 & 1 \\ -1 & 2 & 0 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{R_2+ R_1} \\ \end{matrix} \begin{bmatrix} 1 & 2 & 1 \\ 0 & 4 & 1 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{\frac{1}{2} R_2} \\ \end{matrix} \begin{bmatrix} 1 & 2 & 1 \\ 0 & 1 & 1/4 \end{bmatrix} \)

Write the above matrix in reduced row echelon form
\( \begin{matrix} \color{red}{R_1 - 2 R_2} \\ \\ \end{matrix} \begin{bmatrix} 1 & 0 & 1/2 \\ 0 & 1 & 1/4 \end{bmatrix} \)


2)
Write the given matrix in row echelon form
\( \begin{matrix} \color{red}{ - R_1 } \\ \\ \\ \end{matrix} \begin{bmatrix} 1 & -2 & -1 & 0\\ 2 & 1 & 0 & -1\\ 5 & 0 & -2 & 6 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{ R_2 - 2 R_1 } \\ \color{red}{ R_3 - 5 R_1 } \\ \end{matrix} \begin{bmatrix} 1 & -2 & -1 & 0\\ 0 & 5 & 2 & -1\\ 0 & 10 & 3 & 6 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{\frac{1}{5} R_2} \\ \\ \end{matrix} \begin{bmatrix} 1 & -2 & -1 & 0\\ 0 & 1 & 2/5 & -1/5\\ 0 & 10 & 3 & 6 \end{bmatrix} \)

\( \begin{matrix} \\ \\ \color{red}{ R_3 - 10 R_2 } \\ \end{matrix} \begin{bmatrix} 1 & -2 & -1 & 0\\ 0 & 1 & 2/5 & -1/5\\ 0 & 0 & -1 & 8 \end{bmatrix} \)

\( \begin{matrix} \\ \\ \color{red}{- R_3}\\ \end{matrix} \begin{bmatrix} 1 & -2 & -1 & 0\\ 0 & 1 & 2/5 & -1/5\\ 0 & 0 & 1 & -8 \end{bmatrix} \)

Write the above matrix in reduced row echelon form
\( \begin{matrix} \color{red}{R_1 + R_3} \\ \color{red}{ R_2 - (2/5) R_3 } \\ \\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & -8\\ 0 & 1 & 0 & 3\\ 0 & 0 & 1 & -8 \end{bmatrix} \)

\( \begin{matrix} \color{red}{R_1 + 2 R_2} \\ \\ \\ \end{matrix} \begin{bmatrix} 1 & 0 & 0 & - 2\\ 0 & 1 & 0 & 3\\ 0 & 0 & 1 & -8 \end{bmatrix} \)


3)
Write the given matrix in row echelon form
\( \begin{matrix} \color{red}{ - R_1 } \\ \\ \\ \\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & -1 & -1\\ 1 & -2 & -1 & 2 & 3\\ 0 & 1 & 2 & -2 & 1 \\ -1 & 3 & 4 & 2 & 0 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{R_2 - R_1}\\ \\ \color{red}{R_4 + R_1}\\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & -1 & -1\\ 0 & 0 & -1 & 3 & 4\\ 0 & 1 & 2 & -2 & 1 \\ 0 & 1 & 4 & 1 & -1 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{\text{interchange} \; R_2 \; \text{and} \; R_3}\\ \color{red}{\text{interchange} \; R_3 \; \text{and} \; R_2}\\ \color{red}{R_4 - R_3}\\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & -1 & -1\\ 0 & 1 & 2 & -2 & 1\\ 0 & 0 & -1 & 3 & 4 \\ 0 & 0 & 2 & 3 & -2 \end{bmatrix} \)

\( \begin{matrix} \\ \\ \color{red}{ - R_3}\\ \color{red}{R_4 +2 R_3}\\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & -1 & -1\\ 0 & 1 & 2 & -2 & 1\\ 0 & 0 & 1 & -3 & -4 \\ 0 & 0 & 0 & 9 & 6 \end{bmatrix} \)

\( \begin{matrix} \\ \\ \\ \color{red}{ \frac{1}{9} R_4}\\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & -1 & -1\\ 0 & 1 & 2 & -2 & 1\\ 0 & 0 & 1 & -3 & -4 \\ 0 & 0 & 0 & 1 & 2/3 \end{bmatrix} \)

Write the above matrix in reduced row echelon form
\( \begin{matrix} \color{red}{R_1 + R_4}\\ \color{red}{R_2 + 2 R_4}\\ \color{red}{R_3 + 3 R_4} \\ \\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & 0 & -1/3\\ 0 & 1 & 2 & 0 & 7/3\\ 0 & 0 & 1 & 0 & - 2\\ 0 & 0 & 0 & 1 & 2/3 \end{bmatrix} \)

\( \begin{matrix} \\ \color{red}{R_2 - 2 R_3}\\ \\ \\ \end{matrix} \begin{bmatrix} 1 & -2 & 0 & 0 & -1/3\\ 0 & 1 & 0 & 0 & 19/3\\ 0 & 0 & 1 & 0 & - 2\\ 0 & 0 & 0 & 1 & 2/3 \end{bmatrix} \)

\( \begin{matrix} \color{red}{R_1 + 2 R_2}\\ \\ \\ \\ \end{matrix} \begin{bmatrix} 1 & 0 & 0 & 0 & 37/3\\ 0 & 1 & 0 & 0 & 19/3\\ 0 & 0 & 1 & 0 & - 2\\ 0 & 0 & 0 & 1 & 2/3 \end{bmatrix} \)



More References and links

  1. linear algebra
  2. Row Reduce Augmented Matrices - Calculator
  3. Solve a system of linear equations by elimination
  4. elementary matrices