Skip to main content
linear algebraalgebracalculatorguide

Matrix Rank Calculator: How to Find Rank with Row Echelon Form

·12 min read·Solvify Team

A matrix rank calculator finds the number of linearly independent rows or columns in a matrix by reducing it to row echelon form and counting the nonzero pivot rows. Rank tells you whether a system of linear equations has a unique solution, infinitely many solutions, or no solution at all, and it shows up throughout linear algebra courses, computer graphics, and data science dimensionality reduction. This guide walks through the row-reduction method step by step with full arithmetic, covers the determinant shortcut for square matrices, and includes worked examples for both full-rank and rank-deficient matrices. You'll also find common mistakes to avoid and practice problems with complete answers.

What Is the Rank of a Matrix?

The rank of a matrix is the maximum number of linearly independent rows it contains — equivalently, the maximum number of linearly independent columns. A matrix can be large in dimensions (say 5×5) yet have a small rank if many of its rows or columns are combinations of others. Rank is a single number between 0 and the smaller of the row count and column count: for an m×n matrix, 0 ≤ rank(A) ≤ min(m, n). A matrix with rank equal to min(m, n) is called full rank. A square n×n matrix with rank exactly n is invertible; a square matrix with rank less than n is called singular and has no inverse. Rank is not the same thing as the size of a matrix — a 4×4 matrix can easily have rank 2 if two of its rows are multiples of the other two.

Rank = the number of linearly independent rows = the number of linearly independent columns = the number of pivot positions once the matrix is reduced to row echelon form.

How Does a Matrix Rank Calculator Find Rank Using Row Echelon Form?

A matrix rank calculator works by applying Gaussian elimination to transform the matrix into row echelon form (REF) — a triangular-style layout where each row's first nonzero entry (its pivot) sits strictly to the right of the pivot in the row above it, and any all-zero rows sit at the bottom. Once a matrix is in row echelon form, the rank is simply the number of nonzero rows, which equals the number of pivots. The elimination process uses three legal row operations that never change the rank: swapping two rows, multiplying a row by a nonzero constant, and adding a multiple of one row to another. Because these operations preserve linear dependence relationships, the rank of the row-reduced matrix always equals the rank of the original matrix.

1. Step 1 — Find the first pivot

Scan column 1 from the top row down and find the first nonzero entry. If the entry in row 1 is zero but a lower row has a nonzero entry in column 1, swap rows so the nonzero value becomes the pivot.

2. Step 2 — Eliminate below the pivot

For every row below the pivot row, subtract a multiple of the pivot row so that the entry in the pivot's column becomes 0. Repeat until every entry beneath the pivot in that column is 0.

3. Step 3 — Move to the next column and repeat

Move one row down and one column to the right, and repeat the search for a nonzero pivot in the remaining submatrix. Continue until you run out of rows or columns.

4. Step 4 — Count the nonzero rows

Once no further pivots can be found, count the rows that are not entirely zero. That count is the rank of the matrix.

Row operations (swap, scale, add-a-multiple) never change rank. Row echelon form makes rank visible: it equals the number of nonzero rows.

Worked Example: Finding the Rank of a Full-Rank 3×3 Matrix

Consider A = [[1, 2, 3], [2, 5, 3], [1, 0, 8]]. This is a classic 3×3 matrix used to demonstrate full-rank row reduction. Since it is square, full rank here means rank 3.

1. Step 1 — Eliminate column 1 below the pivot

Pivot is a₁₁ = 1. R2 = R2 - 2R1: [2-2(1), 5-2(2), 3-2(3)] = [0, 1, -3] R3 = R3 - 1R1: [1-1(1), 0-1(2), 8-1(3)] = [0, -2, 5] Matrix is now: [[1, 2, 3], [0, 1, -3], [0, -2, 5]]

2. Step 2 — Eliminate column 2 below the pivot

Pivot is now the entry 1 in row 2, column 2. R3 = R3 + 2R2: [0+2(0), -2+2(1), 5+2(-3)] = [0, 0, -1] Matrix is now: [[1, 2, 3], [0, 1, -3], [0, 0, -1]]

3. Step 3 — Count the pivots

Every row has a nonzero leading entry: 1, 1, and -1. All three rows are nonzero, so rank(A) = 3. Since A is a 3×3 matrix with rank 3, it is full rank and invertible. This matches det(A) = 1(5·8-3·0) - 2(2·8-3·1) + 3(2·0-5·1) = 40 - 26 - 15 = -1, which is nonzero — confirming full rank.

