TExcelTAD
Home › Linear Algebra & Matrix Theory › Uniqueness of the Reduced Echelon Form

Uniqueness of the Reduced Echelon Form

Two people row-reducing the same matrix may choose different pivots, swap different rows and get different echelon forms along the way. Yet if both go all the way to the reduced row echelon form, they always end with exactly the same matrix. This lesson explains why, and why that matters.

Echelon forms are not unique

Here are two different row echelon forms of the same matrix:

A=[1234][120−2]R2←R2−3R1[34023]R1↔R2, then R2←R2−13R1A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \qquad \overset{R_2 \leftarrow R_2 - 3R_1}{\begin{bmatrix} 1 & 2 \\ 0 & -2 \end{bmatrix}} \qquad \overset{R_1 \leftrightarrow R_2, \text{ then } R_2 \leftarrow R_2 - \frac{1}{3}R_1}{\begin{bmatrix} 3 & 4 \\ 0 & \frac{2}{3} \end{bmatrix}}

Both are valid echelon forms, with different numbers. Their RREF, however, is the same: [1001]\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}.

The theorem

Theorem. Every matrix is row equivalent to exactly one matrix in reduced row echelon form.

Existence is the Gauss-Jordan algorithm: it always terminates with an RREF. The interesting part is uniqueness.

Why it is unique (proof sketch)

The idea: an RREF is completely determined by which linear relations hold among the columns, and row operations never change those relations.

Step 1. Row operations preserve column relations. A relation c1⋅(column 1)+⋯+cn⋅(column n)=0c_1 \cdot (\text{column } 1) + \cdots + c_n \cdot (\text{column } n) = \mathbf{0} says exactly that (c1,…,cn)(c_1, \ldots, c_n) is a solution of the homogeneous system Mx=0M\mathbf{x} = \mathbf{0}. Row operations do not change the solutions of a system (Elementary Operations). So if AA and RR are row equivalent, they have exactly the same column relations.

Step 2. The relations determine the pivot columns. In an RREF, column jj is a pivot column exactly when it is not a combination of the columns to its left (a pivot column has a 1 in a row where all earlier columns are 0). That property is a statement about column relations, so by Step 1 it is the same for any two RREFs RR and SS of AA. They have the same pivot columns.

Step 3. The relations determine the other entries. The pivot columns of an RREF are the standard columns e1,e2,…\mathbf{e}_1, \mathbf{e}_2, \ldots in order. A non-pivot column jj is a combination of the pivot columns to its left, and its entries are precisely the coefficients of that combination:

column j=r1j⋅e1+r2j⋅e2+⋯(r1j,r2j,… are the entries of column j)\text{column } j = r_{1j} \cdot \mathbf{e}_1 + r_{2j} \cdot \mathbf{e}_2 + \cdots \qquad (r_{1j}, r_{2j}, \ldots \text{ are the entries of column } j)

The same relation holds in SS, with the same pivot columns e1,e2,…\mathbf{e}_1, \mathbf{e}_2, \ldots, so SS has the same entries in column jj. Hence R=SR = S. ∎

Consequences

Consequence Why it matters
The pivot positions of AA are well defined any echelon form, not only the RREF, has its pivots in the same columns
The number of pivots, the rank of AA, is well defined it does not depend on how you reduced
The number of free variables is well defined the dimension of the solution set is a property of the system
Two matrices are row equivalent  ⟺  they have the same RREF\text{Two matrices are row equivalent} \iff \text{they have the same RREF} a mechanical test for row equivalence

Seeing it in code

Apply a long random sequence of row operations to a matrix: the RREF never changes.

python · try it yourself
import random
from sympy import Matrix

A = Matrix([[1, 2, -1, 3], [2, 4, 0, 2], [-1, -2, 3, -7]])
print("RREF of A:", A.rref()[0].tolist())

random.seed(4)
B = A.copy()
for step in range(30):
    i, j = random.sample(range(3), 2)
    op = random.choice(["swap", "scale", "add"])
    if op == "swap":
        B = B.elementary_row_op("n<->m", row1=i, row2=j)
    elif op == "scale":
        B = B.elementary_row_op("n->kn", row=i, k=random.choice([-3, -2, 2, 5]))
    else:
        B = B.elementary_row_op("n->n+km", row=i, k=random.randint(-4, 4), row2=j)

print("scrambled B:", B.tolist())
print("RREF of B:", B.rref()[0].tolist())
print("same RREF:", A.rref()[0] == B.rref()[0])
RREF of A: [[1, 2, 0, 1], [0, 0, 1, -2], [0, 0, 0, 0]]
scrambled B: [[3050, 6100, -4962, 12974], [-1040, -2080, 1680, -4400], [2098, 4196, -3378, 8854]]
RREF of B: [[1, 2, 0, 1], [0, 0, 1, -2], [0, 0, 0, 0]]
same RREF: True

Because the RREF is unique, it works as a canonical form: a standard representative that you can compare with ==.

python · try it yourself
from sympy import Matrix

def row_equivalent(A, B):
    return Matrix(A).rref()[0] == Matrix(B).rref()[0]

