Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Matrix Rank


Row reduce to echelon form, one operation at a time, and count the pivots — with an editable matrix, presets and a shuffle.

Preset?The rank of a matrix is the number of linearly independent rows, which equals the number of linearly independent columns. Row reduction finds it: reduce to echelon form and count the pivots. Each pivot marks a column that is not a combination of the columns before it. Row operations never change the rank, so the count at the end is the rank of the original matrix. Rank is at most the smaller of the two dimensions.
Size
A3×3
Entries of A
A3×3
1
2
3
2
4
6
1
0
1
R3×3
1
2
3
2
4
6
1
0
1
Step 1 / 8

Row operations

1Rank of a 3×3 matrix
Row reduce A to echelon form and count the pivots. Work column by column: find a non-zero entry at or below the current row (swapping rows if it sits lower), mark it as a pivot, and clear everything beneath it. A column with no such entry is skipped and contributes nothing. Row operations never change the rank, so the pivot count at the end is rank A. It cannot exceed min(3, 3) = 3.
Count the pivots after reduction; row operations never change the rank. Learn more about the opening scene · what it is








Key Terms

Rank — the number of linearly independent rows of a matrix, which always equals the number of linearly independent columns. Written rankA\operatorname{rank} A.

Pivot — the first non-zero entry of a row in echelon form. The rank is the number of pivots.

Pivot column — a column of AA containing a pivot after reduction; the pivot columns of AA form a basis of its column space.

Free column — a column with no pivot; it is a linear combination of the pivot columns to its left.

Row echelon form — a matrix in which each pivot lies strictly to the right of the pivot in the row above, and zero rows sit at the bottom.

Row operations — swapping two rows, scaling a row, and adding a multiple of one row to another. None of them changes the rank.

Nullity — the dimension of the null space, equal to the number of free columns: nrankAn - \operatorname{rank} A.

Rank-nullity theoremrankA+nullityA=n\operatorname{rank} A + \operatorname{nullity} A = n, the number of columns.

Full rankrankA=min(m,n)\operatorname{rank} A = \min(m, n), the largest value an m×nm \times n matrix can have.

Getting Started with the Visualizer

Choose a matrix, then watch it reduce to echelon form one row operation at a time until the pivots can be counted.

• Use the Preset pills for six matrices chosen to show different outcomes: rank-deficient, full rank, rank 1, wide, tall, and zero
• Use the Size steppers to set rows and columns independently (1 to 5 each); resizing keeps the existing entries and pads with zeros
• Edit any entry directly in the grid — the run rebuilds as you type
• Press Shuffle for a random matrix of small integers; half the time one row is secretly a multiple of another, so rank deficiency turns up often
• Hover the ? icon for a reminder of what rank is and why row operations preserve it
• Press play or step manually; the step log on the right lists every row operation performed

This is the one tool in the section that works with actual numbers, because rank cannot be read off a symbolic matrix: it depends on which entries happen to cancel.

How the Reduction Runs

The visualizer processes the columns from left to right, keeping a current row that starts at row 11 and moves down once per pivot.

Look for a pivot: scan the current column at and below the current row for a non-zero entry
Skip: if there is none, the column has no pivot; it is a free column, and the current row stays where it is
Swap: if the first non-zero entry is below the current row, swap the two rows to bring it up
Pivot: mark the entry as a pivot, count it, and record the column as a pivot column
Eliminate: for every non-zero entry below the pivot, subtract the right multiple of the pivot row so that entry becomes 00; one scene per row cleared
Done: when the columns or the rows run out, the matrix is in row echelon form, and the rank is the number of pivots

Only two kinds of row operation are used, swapping and adding a multiple of one row to another. Scaling a row is never needed to find the rank, and the pivots are left as they are rather than normalized to 11.

The Opening Scene: A on the Left, a Copy on the Right

The player opens with the matrix AA on the left and an identical copy RR on the right. AA will stay fixed for reference; RR is the working copy that the row operations transform.

Nothing has been reduced yet. What the scene fixes is the plan and the ceiling: the rank will be the number of pivots found, and it cannot exceed the smaller of the two dimensions.
A3×3123246101R3×3123246101
Opening scene, frozen

A on the left and its working copy R on the right, still identical. The rank will be the number of pivots found in R; the basis of the column space will be read from A.

Keeping the original in view matters at the end, because the pivot columns are found in RR but the basis of the column space is read from AA. Row operations preserve the row space and the rank, but they do change the column space, so the columns of RR are not the columns to keep.

There is no precondition on AA. Any matrix of any shape has a rank, including rectangular ones and the zero matrix.

Finding a Pivot

For each column in turn, the tool scans downward from the current row for a non-zero entry. The first one found becomes a pivot and its row becomes the pivot row.

The frozen picture below is the first pivot of the default preset: the 11 at row 11, column 11, marked in RR, with its row highlighted.
A3×3123246101R3×3123246101
First pivot, frozen

The 1 at row 1, column 1 marked as pivot number one, its row highlighted. A pivot certifies a column that is not a combination of the columns before it.