Result: rank(A) = 3 for A = [[1,2,3],[2,5,3],[1,0,8]]. Three nonzero pivot rows, matching a nonzero determinant of -1.

Worked Example: Finding the Rank of a Rank-Deficient Matrix

Now consider B = [[1, 2, -1], [2, 4, 1], [3, 6, 3]]. Notice that column 2 is exactly twice column 1 (2 = 2·1, 4 = 2·2, 6 = 2·3) — a strong hint that this matrix will not be full rank.

1. Step 1 — Eliminate column 1 below the pivot

Pivot is b₁₁ = 1. R2 = R2 - 2R1: [2-2(1), 4-2(2), 1-2(-1)] = [0, 0, 3] R3 = R3 - 3R1: [3-3(1), 6-3(2), 3-3(-1)] = [0, 0, 6] Matrix is now: [[1, 2, -1], [0, 0, 3], [0, 0, 6]]

2. Step 2 — Eliminate column 3 below the pivot

Column 2 has no pivot available (both entries below row 1 are 0), so move to column 3, where row 2 has pivot 3. R3 = R3 - 2R2: [0-2(0), 0-2(0), 6-2(3)] = [0, 0, 0] Matrix is now: [[1, 2, -1], [0, 0, 3], [0, 0, 0]]

3. Step 3 — Count the pivots

Only two rows are nonzero: row 1 (pivot in column 1) and row 2 (pivot in column 3). Row 3 is entirely zero. So rank(B) = 2, even though B is a 3×3 matrix. This matches the column dependency we spotted at the start: column 2 = 2 × column 1, so the three columns span only a 2-dimensional space.

Result: rank(B) = 2 for a 3×3 matrix — one dimension short of full rank because column 2 = 2 × column 1.

Using the Determinant Shortcut for Square Matrices

For a square n×n matrix, there is a shortcut: compute the determinant. If det(A) ≠ 0, the matrix is automatically full rank, meaning rank(A) = n — no row reduction needed. If det(A) = 0, you know rank(A) < n, but the determinant alone does not tell you the exact rank; you still need row reduction (or checking smaller submatrix determinants) to find how far below n the rank actually falls.

1. Step 1 — Compute the determinant

For C = [[4, 2], [2, 1]]: det(C) = (4)(1) - (2)(2) = 4 - 4 = 0.

2. Step 2 — Since det = 0, confirm the rank is below n by row reducing

R2 = R2 - 0.5R1: [2-0.5(4), 1-0.5(2)] = [0, 0] Matrix is now: [[4, 2], [0, 0]]. Only one nonzero row, so rank(C) = 1, not 2.

Square matrix shortcut: det ≠ 0 means rank = n (full rank) instantly. det = 0 only tells you rank < n — row reduction finds the exact value.

Row Rank vs Column Rank: Why Are They Always Equal?

It may seem surprising, but for any matrix — square or not — the maximum number of linearly independent rows always equals the maximum number of linearly independent columns. This result is sometimes called the rank theorem, and it is why linear algebra courses can simply say "the rank" without specifying row rank or column rank. One way to see this intuitively: row reduction only ever combines and reorders rows, and the number of pivot columns it produces is exactly the number of independent columns in the original matrix, while the number of nonzero rows is the number of independent rows. Since both quantities come from the same set of pivots, they must match. For B = [[1, 2, -1], [2, 4, 1], [3, 6, 3]] from the earlier example, the row-reduced form has pivots in columns 1 and 3 — confirming that exactly 2 columns are independent, matching the 2 independent rows.

Row rank always equals column rank. This shared value is simply called the rank of the matrix — there is no separate 'row rank calculator' and 'column rank calculator.'

What Does Rank Tell You About a System of Equations?

For a system of linear equations Ax = b, rank determines exactly what kind of solution set you get. Compare rank(A), the coefficient matrix, to rank([A|b]), the augmented matrix with the constants attached as an extra column: if rank(A) < rank([A|b]), the system is inconsistent and has no solution. If rank(A) = rank([A|b]) = n (the number of unknowns), the system has exactly one solution. If rank(A) = rank([A|b]) < n, the system has infinitely many solutions, with n - rank free variables.

1. Step 1 — Set up the augmented matrix