print(row_equivalent([[1, 2], [3, 4]], [[0, 1], [5, 0]]))
print(row_equivalent([[1, 2], [2, 4]], [[1, 2], [0, 1]]))
print(row_equivalent([[1, 1, 2], [0, 1, 1]], [[2, 3, 5], [1, 0, 1]]))
True
False
True

The first pair are both invertible 2×22 \times 2 matrices (RREF=identity\text{RREF} = \text{identity}). In the second pair, [1224]\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix} has rank 1 and the other has rank 2.

In software

Canonical forms are a core programming idea: normalizing before comparing. Unicode normalization (NFC), sorted keys in JSON before hashing, canonical SMILES strings for molecules and the RREF of a matrix all answer "are these two things the same?" by reducing both to a unique standard form. In coding theory, the RREF of a generator matrix is the standard form of a linear code (error-correcting codes).

Exercises

Exercise 1: Two echelon forms

Give two different row echelon forms of [2413]\begin{bmatrix} 2 & 4 \\ 1 & 3 \end{bmatrix}, and its RREF.

Answer

For example [2401]\begin{bmatrix} 2 & 4 \\ 0 & 1 \end{bmatrix} and [130−2]\begin{bmatrix} 1 & 3 \\ 0 & -2 \end{bmatrix}; RREF [1001]\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}.

Solution
R2←R2−12R1→[2401]R1↔R2, R2←R2−2R1→[130−2]Both have two pivots in a 2×2 matrix, so the RREF is the identity.\begin{aligned} &R_2 \leftarrow R_2 - \tfrac{1}{2}R_1 &&\to \begin{bmatrix} 2 & 4 \\ 0 & 1 \end{bmatrix} \\ &R_1 \leftrightarrow R_2,\ R_2 \leftarrow R_2 - 2R_1 &&\to \begin{bmatrix} 1 & 3 \\ 0 & -2 \end{bmatrix} \\ &\text{Both have two pivots in a } 2 \times 2 \text{ matrix, so the RREF is the identity.} \end{aligned}

Exercise 2: Row equivalent?

Are [123456]\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} and [10−1012]\begin{bmatrix} 1 & 0 & -1 \\ 0 & 1 & 2 \end{bmatrix} row equivalent?

Answer

Yes. The first matrix reduces to [10−1012]\begin{bmatrix} 1 & 0 & -1 \\ 0 & 1 & 2 \end{bmatrix}, which is the second matrix.

Solution
R2−4R1:[1230−3−6]−13R2:[123012]R1−2R2:[10−1012]\begin{aligned} &R_2 - 4R_1\text{:} && \begin{bmatrix} 1 & 2 & 3 \\ 0 & -3 & -6 \end{bmatrix} \\ &-\tfrac{1}{3}R_2\text{:} && \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 2 \end{bmatrix} \\ &R_1 - 2R_2\text{:} && \begin{bmatrix} 1 & 0 & -1 \\ 0 & 1 & 2 \end{bmatrix} \end{aligned}

Exercise 3: Rank from any echelon form

A matrix has the echelon form [314100590002]\begin{bmatrix} 3 & 1 & 4 & 1 \\ 0 & 0 & 5 & 9 \\ 0 & 0 & 0 & 2 \end{bmatrix}. What is its rank, and which columns are pivot columns?

Answer

Rank 3; pivot columns 1, 3 and 4.

Solution

Pivots: 3 (column 1), 5 (column 3), 2 (column 4). By the uniqueness theorem any other echelon form has its pivots in the same columns.

Exercise 4: Column relation (code)

For A=[12−132402−1−23−7]A = \begin{bmatrix} 1 & 2 & -1 & 3 \\ 2 & 4 & 0 & 2 \\ -1 & -2 & 3 & -7 \end{bmatrix} from the lesson, the RREF's column 4 is (1,−2,0)(1, -2, 0). Use that to write column 4 of AA as a combination of its pivot columns, and check it in code.

Answer

column 4=1⋅(column 1)−2⋅(column 3)\text{column } 4 = 1 \cdot (\text{column } 1) - 2 \cdot (\text{column } 3).

Solution

The pivot columns are 1 and 3, and the RREF entries of column 4 are the coefficients (Step 3 of the proof).

python · try it yourself
from sympy import Matrix
A = Matrix([[1, 2, -1, 3], [2, 4, 0, 2], [-1, -2, 3, -7]])
print(list(1 * A[:, 0] - 2 * A[:, 2]), list(A[:, 3]))
[3, 2, -7] [3, 2, -7]

Test yourself

Which of these is unique for a given matrix?

  1. Its row echelon form
  2. Its reduced row echelon form
  3. The sequence of row operations used
  4. The choice of pivots

Why is the rank of a matrix well defined?

  1. Because the RREF is unique, so the number of pivots does not depend on the steps
  2. Because every matrix is square
  3. Because determinants are unique
  4. It is not well defined

What do row operations preserve that makes the uniqueness proof work?

  1. The entries of the first row
  2. The determinant
  3. The number of zero entries
  4. The linear relations among the columns