Mathwords logoMathwords

Matrix Rank — Definition, Formula & Examples

Matrix rank is the number of linearly independent rows (or equivalently, columns) in a matrix. It tells you the dimension of the vector space spanned by the matrix's rows or columns.

The rank of an m×nm \times n matrix AA, denoted rank(A)\text{rank}(A), is the dimension of the column space (or row space) of AA. Equivalently, it equals the number of nonzero rows in any row echelon form of AA. The rank satisfies 0rank(A)min(m,n)0 \leq \text{rank}(A) \leq \min(m, n).

Key Formula

rank(A)=number of pivot positions in the row echelon form of A\text{rank}(A) = \text{number of pivot positions in the row echelon form of } A
Where:
  • AA = An m × n matrix
  • rank(A)\text{rank}(A) = The number of linearly independent rows or columns of A

How It Works

To find the rank of a matrix, reduce it to row echelon form using elementary row operations. Then count the number of nonzero rows — that count is the rank. A matrix with rank equal to min(m,n)\min(m, n) is said to have full rank. If a square n×nn \times n matrix has rank nn, it is invertible; if its rank is less than nn, the matrix is singular.

Worked Example

Problem: Find the rank of the matrix A = [[1, 2, 3], [2, 4, 6], [0, 1, 1]].
Step 1: Perform row reduction. Replace R₂ with R₂ − 2R₁ to eliminate the first entry of row 2.
[123246011]R22R1[123000011]\begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 0 & 1 & 1 \end{bmatrix} \xrightarrow{R_2 - 2R_1} \begin{bmatrix} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 0 & 1 & 1 \end{bmatrix}
Step 2: Swap R₂ and R₃ to move the zero row to the bottom.
[123011000]\begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{bmatrix}
Step 3: Count the nonzero rows. There are 2 pivot rows (rows 1 and 2), and one zero row.
rank(A)=2\text{rank}(A) = 2
Answer: The rank of A is 2. Row 2 of the original matrix was a scalar multiple of row 1, so only 2 of the 3 rows were linearly independent.

Why It Matters

Rank determines whether a system of linear equations has a unique solution, infinitely many solutions, or none. In data science and machine learning, matrix rank helps identify redundant features in datasets and underlies techniques like principal component analysis (PCA).

Common Mistakes

Mistake: Counting all nonzero rows in the original matrix instead of in row echelon form.
Correction: A row can be nonzero yet still be a linear combination of other rows. Always row-reduce first, then count pivot rows.