Using coefficient matrix B = [[1, 2, -1], [2, 4, 1], [3, 6, 3]] with constants b = (4, 7, 10): [1, 2, -1 | 4] [2, 4, 1 | 7] [3, 6, 3 | 10]

2. Step 2 — Row reduce the augmented matrix

R2 = R2 - 2R1: [0, 0, 3 | -1] R3 = R3 - 3R1: [0, 0, 6 | -2] R3 = R3 - 2R2: [0, 0, 0 | 0] The last row becomes 0 = 0, which is always true — so rank([A|b]) = 2, matching rank(A) = 2.

3. Step 3 — Interpret the result

Since rank(A) = rank([A|b]) = 2 < 3 unknowns, the system has infinitely many solutions with 1 free variable (y). Contrast this with b = (4, 7, 9): the same steps give a final row of 0 = -1, an impossible equation. There, rank(A) = 2 but rank([A|b]) = 3, so the system has no solution at all.

Rank criterion for systems: no solution if rank(A) < rank([A|b]); one solution if both equal n; infinitely many if both equal but less than n.

Common Mistakes When Computing Matrix Rank

A handful of errors show up repeatedly when students compute rank by hand.

1. Mistake 1 — Confusing rank with matrix size

A 4×4 matrix does not automatically have rank 4. Rank depends on linear independence, not on the number of rows or columns present.

2. Mistake 2 — Forgetting to swap rows when a pivot position is zero

If the entry needed as a pivot is 0 but a row below it has a nonzero value in that column, you must swap rows before continuing — skipping this step produces an incorrect echelon form and a wrong rank.

3. Mistake 3 — Assuming det = 0 means rank = 0

det(A) = 0 only means rank(A) < n for a square matrix. The actual rank could be n-1, n-2, or any smaller value — it still requires row reduction to pin down.

4. Mistake 4 — Stopping row reduction too early

Rank must be read from a fully reduced echelon form. Stopping halfway through elimination can leave rows that look nonzero but would cancel to zero with one more operation, leading to an inflated rank count.

The most common rank error: reading off rank before elimination is complete. Always finish row reduction before counting pivots.

Practice Problems: Test Your Understanding of Matrix Rank

Work through these three problems, then check your row reduction against the answers below.

1. Problem 1 — Find rank(D) for D = [[2, 4], [1, 2]]

Answer: det(D) = (2)(2) - (4)(1) = 0, so rank < 2. R2 = R2 - 0.5R1 gives [0, 0]. Only 1 nonzero row remains, so rank(D) = 1.

2. Problem 2 — Find rank(E) for E = [[1, 0, 2], [0, 1, 1], [1, 1, 3]]

Answer: R3 = R3 - R1 - R2 gives [1-1-0, 1-0-1, 3-2-1] = [0, 0, 0]. Rows 1 and 2 remain nonzero and independent (pivots in columns 1 and 2), so rank(E) = 2.

3. Problem 3 — Is x - y = 3 and 2x - 2y = 6 consistent, and what is the rank of its coefficient matrix?

Answer: The coefficient matrix [[1, -1], [2, -2]] has row 2 = 2 × row 1, so rank = 1. The augmented matrix [[1, -1 | 3], [2, -2 | 6]] also has row 2 = 2 × row 1 (including the constant column), so its rank is also 1. Since both ranks equal 1, which is less than 2 unknowns, the system is consistent with infinitely many solutions — the two equations describe the same line.

Checking your work: whenever a computed rank looks too high, re-verify by fully reducing to echelon form and confirming each 'nonzero' row truly has a nonzero pivot.

Why Use a Matrix Rank Calculator for Step-by-Step Practice?

Row reduction by hand is easy to get wrong in the middle of a long matrix — one arithmetic slip in row 2 propagates into every row below it. A matrix rank calculator that shows each elimination step lets you check your own work line by line and catch exactly where an error crept in, rather than only seeing whether the final rank matches. Solvify's step-by-step solver and AI math tutor walk through row reduction, determinant shortcuts, and rank problems the same way this guide does, so you can verify homework, practice for exams, or get unstuck on a specific matrix without losing the reasoning behind each move.

Tags:
linear algebraalgebracalculatorguide

Get Homework Help Now

Join millions of students using our AI math solver for homework help. Get instant solutions to math problems, step-by-step explanations, and 24/7 homework assistance.

Available for iOS and Android devices