How To Find Rank In Matrix

7 min read

The rank of a matrix is one of the most fundamental concepts in linear algebra, serving as a bridge between abstract vector spaces and concrete computational methods. In practice, it quantifies the dimension of the vector space generated by the matrix's rows or columns, effectively telling you how much unique information the matrix actually holds. Whether you are solving systems of linear equations, analyzing data dimensionality in machine learning, or studying control theory, understanding how to determine matrix rank is an indispensable skill.

Understanding the Core Concept

Before diving into calculation methods, it is crucial to grasp what rank represents. On the flip side, for any matrix $A$ of size $m \times n$, the row rank is the maximum number of linearly independent row vectors, while the column rank is the maximum number of linearly independent column vectors. Even so, a foundational theorem in linear algebra states that these two values are always equal. This common value is simply called the rank of the matrix, denoted as $\text{rank}(A)$ or $r(A)$.

The rank provides critical insights:

  • Non-singularity: A square matrix $n \times n$ is invertible (non-singular) if and only if its rank is $n$ (full rank).
  • Solution Existence: For a linear system $Ax = b$, solutions exist if and only if $\text{rank}(A) = \text{rank}([A|b])$, where $[A|b]$ is the augmented matrix.
  • Dimension: The rank equals the dimension of the image (range) of the linear transformation represented by the matrix.

The theoretical maximum rank is $\min(m, n)$. A matrix achieving this maximum is said to have full rank; otherwise, it is rank-deficient.

Method 1: Gaussian Elimination (Row Echelon Form)

The most universal, algorithmic approach to finding rank is transforming the matrix into Row Echelon Form (REF) or Reduced Row Echelon Form (RREF) using elementary row operations. These operations—swapping rows, multiplying a row by a non-zero scalar, and adding a multiple of one row to another—do not change the row space of the matrix, preserving the rank.

Honestly, this part trips people up more than it should.

Step-by-Step Procedure

  1. Write the Matrix: Start with your $m \times n$ matrix $A$.
  2. Pivot Identification: Locate the leftmost non-zero column. This is your first pivot column.
  3. Row Swapping: If the top entry of the pivot column is zero, swap it with a row below that has a non-zero entry in that column.
  4. Normalize (Optional for REF): Scale the pivot row so the leading entry (pivot) becomes 1. This is required for RREF but optional for standard REF.
  5. Elimination: Use the pivot row to create zeros in all entries below the pivot (for REF) or above and below (for RREF).
  6. Repeat: Ignore the pivot row and rows above it. Move to the next column to the right and repeat steps 2–5 on the submatrix until no rows remain or all remaining entries are zero.
  7. Count Pivots: The number of non-zero rows (or pivot positions/leading 1s) in the final echelon form equals the rank.

Worked Example

Consider the matrix: $ A = \begin{bmatrix} 1 & 2 & 3 \ 2 & 4 & 6 \ 1 & 1 & 1 \end{bmatrix} $

Step 1: Pivot on $a_{11} = 1$. $R_2 \leftarrow R_2 - 2R_1$ $R_3 \leftarrow R_3 - R_1$

$ \begin{bmatrix} 1 & 2 & 3 \ 0 & 0 & 0 \ 0 & -1 & -2 \end{bmatrix} $

Step 2: Swap $R_2$ and $R_3$ to move the zero row to the bottom. $ \begin{bmatrix} 1 & 2 & 3 \ 0 & -1 & -2 \ 0 & 0 & 0 \end{bmatrix} $

Step 3: Normalize $R_2$ (multiply by -1). $ \begin{bmatrix} 1 & 2 & 3 \ 0 & 1 & 2 \ 0 & 0 & 0 \end{bmatrix} $

There are two non-zero rows. Because of this, $\text{rank}(A) = 2$ And it works..

This method works for any matrix, regardless of dimensions, and forms the basis of most computational linear algebra libraries.

Method 2: Determinants and Minors (Theoretical Approach)

For smaller matrices or theoretical proofs, the rank can be defined using minors. A minor is the determinant of a square submatrix obtained by deleting specific rows and columns The details matter here..