A pivot certifies a new independent direction. Column jj gets a pivot exactly when it is not a combination of the columns before it, so every pivot adds one to the dimension of the column space, and the final count is the rank.

The value of the pivot is irrelevant; only that it is non-zero. The tool leaves pivots unnormalized, since scaling a row to make its pivot 11 changes nothing about the count.

Eliminating Below the Pivot

Once a pivot is fixed, every non-zero entry below it in the same column is cleared: the row is replaced by itself minus the right multiple of the pivot row, one row per scene.

The frozen picture below is the first elimination of the default preset, R2R22R1R_2 \leftarrow R_2 - 2R_1, which turns row 22 into zeros because it was twice row 11 to begin with.
A3×3123246101R3×3123000101
First elimination, frozen

R2 ← R2 − 2·R1 has just turned row 2 into zeros: the elimination discovering that row 2 was twice row 1.

This is the operation that exposes dependencies. A row that is a combination of the rows above it is reduced to zero, and a zero row contributes no pivot. In the default preset, row 22 vanishes in one step, which is the elimination discovering that R2=2R1R_2 = 2R_1.

Adding a multiple of one row to another leaves the span of the rows unchanged: the new row is a combination of the old ones, and the old row can be recovered by subtracting the same multiple back. That is why the rank of RR is always the rank of AA.

Swapping Rows and Skipping Columns

Two things can interrupt the pattern. If the current row has a 00 in the current column but a lower row does not, the rows are swapped so the pivot can be taken from the current row. If every entry from the current row down is 00, the column has no pivot and is skipped.

The frozen picture below is the skipped third column of the default preset: the only remaining row has a 00 there, so the scan finds nothing and the column is free.
A3×3123246101R3×31230−2−2000
Skipped column, frozen

Column 3 scanned from the last remaining row and found to be 0 - no pivot, a free column. The rank stays at 2 and the nullity picks up its one.

A swap is bookkeeping: it reorders the rows and changes nothing about their span or their number of independent members. In the default preset the swap brings the 2-2 up from row 33 so the second pivot sits in row 22.

A skip is information. A skipped column is a linear combination of the pivot columns to its left, and it is exactly the kind of column that the rank-nullity theorem counts on the nullity side. Every skipped column raises the nullity by one and leaves the rank alone.

The Completed Reduction

The final scene shows RR in row echelon form with every pivot marked, the pivot columns highlighted in the original AA, and the rank in its own slot.

The frozen picture below is the default preset finished: two pivots, rank 22, pivot columns 11 and 22, and one free column.
A3×3123246101R3×31230−2−2000rank A2
Completed reduction, frozen

Echelon form with two pivots marked, the pivot columns lit in the original A, and rank 2 in its slot. Columns 1 and 2 of A are a basis of the column space; column 3 is free.

Three readings come from the one picture. The rank is the number of pivots, here 22. The pivot columns of AA, columns 11 and 22, are a basis of the column space. The free column, column 33, is a combination of the other two, and there is one of it, so the nullity is 11 and 2+1=32 + 1 = 3 is the number of columns.

Whether the matrix has full rank is now a glance: full rank means the pivot count reached min(m,n)\min(m, n). For a square matrix that is the same as being invertible, and for a rectangular one it means the columns, or the rows, whichever there are fewer of, are independent.

Reading the Scene Player

Each scene shows the original AA on the left and the current reduced matrix RR on the right, with the row operation in the caption.

• In a pivot scene, the pivot cell is accent and its row is primary
• In an eliminate scene, the pivot row is primary, the row being cleared is secondary, and the entry being turned into 00 is accent; the caption names the multiple subtracted
• In a swap scene, the two rows exchanging places are primary and secondary
• In a skip scene, the entries scanned and found to be zero are muted
• In the done scene, every pivot in RR is accent, the pivot columns of the original AA are highlighted, and the rank appears in its own slot
• Fractions that arise during elimination are shown as a/ba/b in a slightly smaller font

Choosing a Matrix

The six presets each make a different point.

Rank 2 of 3 — row 22 is twice row 11, so elimination wipes it out; the run shows a pivot, two eliminations, a swap, a second pivot, and a skipped column, which is every branch in one matrix
Full rank — three pivots in a 3×33 \times 3; the columns are independent and the matrix is invertible
Rank 1 — every row is a multiple of the first; one pivot, then everything below it cancels and the remaining columns are skipped
Wide 2×42 \times 4 — at most two pivots, however the entries are chosen; the rank is capped by the row count and at least two columns must be free
Tall 4×24 \times 2 — at most two pivots, capped by the column count; the extra rows reduce to zero
Zero matrix — no pivots at all, rank 00, and every column free

Editing entries by hand is the best way to see how fragile rank is: change one entry of the rank-1 preset and the rank jumps to 22.

What Rank Is

The rank of an m×nm \times n matrix AA is the dimension of its column space, the number of linearly independent columns. A fundamental theorem says this equals the dimension of the row space, the number of linearly independent rows, so rank can be found from either side.

Row reduction finds it. Row operations replace the rows of AA by combinations of the same rows, so the row space never changes, and neither does the rank. In echelon form the non-zero rows are visibly independent, one per pivot, so

