Compute the rank of any matrix using Gaussian elimination. Visualize the row echelon form, determine full-rank status, and explore key linear algebra properties.
In linear algebra, the rank of a matrix is one of the most fundamental invariants. It reveals the number of linearly independent rows or columns, which in turn determines the dimension of the column space and row space. The rank of a matrix A (denoted rank(A) or ρ(A)) is defined as the maximum number of linearly independent column vectors in the matrix, equivalently the dimension of the column space. By the rank–nullity theorem, the rank plus the nullity (dimension of the kernel) equals the number of columns.
For an m × n matrix A:
rank(A) = dim(Col(A)) = dim(Row(A)) ≤ min(m, n)
rank(A) + nullity(A) = n (Rank–Nullity Theorem)
Our calculator uses Gaussian elimination (row reduction) to transform the input matrix into row echelon form (REF). The algorithm scans each column from left to right, selects a pivot (the first non‑zero entry in the current row), and eliminates all entries below it. After completing the elimination, the number of non‑zero rows is the rank. For square matrices, the determinant is computed as the product of the pivots (with sign tracking) — a non‑zero determinant confirms full rank.
The calculator also reports the nullity via the rank–nullity theorem: nullity = number of columns − rank. This gives the dimension of the solution space to Ax = 0. All computations are performed with double‑precision floating‑point arithmetic, and numerical near‑zero values are treated as zero using a tolerance of 10−10.
Consider a dataset with 500 samples and 100 features. The feature matrix X has dimensions 500 × 100. Computing the rank of X reveals the effective number of independent features. If rank(X) is significantly less than 100, the data lies on a lower‑dimensional subspace. This insight drives dimensionality reduction techniques like Principal Component Analysis (PCA), where the top k singular vectors (corresponding to the largest singular values) are used to project the data onto a k‑dimensional space while preserving most of the variance. In practice, a rank calculation helps choose the number of principal components to retain.
Example: A 100×100 matrix with rank 20 implies that only 20 linearly independent directions exist. The nullity is 80, meaning there are 80 dimensions of redundancy or noise. By truncating to rank 20, we can compress the data by 80% with minimal information loss.