Matrix Rank Calculator
Enter your matrix dimensions and cell values to find the rank instantly. The calculator uses Gaussian elimination with partial pivoting, shows every row operation, identifies all pivot positions, and computes the nullity. Choose from 2x2 up to 4x4 matrices. Rank, nullity, and a full worked-solution panel update as you type.
Formula
Worked example
For A = [[1,2,3],[4,5,6],[7,8,9]]: R2 = R2 - 4*R1 gives [0,-3,-6], R3 = R3 - 7*R1 gives [0,-6,-12]. Then R3 = R3 - 2*R2 gives [0,0,0]. The REF has 2 non-zero rows, so rank = 2 and nullity = 3 - 2 = 1.
What is the rank of a matrix?
The rank of a matrix is the number of linearly independent rows it contains - equivalently, the number of linearly independent columns. Two rows are linearly dependent if one is a scalar multiple of the other, or more generally if one can be written as a linear combination of the others. Rank tells you how much "true" information a matrix carries: a 3-row matrix with rank 2 effectively has only two independent equations, with the third being redundant. Rank is the dimension of both the row space and the column space, and it obeys rank(A) is always at most min(m, n) for an m-by-n matrix.
How Gaussian elimination computes rank
The standard algorithm is Gaussian elimination (or its extension, Gauss-Jordan elimination). Starting with the leftmost column, you identify the entry with the largest absolute value in that column at or below the current pivot row (partial pivoting for numerical stability), swap it to the pivot position, and then subtract appropriate multiples of the pivot row from every row below to zero out that column. Repeating this column by column transforms the matrix into row echelon form (REF). The rank is simply the number of non-zero rows that remain. This calculator applies partial pivoting and tracks every operation in the steps panel, so you can follow the arithmetic exactly as a textbook would show it.
The rank-nullity theorem
One of the most useful results in linear algebra is the rank-nullity theorem: rank(A) + nullity(A) = n, where n is the number of columns. The nullity is the dimension of the null space of A - the set of all vectors x such that Ax = 0. A nullity of zero means the only solution to the homogeneous equation is the trivial one (x = 0), so the columns are linearly independent. A positive nullity means there are free variables and the null space contains infinitely many vectors. If you are solving a system Ax = b, a positive nullity means that if any solution exists, infinitely many do (each null-space vector can be added to any particular solution).
Full rank, rank-deficiency, and invertibility
A matrix is called full rank when its rank equals min(m, n), the largest it could possibly be. For a square n-by-n matrix, full rank means the matrix is invertible (non-singular): the determinant is non-zero, the system Ax = b has a unique solution for any right-hand side b, and the null space is trivial. A rank-deficient matrix (rank strictly less than min(m, n)) is singular if square, cannot be inverted, and the system Ax = b either has no solution or infinitely many. Rank-deficiency arises naturally in practice: collinear data in a regression problem, redundant constraints in an optimization, or a camera matrix in computer vision that has not been set up correctly.
Matrix rank properties and interpretations
| Condition | Meaning | System Ax = b |
|---|---|---|
| rank = min(m, n) | Full rank - all rows/cols linearly independent | Unique solution or consistent |
| rank < min(m, n) | Rank-deficient - some rows are redundant | May have infinite or no solutions |
| rank = n (square matrix) | Invertible (non-singular) | Exactly one solution for any b |
| rank < n (square matrix) | Singular matrix - determinant is 0 | Either no solution or infinitely many |
| nullity = 0 | Only trivial solution to Ax = 0 | Ax = b has at most one solution |
| nullity > 0 | Infinitely many solutions to Ax = 0 | If consistent, Ax = b has infinitely many |
| rank = 0 | Zero matrix (all entries are 0) | Ax = b has solution only if b = 0 |
Key relationships between rank, nullity, and the properties of a matrix and the linear system it represents.
Frequently asked questions
What does it mean if the rank equals zero?
A rank of zero means every entry in the matrix is zero (the zero matrix). There are no non-zero rows in the row echelon form, so the row space and column space both have dimension zero. The system Ax = b can only be consistent if b is also the zero vector.
Is the rank of a matrix the same as the rank of its transpose?
Yes. rank(A) = rank(A^T) always. This is why the row rank (number of linearly independent rows) equals the column rank (number of linearly independent columns) - they are both the same number, which is what we simply call the rank.
How does rank relate to solving systems of equations?
For a system Ax = b with m equations and n unknowns, the system is consistent (has at least one solution) if and only if rank(A) = rank([A|b]), where [A|b] is the augmented matrix. If consistent and rank(A) = n, there is exactly one solution. If consistent and rank(A) < n, there are infinitely many solutions (with n - rank(A) free variables). If rank(A) < rank([A|b]), the system is inconsistent and has no solution.
What is the difference between rank and row echelon form?
Row echelon form (REF) is a specific shape a matrix can be reduced to using elementary row operations: all zero rows are at the bottom, and the leading non-zero entry (pivot) of each non-zero row is to the right of the pivot in the row above. The rank is simply the count of non-zero rows in the REF. Reduced row echelon form (RREF) goes further by making each pivot exactly 1 and zeroing entries above each pivot as well.
Can two different matrices have the same rank?
Yes, many matrices share the same rank. Rank only captures one number about a matrix - the number of independent rows. Two 3x3 matrices can both have rank 2 while being entirely different matrices. What rank does tell you is that any two matrices with the same rank and the same dimensions have row spaces of the same dimension, even if those spaces point in different directions.
How do I enter a 2x3 matrix in this calculator?
Set rows to 2 and columns to 3, then enter 6 numbers separated by commas, going across each row from left to right. For the matrix [[1, 2, 3], [4, 5, 6]], type: 1,2,3,4,5,6. The first three numbers form the first row and the last three form the second row.