rankA=number of pivots=number of non-zero rows in echelon form\operatorname{rank} A = \text{number of pivots} = \text{number of non-zero rows in echelon form}


The pivot columns tell the column-space story: the columns of the original AA in the pivot positions are a basis of the column space, and each free column is a combination of the pivot columns to its left.

The rank is bounded by both dimensions,

rankAmin(m,n)\operatorname{rank} A \leq \min(m, n)


and the rank-nullity theorem accounts for the rest of the columns:

rankA+nullityA=n\operatorname{rank} A + \operatorname{nullity} A = n


where the nullity, the dimension of the null space, is the number of free columns. For the full treatment, including rank and the four fundamental subspaces, see the matrix rank theory page.

Key Properties

Rank interacts with the matrix operations in a few standard ways.

Row rank equals column rank: the number of independent rows equals the number of independent columns
Bound: rankAmin(m,n)\operatorname{rank} A \leq \min(m, n), with equality called full rank
Transpose: rankAT=rankA\operatorname{rank} A^T = \operatorname{rank} A
Row operations: swapping, scaling by a non-zero number, and adding a multiple of one row to another all preserve rank
Product: rank(AB)min(rankA,rankB)\operatorname{rank}(AB) \leq \min(\operatorname{rank} A, \operatorname{rank} B)
Invertibility: a square n×nn \times n matrix is invertible exactly when rankA=n\operatorname{rank} A = n, equivalently detA0\det A \neq 0
Rank-nullity: rankA+nullityA=n\operatorname{rank} A + \operatorname{nullity} A = n
Rank 1: a non-zero matrix has rank 11 exactly when it is an outer product uvT\mathbf{u}\mathbf{v}^T
Zero: rankA=0\operatorname{rank} A = 0 only for the zero matrix

Why It Matters

Rank is the single number that says how much of the available space a matrix actually uses.

Solvability: Ax=bA\mathbf{x} = \mathbf{b} is consistent exactly when rankA=rank[Ab]\operatorname{rank} A = \operatorname{rank} [A \mid \mathbf{b}]; the solution is unique when the rank equals the number of unknowns
Linear independence: the columns of AA are independent exactly when the rank equals the number of columns, which is how a set of vectors is tested for independence in practice
Dimension of the image: the rank is the dimension of the set of all outputs AxA\mathbf{x}; a rank-deficient transformation flattens space
Invertibility: full rank is the condition for a square matrix to have an inverse
Data: the rank of a data matrix is the number of independent features, and low-rank approximation is the basis of compression and dimensionality reduction
Networks and systems: the rank of an incidence or controllability matrix decides whether a network is connected or a system can be steered

Worked Example

Take the default preset,

A=(123246101)A = \begin{pmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 1 & 0 & 1 \end{pmatrix}


Column 11: the entry 11 in row 11 is the first pivot. Clear below it with R2R22R1R_2 \leftarrow R_2 - 2R_1 and R3R3R1R_3 \leftarrow R_3 - R_1:

(123000022)\begin{pmatrix} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 0 & -2 & -2 \end{pmatrix}


Column 22: row 22 has a 00 but row 33 has 2-2, so swap R2R3R_2 \leftrightarrow R_3. The 2-2 is the second pivot, and there is nothing below it to clear:

(123022000)\begin{pmatrix} 1 & 2 & 3 \\ 0 & -2 & -2 \\ 0 & 0 & 0 \end{pmatrix}


Column 33: the only row left is row 33, and its entry is 00. No pivot; the column is free.

Two pivots, so rankA=2\operatorname{rank} A = 2. The pivot columns are 11 and 22, and columns (1,2,1)T(1, 2, 1)^T and (2,4,0)T(2, 4, 0)^T of the original AA form a basis of the column space. Column 33 is free: indeed (3,6,1)T=(1,2,1)T+(2,4,0)T(3, 6, 1)^T = (1, 2, 1)^T + (2, 4, 0)^T. The nullity is 32=13 - 2 = 1, and 2+1=32 + 1 = 3 as the rank-nullity theorem requires. Row 22 of AA was twice row 11, which is exactly the dependency the elimination exposed.

Common Mistakes

A few mistakes recur.

Counting non-zero rows of the original matrix — rank is read from the echelon form, not from AA; a matrix can have three non-zero rows and rank 11
Counting non-zero entries or columns — rank counts pivots, one per independent direction, not entries
Reading the pivot columns from RR instead of AA — the pivot positions are found in RR, but the basis of the column space is the columns of the original AA in those positions; row operations change the column space
Forgetting that a swap may be needed — a 00 in the current position does not mean the column is free; a non-zero entry lower down still gives a pivot
Expecting rank to exceed the smaller dimension — a 2×42 \times 4 matrix has rank at most 22, however its entries are chosen
Confusing rank with determinant — the determinant is a number defined only for square matrices; rank is defined for every matrix, and a zero determinant just says the rank is less than nn
Trusting floating point — with decimal entries, a value that should be 00 may come out as 101610^{-16}; this tool treats anything below 10910^{-9} as zero