determin.ant
05-vector-spaces / 5.3

Module 5: Vector Spaces

Rank

Where you'll see this: rank is one of the most checked properties in data science. A feature matrix where two columns are perfectly correlated has rank less than the number of columns — causing multicollinearity, numerical instability, and models that can't be uniquely solved.

Rank is a single number that summarizes how much "independent information" a matrix contains. It's the dimension of the column space.

What rank means geometrically

A 2×2 matrix transforms the plane. Rank 2 means the transformation is full — it maps the plane to the whole plane. Rank 1 means every input gets squashed to a single line. Rank 0 means everything goes to zero.

Rank is determined by linear independence of the columns (or rows — they always give the same number). Whenever one column is a multiple of another, the rank drops.

Rank and invertibility

A 2×2 matrix is invertible if and only if it has rank 2. Equivalently: det(A) ≠ 0 ↔ rank = 2.

Any rank deficiency is catastrophic for solving linear systems: if Ax=bA\mathbf{x} = \mathbf{b}and rank(A) < 2, then either there are infinitely many solutions or none at all — never exactly one.

Full rank = invertible = unique solutions.
Below full rank = singular = either no solution or infinitely many.

Computing rank

Row-reduce to echelon form. Count the non-zero rows. That's the rank. Numerically, use SVD and count singular values above a threshold.

Try it

Use the presets at the top to switch between rank 2, 1, and 0. Or drag the column vectors to explore. Notice that rank 1 shows the column space as a dashed line — the full plane has collapsed to a line.

In NumPy:
import numpy as np
A = np.array([[1, 2], [2, 4]])
print(np.linalg.matrix_rank(A))   # 1 — columns are parallel

B = np.array([[1, 0], [0, 1]])
print(np.linalg.matrix_rank(B))   # 2 — full rank
Column, Null, and Row SpaceRank-Nullity Theorem
-6-6-5-5-4-4-3-3-2-2-1-1112233445566col₁col₂
rank(A) =2— full rank, invertible

det(A) = 4 · · col₁=[2,0] col₂=[1,2]

Drag the column vectors or try the presets above.