Matrix Rank: Definition, Formula & Example

Matrix rank is the number of linearly independent rows or columns in a matrix. It describes how many independent directions or pieces of information the matrix contains. The row rank and column rank of every matrix are equal, so both give the same matrix rank. In practical calculations, rank is commonly found by reducing a matrix to row echelon form or reduced row echelon form and counting its pivot positions. For an m×n matrix, the rank can never exceed min(m, n). A square n×n matrix has full rank when its rank is n, which is equivalent to having a nonzero determinant and an inverse. A lower rank indicates linear dependence and, geometrically, that the associated transformation collapses at least one dimension. Matrix rank is therefore central to solving linear systems, determining invertibility, analyzing linear transformations, and understanding the dimensions of row spaces, column spaces, and null spaces.
What Is Matrix Rank?
For a matrix A:
rank(A)
is the dimension of its row space or, equivalently, its column space.
Another practical definition is:
rank(A) = number of pivot positions after row reduction
For example:
A = [ 1 2 ]
[ 3 4 ]
has two independent rows and two independent columns.
Its rank is:
rank(A) = 2
By contrast:
B = [ 1 2 ]
[ 2 4 ]
has a second row equal to twice its first row.
Only one row direction is independent, so:
rank(B) = 1
The matrix contains four numerical entries, but only one independent row direction.
Matrix Rank Formula
There is no single arithmetic formula for rank comparable to the 2×2 determinant formula. Rank is characterized through several equivalent ideas.
For any m×n matrix:
rank(A) = dimension of row space
rank(A) = dimension of column space
rank(A) = number of pivots in echelon form
and:
rank(A) ≤ min(m, n)
For a square n×n matrix:
rank(A) = n
if and only if:
det(A) ≠ 0
The matrix determinant therefore gives a fast full-rank test for square matrices.
Maximum Possible Rank
If A is:
m×n
then:
rank(A) ≤ min(m, n)
For example, a:
3×5
matrix can have rank at most:
3
because it contains only three rows.
A:
6×2
matrix can have rank at most:
2
because it contains only two columns.
A matrix reaches its maximum possible rank when its rows or columns contain as many independent directions as its dimensions allow.
Full Rank
A matrix is called full rank when:
rank(A) = min(m, n)
For a square n×n matrix, full rank means:
rank(A) = n
For example, a 3×3 matrix is full rank if:
rank(A) = 3
For a rectangular 2×5 matrix, full rank means:
rank(A) = 2
The phrase therefore depends on the dimensions of the matrix.
Basic 2×2 Example
Find the rank of:
A = [ 2 1 ]
[ 3 4 ]
For a 2×2 matrix, one quick test is the determinant:
det(A) = 2(4) − 1(3)
= 8 − 3
= 5
Since:
det(A) ≠ 0
the matrix is invertible and full rank.
Therefore:
rank(A) = 2
No row reduction is necessary in this case.
2×2 Rank-One Example
Consider:
A = [ 2 6 ]
[ 1 3 ]
Its determinant is:
det(A) = 2(3) − 6(1)
= 0
So the matrix is not full rank.
The first row is twice the second row:
(2, 6) = 2(1, 3)
There is one independent nonzero row direction.
Therefore:
rank(A) = 1
The rank is not zero because the matrix itself is not the zero matrix.
Rank of the Zero Matrix
If every matrix entry is zero:
A = 0
then:
rank(A) = 0
For example:
A = [ 0 0 ]
[ 0 0 ]
has no nonzero independent rows or columns.
Therefore:
rank(A) = 0
The zero matrix is the only matrix with rank zero.
Finding Matrix Rank With Row Reduction
For larger or rectangular matrices, row reduction is usually the most practical method.
The procedure is:
- Use elementary row operations to obtain row echelon form or reduced row echelon form.
- Identify the pivot positions.
- Count the pivots.
That count is the rank.
The detailed final canonical form is developed through reduced row echelon form, but full reduction is not always necessary merely to determine rank.
Row Reduction Example
Find the rank of:
A = [ 1 2 3 ]
[ 2 4 6 ]
[ 1 1 1 ]
Start with:
[ 1 2 3 ]
[ 2 4 6 ]
[ 1 1 1 ]
Apply:
R₂ → R₂ − 2R₁
This gives:
[ 1 2 3 ]
[ 0 0 0 ]
[ 1 1 1 ]
Now:
R₃ → R₃ − R₁
giving:
[ 1 2 3 ]
[ 0 0 0 ]
[ 0 −1 −2 ]
Reorder the nonzero rows:
[ 1 2 3 ]
[ 0 −1 −2 ]
[ 0 0 0 ]
There are two pivot rows.
Therefore:
rank(A) = 2
Why Row Operations Preserve Rank
Elementary row operations include:
swapping two rows
multiplying a row by a nonzero scalar
adding a multiple of one row to another
These operations change the appearance of the matrix but do not change the number of independent row directions.
Therefore row reduction preserves rank.
This is why the rank of an echelon form is the same as the rank of the original matrix.
Pivots and Rank
A pivot is the leading nonzero position in a nonzero row of echelon form.
If an echelon form is:
[ 1 2 0 4 ]
[ 0 1 3 2 ]
[ 0 0 1 −1 ]
[ 0 0 0 0 ]
there are three pivot positions.
Therefore:
rank(A) = 3
The actual pivot values do not have to equal 1 unless the matrix is reduced further.
Only the number of pivot positions matters for rank.
Rank of a Rectangular Matrix
Consider:
A = [ 1 0 2 3 ]
[ 0 1 4 5 ]
This is a:
2×4
matrix.
Both rows are independent.
There are two obvious pivots in columns 1 and 2.
Therefore:
rank(A) = 2
Since:
min(2, 4) = 2
the matrix is full rank.
It cannot have rank 3 or 4 because there are only two rows.
Example With Rank 1
Consider:
A = [ 1 2 3 ]
[ 2 4 6 ]
[−3 −6 −9 ]
Every row is a scalar multiple of:
(1, 2, 3)
So only one independent row remains.
Therefore:
rank(A) = 1
The columns are also dependent in a way that produces exactly the same rank.
This equality between row rank and column rank is a fundamental theorem of linear algebra.
Row Rank Equals Column Rank
For every matrix:
dimension of row space = dimension of column space
Therefore there is no need to distinguish two different numerical ranks.
Both are called:
rank(A)
This is not obvious from the original matrix because rows and columns can live in vector spaces of different dimensions.
Nevertheless, the number of independent row directions always equals the number of independent column directions.
Column Space and Rank
If:
A = [ a₁ a₂ … aₙ ]
then the column space is the set of all linear combinations:
c₁a₁ + c₂a₂ + … + cₙaₙ
The rank tells us the dimension of this space.
For a matrix transformation:
y = Ax
the possible output vectors all lie in the column space of A.
Therefore:
rank(A)
equals the dimension of the transformation’s range.
This connects matrix rank directly with a linear transformation.
Rank and Matrix Multiplication
The matrix multiplication product satisfies:
rank(AB) ≤ min(rank(A), rank(B))
A product cannot contain more independent output directions than either factor can support.
Suppose A has rank 2 and B has rank 5.
Then:
rank(AB) ≤ 2
because A limits the product to at most two independent directions.
Likewise, if B first collapses information, multiplication by A cannot recreate the lost independent dimensions.
Example of Rank Loss Through Multiplication
Let:
A = [ 1 0 ]
[ 0 0 ]
This matrix has:
rank(A) = 1
For any compatible 2×2 matrix B:
rank(AB) ≤ 1
because A removes the second output coordinate.
For example, if:
B = [ 2 3 ]
[ 4 5 ]
then:
AB = [ 2 3 ]
[ 0 0 ]
which also has rank 1.
The rank restriction has a direct geometric interpretation.
Rank and Invertible Multiplication
If A is an invertible n×n matrix, then multiplying by A does not change the rank of a compatible matrix B:
rank(AB) = rank(B)
and, when dimensions permit:
rank(BA) = rank(B)
An invertible matrix changes coordinates or geometry without collapsing independent dimensions.
This is one reason the matrix inverse and full rank are equivalent properties for square matrices.
Rank and Matrix Inverse
A square n×n matrix has an inverse exactly when:
rank(A) = n
Therefore:
full rank → inverse exists
and:
rank(A) < n → inverse does not exist
For:
A = [ 1 2 ]
[ 2 4 ]
we found:
rank(A) = 1
Since the matrix is 2×2 but has rank less than 2:
A⁻¹
does not exist.
The matrix loses one independent dimension.
Rank and the Determinant
For an n×n matrix:
det(A) ≠ 0 ⇔ rank(A) = n
and:
det(A) = 0 ⇔ rank(A) < n
The determinant can therefore answer whether the matrix has full rank.
However, when:
det(A) = 0
the determinant alone does not tell us whether the rank is:
n − 1, n − 2, …
or even zero.
Row reduction is needed to determine the exact deficient rank.
Example: Determinant Zero but Rank 2
Consider:
A = [ 1 0 1 ]
[ 0 1 1 ]
[ 1 1 2 ]
The third row equals:
row 1 + row 2
so:
det(A) = 0
But the first two rows are independent.
Therefore:
rank(A) = 2
The determinant identifies the failure of full rank but does not distinguish rank 2 from rank 1 without additional analysis.
Rank and Linear Systems
A linear system can be written:
Ax = b
Rank helps determine whether the system is consistent and whether its solution is unique.
Compare:
rank(A)
with the rank of the augmented matrix:
rank([A | b])
If:
rank(A) ≠ rank([A | b])
the system is inconsistent.
If:
rank(A) = rank([A | b])
the system is consistent.
The number of variables then determines whether the solution is unique or contains free parameters.
The broader setup belongs to a system of linear equations.
Unique Solution Condition
Suppose A has n columns, so there are n unknown variables.
If:
rank(A) = rank([A | b]) = n
then the system has a unique solution.
Every variable corresponds to a pivot.
There are no free variables.
For a square coefficient matrix, this is equivalent to:
det(A) ≠ 0
and:
A is invertible
Infinite Solutions
If:
rank(A) = rank([A | b]) < n
the system is consistent but has at least one free variable.
Therefore it has infinitely many solutions.
For example, two independent equations involving three unknowns generally leave one free variable when the equations are consistent.
The rank measures how many independent constraints the system actually supplies.
No Solution
If:
rank(A) < rank([A | b])
the system has no solution.
A row-reduced augmented matrix might contain a row such as:
[0 0 0 | 1]
which represents:
0 = 1
This contradiction increases the augmented rank beyond the coefficient rank.
Rank and Nullity
For an m×n matrix A:
rank(A) + nullity(A) = n
This is the rank-nullity theorem.
The nullity is the dimension of the solution space to:
Ax = 0
So:
nullity(A) = n − rank(A)
If A has five columns and rank 3:
nullity(A) = 5 − 3
= 2
There are two independent directions in the null space.
Rank-Nullity Example
Suppose:
A
is a 3×5 matrix with:
rank(A) = 3
Then:
nullity(A) = 5 − 3
= 2
The transformation maps a five-dimensional input space into a range of dimension 3.
Two independent input directions are collapsed into the zero vector.
This creates a clear geometric interpretation of rank and nullity together.
Rank and Basis
The independent pivot columns of the original matrix can form a basis for its column space.
Likewise, the nonzero rows of an echelon form provide a basis for the row space.
The rank is therefore the number of vectors in such a basis.
This connects rank directly with basis and dimension.
A rank-three column space requires three independent basis vectors.
Pivot Columns
Suppose the reduced form of a matrix has pivots in columns:
1, 3, 5
Then:
rank(A) = 3
To build a basis for the original column space, use columns:
1, 3, 5
from the original matrix, not from the reduced matrix.
Row reduction preserves dependence relationships among columns sufficiently to identify pivot positions, but it changes the actual column vectors.
Rank and Eigenvalues
For an n×n matrix, rank is connected with the zero eigenvalue.
If zero is an eigenvalue, there is a nonzero vector v satisfying:
Av = 0v
so:
Av = 0
The null space is nontrivial.
Therefore:
nullity(A) > 0
and:
rank(A) < n
Thus:
zero eigenvalue ⇔ square matrix is rank deficient
For a full-rank square matrix, all eigenvalues are nonzero.
Rank of a Diagonal Matrix
For a diagonal matrix, rank is simply the number of nonzero diagonal entries.
Consider:
A = [ 3 0 0 ]
[ 0 0 0 ]
[ 0 0 −2 ]
There are two nonzero diagonal entries.
Therefore:
rank(A) = 2
The middle coordinate direction is collapsed.
Rank of an Identity Matrix
For the n×n identity matrix:
Iₙ
all n rows and columns are independent.
Therefore:
rank(Iₙ) = n
The identity matrix is full rank, invertible, and has determinant 1.
It loses no dimensions.
Rank of an Outer Product
Suppose u and v are nonzero vectors.
The outer product:
A = u****vᵀ
has rank:
1
Every column of A is a scalar multiple of u.
Therefore all columns lie along one independent direction.
If either vector is zero, the product becomes the zero matrix and its rank is zero.
Rank of a Matrix Sum
For same-sized matrices:
rank(A + B) ≤ rank(A) + rank(B)
Equality is not guaranteed.
For example, if:
B = −A
then:
A + B = 0
so:
rank(A + B) = 0
even when A and B individually have full rank.
The relationship between addition and rank is therefore less direct than the full-rank determinant test.
The underlying addition is handled through matrix operations.
Rank and Matrix Operations
Several matrix operations preserve rank.
Elementary row operations preserve rank.
Multiplication by an invertible matrix preserves rank.
Transposition preserves rank:
rank(Aᵀ) = rank(A)
Other operations can change rank.
For example, adding matrices or multiplying by singular matrices may increase or decrease the number of independent directions, subject to rank inequalities.
Rank of a Transpose
For every matrix:
rank(Aᵀ) = rank(A)
This is another expression of the equality between row rank and column rank.
Rows of A become columns of Aᵀ, yet the number of independent directions remains the same.
This equality applies whether A is square or rectangular.
Rank and Optimization
Matrices appear throughout optimization.
Rank conditions can determine whether constraints are independent, whether a local system has a unique solution, and whether derivative matrices contain redundant information.
For example, if several equality constraints have dependent gradient rows, the effective number of independent constraints is smaller than the number of equations written down.
Rank therefore measures structural independence rather than simply counting formulas.
Rank in Multivariable Calculus
In multivariable calculus, derivative matrices can describe how several outputs change with several inputs.
The rank of such a derivative matrix indicates how many independent output directions can be produced locally to first order.
A full-rank derivative has no local dimensional collapse in the relevant direction count.
A deficient rank signals that certain first-order changes are dependent.
This provides a natural bridge between calculus and linear algebra.
Rank and Local Transformations
Suppose a differentiable mapping is approximated locally by:
Δy ≈ AΔx
If A has full column rank, distinct small input directions remain independent at first order.
If A has deficient rank, some nonzero input displacement lies in the null space:
AΔx = 0
That displacement produces no first-order output change.
Thus rank tells us how much of the local input geometry survives the mapping.
Numerical Rank
In exact algebra, a number is either zero or nonzero.
In numerical computation, floating-point matrices may contain extremely small values caused by rounding.
A matrix can therefore be theoretically full rank but numerically behave almost like a rank-deficient matrix.
Practical algorithms often use a tolerance to decide whether a potential pivot is effectively zero.
This distinction matters when matrix entries come from measured or computed data rather than exact symbolic values.
Rank Versus Number of Nonzero Entries
Rank is not the number of nonzero entries.
Consider:
A = [ 1 2 ]
[ 2 4 ]
All four entries are nonzero.
Yet:
rank(A) = 1
because the rows and columns are dependent.
Conversely, the identity matrix contains many zero entries but has full rank.
Rank measures independence, not how many entries happen to be nonzero.
Rank Versus Number of Nonzero Rows Before Reduction
The number of nonzero rows in the original matrix does not necessarily equal rank.
For example:
[ 1 2 ]
[ 2 4 ]
contains two nonzero rows, but one is dependent on the other.
After row reduction:
[ 1 2 ]
[ 0 0 ]
only one nonzero pivot row remains.
Therefore:
rank = 1
Count nonzero rows only after obtaining an echelon form.
Common Matrix Rank Mistakes
A common error is counting nonzero entries instead of independent rows, columns, or pivots.
Another mistake is counting all nonzero rows in the original matrix without first checking dependence.
For a rectangular m×n matrix, rank cannot exceed:
min(m, n)
so any larger answer is automatically impossible.
Students may also assume determinant zero means rank zero. It only means a square matrix is not full rank.
When using row reduction to identify a basis for the column space, pivot columns must be selected from the original matrix.
Finally, full rank does not always mean rank equals the number of columns. For a wide matrix with more columns than rows, full rank is limited by the number of rows.
Frequently Asked Questions
What is matrix rank?
Matrix rank is the number of linearly independent rows or columns in a matrix.
How do you calculate matrix rank?
Row-reduce the matrix to echelon form and count the pivot positions.
What is the rank formula?
For an m×n matrix:
rank(A) ≤ min(m, n)
and rank equals the number of pivots or the dimension of either the row space or column space.
What is full rank?
A matrix is full rank when:
rank(A) = min(m, n)
What is the rank of a square invertible matrix?
For an invertible n×n matrix:
rank(A) = n
What does determinant zero tell you about rank?
For an n×n matrix:
det(A) = 0
means:
rank(A) < n
but it does not give the exact deficient rank.
Is row rank different from column rank?
No. Every matrix has equal row rank and column rank.
What is the rank of the zero matrix?
rank(0) = 0
What is the maximum rank of a 3×5 matrix?
min(3, 5) = 3
so its maximum rank is 3.
How is rank related to inverse existence?
An n×n matrix has an inverse exactly when:
rank(A) = n
How is rank related to a system of equations?
Rank determines how many independent constraints the system contains and helps distinguish unique solutions, infinitely many solutions, and inconsistent systems.
What is the rank-nullity formula?
For an m×n matrix:
rank(A) + nullity(A) = n
Does row reduction change matrix rank?
No. Elementary row operations preserve rank.
How can I check a rank calculation?
Verify the number of pivots in echelon form, check that it does not exceed min(m, n), and compare with determinant or inverse information when the matrix is square.



