Matrix Rank Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Introduction: Understanding matrix rank

The rank of a matrix is the number of linearly independent rows or columns it contains. In linear algebra, matrices are used to represent systems of linear equations and linear transformations. The rank tells you how many independent directions of information the matrix carries.

If the rank of an m by n matrix is equal to the smaller of m and n, the matrix is said to have full rank. Otherwise, it is rank-deficient, meaning that at least one row or column can be written as a linear combination of the others.

Formal definition and formulas for matrix rank

Matrix rank can be defined in several equivalent ways for a matrix A:

All of these numbers are equal, and that common value is the rank of A. In symbols, you will often see the notation rank(A) or rk(A).

The connection between matrix rank and the null space is captured by the Rank–Nullity Theorem. For a matrix A with n columns, we have:

rank ( A ) + nullity ( A ) = n

Here, nullity(A) is the dimension of the null space of A, that is, the number of independent solutions to A x = 0.

How to use: Entering a matrix for rank calculation

This matrix rank calculator accepts real-valued entries for a matrix up to size 3×3. You can use it for 2×2 or 3×3 matrices, and also for rectangular matrices such as 2×3 or 3×2, provided they fit within the 3×3 grid. Any empty fields you leave in the grid are treated as zeros.

The core of the matrix-rank computation is row reduction to a pivot-reduced form. The algorithm:

  1. Reads your entries into a 3×3 matrix, inserting 0 for any blank cell.
  2. Starts with the first row and first column, searching for a pivot (a nonzero entry) in that column.
  3. If necessary, swaps rows to bring a nonzero entry into the pivot position.
  4. Uses elementary row operations to normalize the pivot and create zeros elsewhere in its column.
  5. Moves to the next row and the next column to find the next pivot and repeats the process.
  6. Counts the pivot rows in the reduced matrix. This count is the rank.

Elementary row operations preserve the row space and the solution set of the associated system of linear equations. That is why they do not change the rank of the matrix.

Supported matrix sizes and matrix-rank input behavior

For this matrix rank calculator, the on-page grid always shows 3 rows and 3 columns, but you are not required to fill every box:

Interpreting blanks as zeros means that the calculator effectively works with a fixed 3×3 matrix whose unused entries are 0. For rank calculations this is equivalent to embedding your smaller matrix in a 3×3 matrix with extra zero rows or columns.

Row reduction method for calculating matrix rank

To see how this matrix rank calculator identifies pivots, suppose you have a 3×3 matrix A with entries aij:

A = [ [a11, a12, a13], [a21, a22, a23], [a31, a32, a33] ].

The calculator applies row operations such as:

These are the same steps you would follow by hand when solving a system of linear equations using Gaussian elimination. Once the matrix has pivot positions with zeros in the rest of their columns, the number of pivot rows equals the rank.

Numerical tolerance and zero rows in rank calculations

For a matrix rank computation, the implementation uses floating-point arithmetic. To decide whether an entry is effectively zero, the code compares its absolute value to a small tolerance. If all entries in a row are smaller than this tolerance in absolute value, that row is treated as a zero row and does not contribute to the rank.

This approach is standard in numerical linear algebra and helps avoid treating tiny rounding errors as genuine pivots. However, it also means that rows made up of very small numbers (for example, 1×10−12) can be treated as zero in borderline cases. See the limitations section below for more guidance.

Geometric interpretation of matrix rank

For matrix rank, you can think of the columns as vectors starting at the origin. All linear combinations of these column vectors form the column space. The rank of the matrix is precisely the dimension of this column space.

For small matrices, the geometric picture is intuitive:

Rank is also tied to the null space. If a matrix has rank 2 and 3 columns, then its nullity is 1. That means there is exactly one independent direction in which nonzero inputs are mapped to the zero vector. In practical terms, there is one free variable when solving A x = 0.

Interpreting the matrix rank calculator output

After you enter your matrix and run the matrix rank calculation, the tool returns a single integer: the rank of the matrix. Here is how to interpret that number:

For a square coefficient matrix in a linear system A x = b:

Worked examples: Matrix rank by row reduction

Example 1: Full-rank 2×2 matrix

Consider the 2×2 matrix

A = [ [1, 2], [3, 4] ].

In the calculator, you can enter:

Row reduction steps:

  1. Start with rows [1, 2] and [3, 4].
  2. Use R2 ← R2 − 3R1 to eliminate the first entry of the second row, giving R2 = [0, −2].
  3. Now the rows are [1, 2] and [0, −2]. Both rows are nonzero.

There are two pivot rows, so the rank is 2. Since this equals the size of the matrix, A is invertible and its columns are linearly independent.

Example 2: Rank-deficient 3×3 matrix

Consider the 3×3 matrix

A = [ [1, 2, 3], [2, 4, 6], [1, 1, 1] ].

Notice that the second row is exactly 2 times the first row, so those two rows are not independent. In the calculator, enter:

Row reduction steps:

  1. Use R2 ← R2 − 2R1 to eliminate the first entry in row 2. This gives R2 = [0, 0, 0].
  2. Use R3 ← R3 − R1 to simplify row 3. This gives R3 = [0, −1, −2].
  3. Now the rows are [1, 2, 3], [0, 0, 0], [0, −1, −2].
  4. Swap rows 2 and 3 to bring the nonzero row up if you prefer the standard echelon form.

There are two nonzero rows in the echelon form, so the rank is 2. The matrix is not full rank. This tells you that:

Comparison of matrix rank with related concepts

For a matrix rank calculation, rank is closely connected to other familiar matrix properties. The table below summarizes some key relationships for square matrices.

Concept What it measures Relation to rank
Determinant A scalar summarizing volume scaling and orientation. A square matrix has full rank if and only if its determinant is nonzero.
Invertibility Whether there exists a matrix A−1 such that A A−1 = I. A is invertible exactly when it has full rank (rank equals its size).
Null space All vectors x with A x = 0. The dimension of the null space is the number of columns minus the rank.
Linear independence Whether a set of vectors contains no nontrivial linear relations. The rank equals the maximal number of linearly independent rows or columns.
Solutions of A x = b Consistency and number of solutions. Rank helps determine whether the system has zero, one, or infinitely many solutions.

Limitations and assumptions of this matrix rank calculator

This matrix rank calculator is designed as a quick, educational tool for small matrices. Keep the following points in mind when interpreting the results:

As long as you are aware of these assumptions, the rank reported by the calculator is a reliable guide to linear independence and the structure of your system.

Enter matrix entries to compute the rank.

Arcade Mini-Game: Matrix Rank Calculator Calibration Run

Use this quick arcade run to identify matrix-entry positions and avoid distractions before checking a rank result.

Score: 0 Timer: 30s Best: 0

Start the game, then use your pointer or arrow keys to catch matrix entries and avoid unrelated assumptions.