Matrix Rank
The rank of a matrix is the number of linearly independent rows — equivalently, the number of pivots in its row echelon form. Enter the matrix and the calculator row-reduces it and reports the rank.
How much independence is actually there
A matrix with four rows does not necessarily carry four rows' worth of information. If one row is the sum of two others it adds nothing that was not already there, and the same is true of any row that can be built from its neighbours. Rank counts the rows that genuinely contribute.
This calculator finds that count by row-reducing the matrix and counting the pivots, showing the operations it performed and which columns ended up carrying them.
Rank is the answer to several questions at once. It is the number of independent rows, the number of independent columns, and the dimension of the space the matrix maps onto. Those three counts always agree, which is a genuinely surprising theorem given how differently they are described.
The practical value is diagnostic. A system of equations with fewer independent rows than unknowns cannot pin down a unique answer, and a set of vectors whose matrix is rank-deficient cannot span what its count suggests. Rank is what turns those vague suspicions into a number.
How to use this calculator
- Enter the matrix Commas between entries, semicolons between rows. Rectangular matrices are fine — rank is defined for any shape, unlike the determinant or the trace.
- Read the row operations Every swap, scaling and elimination is listed. A matrix already in reduced form produces none, and the tool says so rather than leaving the line blank.
- Look at the pivot columns These are the columns that received a leading entry. They identify which columns are independent, not merely how many.
- Read the rank and the note beneath it The note compares the rank against the smaller of the two dimensions, which is the most it could possibly be.
How the rank is determined
The matrix is reduced to row echelon form by elimination. Working left to right, each column is examined for a usable entry below the current row; the row with the largest such entry is swapped up, scaled so its leading entry becomes 1, and used to clear that column everywhere else.
A column whose candidate entries are all smaller than the working tolerance is skipped without consuming a row. That is what allows a matrix to have fewer pivots than columns, and it is exactly where dependence shows itself: nothing remains in that column once the earlier rows have done their work.
The rank is the number of pivots found, which is also the number of non-zero rows in the reduced matrix. Rows that reduce entirely to zero were combinations of the others all along, and elimination is what makes that visible.
Because the comparison against zero uses a tolerance rather than exact equality, the result depends slightly on scale. The largest available entry is always chosen as the pivot, which keeps the divisions stable and makes a spurious rank less likely on ordinary data.
What each input means
- A Matrix — form field “Matrix (rows separated by ;)”
- Any rectangular matrix, entered row by row. It need not be square, and the row and column counts may differ freely.
- rank(A) Rank
- The number of pivots after reduction. It cannot exceed the smaller of the two dimensions.
- pivot columns Pivot columns
- The columns that received a leading entry. In the original matrix they form a maximal independent set of columns.
Worked examples
Every number below is produced by the same calculation engine the tool above runs. Nothing here is typed by hand, so the walkthrough cannot drift from what you get when you enter the same values yourself.
A rank-deficient 3×3 matrix
The matrix with rows (1, 2, 3), (4, 5, 6) and (7, 8, 9). The rows form an arithmetic progression, so one of them is redundant.
Inputs Matrix (rows separated by ;) = 1, 2, 3; 4, 5, 6; 7, 8, 9
- Matrix A 3×3 [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- Method Row reduce to echelon form; the rank is the number of non-zero rows (= number of pivots).
- Row operations Swap R1 ↔ R3; R1 → (1/7)·R1; R2 → R2 − (4)·R1; R3 → R3 − (1)·R1; Swap R2 ↔ R3; R2 → (1/0.857143)·R2; R1 → R1 − (1.14286)·R2; R3 → R3 − (0.428571)·R2
- Reduced form [[1, 0, -1], [0, 1, 2], [0, 0, 0]]
- Pivot columns column 1, column 2
- Rank rank(A) = 2
- Note Rank < min(rows, cols) = 3: the rows are linearly dependent.
Result rank(A) = 2
The third row is exactly twice the second minus the first, so elimination reduces it to zeros and only two pivots survive. The rank is 2 rather than 3, and the note flags the dependence explicitly.
A square matrix of rank below its size is singular, so this one has no inverse and its determinant is zero. Rank says more than the determinant does, though: it reports how far short of invertible the matrix falls, not merely that it does.
A tall matrix with more rows than columns
Four rows of three entries, continuing the same arithmetic pattern. Rank cannot exceed 3 here whatever the entries.
Inputs Matrix (rows separated by ;) = 1,2,3; 4,5,6; 7,8,9; 10,11,12
- Matrix A 4×3 [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
- Method Row reduce to echelon form; the rank is the number of non-zero rows (= number of pivots).
- Row operations Swap R1 ↔ R4; R1 → (1/10)·R1; R2 → R2 − (4)·R1; R3 → R3 − (7)·R1; R4 → R4 − (1)·R1; Swap R2 ↔ R4; R2 → (1/0.9)·R2; R1 → R1 − (1.1)·R2; R3 → R3 − (0.3)·R2; R4 → R4 − (0.6)·R2
- Reduced form [[1, 0, -1], [0, 1, 2], [0, 0, 0], [0, 0, 0]]
- Pivot columns column 1, column 2
- Rank rank(A) = 2
- Note Rank < min(rows, cols) = 3: the rows are linearly dependent.
Result rank(A) = 2
Two rows reduce to zero and the rank comes out as 2, well below the ceiling of 3 that the shape allows. Adding rows to a matrix cannot raise its rank beyond the number of columns.
This is the shape of an overdetermined system: four equations in three unknowns. A rank of 2 means only two of the four carry independent information, so the system is far less constrained than the equation count suggests.
Reading the result
What full rank means
That the rank equals the smaller dimension — the most it could be. For a square matrix that is equivalent to being invertible; for a tall one it means the columns are independent; for a wide one, the rows.
Row rank equals column rank
Counting independent rows and counting independent columns give the same answer for every matrix, which is why rank needs no qualifier. It also means transposing a matrix leaves its rank unchanged.
The gap to full rank is the nullity
Columns minus rank gives the dimension of the space collapsed to zero. For a system of equations that number counts the free parameters in the solution — so a rank one short of full means a one-parameter family of answers.
When you would use this
Diagnosing a system of equations
Comparing the rank of the coefficient matrix against the number of unknowns says whether a unique solution is possible at all, before any attempt is made to find one.
Testing whether vectors span a space
Stacking vectors as rows and taking the rank counts how many independent directions they cover. A rank below the number of vectors means at least one is redundant.
Assumptions and limitations
What this calculator assumes
- The matrix may be any rectangular shape; no squareness is required.
- Independence is judged numerically against a small tolerance rather than exact zero.
- Partial pivoting is used, so rows may be reordered during reduction.
- The rank reported is the number of pivot columns, which equals the number of non-zero rows after reduction.
Where it stops being the right tool
- A basis for the null space is not produced, only the pivot columns.
- Near-dependent rows can be counted as independent, since the comparison uses a fixed tolerance.
- Symbolic entries are not accepted, so a rank that depends on a parameter cannot be investigated.
Common mistakes
Expecting rank to equal the number of rows
Why it happens. Each row looks like a distinct piece of information, especially when no two are visibly proportional. Dependence is usually a combination of several rows rather than a simple multiple, and it is invisible by inspection.
How to avoid it. Read the reduced form. Rows that came out as all zeros were combinations of the others, however different they looked at the start.
Assuming a matrix with no zero entries has full rank
Why it happens. Zeros feel like the visible sign of degeneracy, so a dense matrix of unrelated-looking numbers seems safe.
How to avoid it. Compute the rank rather than judging by appearance. The first worked example has no zero entries at all and is still rank-deficient.
Confusing the pivot columns with the independent rows
Why it happens. Both are counted by the rank and both are reported, so the two lists get read as the same thing.
How to avoid it. Pivot columns identify independent columns of the original matrix. The independent rows are the non-zero rows of the reduced form, which are different objects with the same count.
Frequently asked questions
Is row rank the same as column rank?
Yes, always. The number of independent rows equals the number of independent columns for every matrix, and that common value is the rank. One consequence is that a matrix and its transpose share a rank.
What does full rank mean?
That the rank equals the smaller of the two dimensions, which is the largest it can be. For a square matrix full rank is exactly equivalent to being invertible and to having a non-zero determinant.
How does row reduction reveal the rank?
Elimination cannot change which rows are combinations of which others, but it makes the dependence visible: a dependent row reduces to zeros. Counting the rows that survive, equivalently the pivots, gives the rank.
Can a rectangular matrix have a rank?
Yes — unlike the determinant and the trace, rank is defined for any shape. It is capped by the smaller dimension, so a 4×3 matrix has rank at most 3 however many rows are added.