Theorem: The rank of a matrix $A$ is the order of the largest non-zero minor. Basically, it is the size of the largest square submatrix with a non-zero determinant That's the part that actually makes a difference..

Procedure

  1. Check if the matrix is a zero matrix. If yes, rank is 0.
  2. Calculate determinants of all $1 \times 1$ submatrices (individual entries). If any is non-zero, rank $\ge 1$.
  3. Calculate determinants of all $2 \times 2$ submatrices. If any is non-zero, rank $\ge 2$.
  4. Continue increasing the size $k$ until all $k \times k$ minors are zero. The rank is $k-1$.

Practical Limitation

While conceptually elegant, this method suffers from combinatorial explosion. A $5 \times 5$ matrix has 100 possible $3 \times 3$ submatrices. For an $m \times n$ matrix, the number of $k \times k$ submatrices is $\binom{m}{k}\binom{n}{k}$. This makes the minor method impractical for manual calculation on matrices larger than $3 \times 3$ or $4 \times 4$, though it remains vital for theoretical derivations And that's really what it comes down to..

Method 3: Singular Value Decomposition (SVD) — The Numerical Standard

In numerical computing (Python/NumPy, MATLAB, R, Julia), Singular Value Decomposition is the gold standard for determining rank, especially when dealing with floating-point arithmetic and noisy data.

Any real matrix $A$ can be decomposed as $A = U \Sigma V^T$, where $\Sigma$ is a diagonal matrix containing singular values $\sigma_1 \ge \sigma_2 \ge \dots \ge \sigma_r > 0$ Worth keeping that in mind..

The Rank Theorem for SVD: The rank of $A$ equals the number of non-zero singular values.

Why SVD is Preferred in Practice

  1. Numerical Stability: Gaussian elimination suffers from round-off errors. A value that is mathematically zero might appear as $10^{-16}$ due to floating-point precision. SVD handles this gracefully.
  2. Numerical Rank: In applied fields, we often define a tolerance threshold $\epsilon$. Singular values smaller than $\epsilon$ (relative to the largest singular value) are treated as zero. This reveals the "effective" rank of noisy data.
  3. Condition Number: The ratio $\sigma_1 / \sigma_r$ gives the condition number, indicating sensitivity to errors.

Python Example (Conceptual):

import numpy as np
A = np.array([[1, 2, 3], [2, 4, 6], [1, 1, 1]])
# Using SVD
U, s, Vt = np.linalg.svd(A)
# s contains singular values
rank = np.sum(s > 1e-10) # Apply tolerance
print(rank) # Output: 2

That number is the result of applying a tolerance. In exact arithmetic, the singular value decomposition would yield one exactly zero singular value for this matrix, so the rank would be unambiguous. But in floating-point arithmetic, the zero singular value might appear as something like 1e-16, and without a tolerance, the count could be misleading.

A more reliable approach in practice is to define a tolerance relative to the largest singular value:

tol = max(A.shape) * np.finfo(float).eps * s[0]
rank = np.sum(s > tol)

This accounts for the scale of the matrix and the precision of the computation. For the example matrix, the tolerance would be small enough that the true zero singular value is excluded, while the two positive singular values remain.

The choice of tolerance is not purely mechanical. In noisy datasets, a larger tolerance may be appropriate, because tiny singular values can reflect measurement error rather than genuine structure. In clean mathematical computations, one might simply count singular values greater than zero.

For many numerical linear algebra tasks, however, Gaussian elimination with partial pivoting is often used instead of SVD. It is computationally cheaper and gives rank directly from the number of non-zero pivots after row reduction. SVD becomes especially valuable when you need the full singular value spectrum, a pseudoinverse, or a low-rank approximation of a matrix Easy to understand, harder to ignore..

The evolution from minor-based rank to elimination to SVD shows a broader pattern in numerical computing: theoretical definitions are made practical through stable algorithms and careful handling of numerical error.

Conclusion: The rank of a matrix is a fundamental measure

What's New

Brand New

Connecting Reads

Up Next

Thank you for reading about How To Find Rank In Matrix. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home