Row Echelon Form - REF, RREF, and Rank

Row echelon form calculator that reduces any square matrix to upper-triangular REF or fully reduced RREF, then reads off the rank and the pivot count.

Updated: June 16, 2026 • Free Tool

Row Echelon Form

Pick 2x2, 3x3, or 4x4. The matching entry grid appears below.

REF stops at upper-triangular. RREF also scales pivots to 1 and clears the entries above them.

3x3 matrix A

Results

Row echelon form
0 pivots

Reduced matrix (REF)

Singular matrix

No

Pivots found

0

What Is a Row Echelon Form Calculator?

A row echelon form calculator reduces any square matrix to its REF or RREF using Gaussian elimination, and reports the rank and pivot count alongside the reduced matrix.

  • Linear algebra homework and exams: Verify Gaussian elimination on 2x2, 3x3, and 4x4 problems.
  • Solving linear systems by hand: Reduce the augmented matrix, then back-substitute the upper-triangular system.
  • Checking matrix invertibility: Use the pivot count to decide whether a matrix is singular.
  • Computer graphics and robotics: Test whether a 3x3 transform matrix is singular before inverting it.

The calculator accepts the matrix entries, runs Gaussian elimination with partial pivoting, and prints the result.

For the matching inverse and determinant view of the same 2x2 or 3x3 matrix, adjoint matrix calculator runs the cofactor expansion in one panel.

How the REF Algorithm Works

The calculator reads the matrix, picks a pivot in the first column, uses it to zero the entries below, then moves down and right to the next pivot column. It repeats the same three elementary row operations until the matrix is upper-triangular.

REF: for each pivot column j, pick m[r][j] != 0 with r >= current row, swap into place, then row_r -> row_r - (m[r][j] / pivot) * row_pivot. RREF: scale each pivot to 1 and sweep upward to clear the entries above.
  • A: The input square matrix, currently 2x2, 3x3, or 4x4 with real entries.
  • pivot: The first non-zero entry in a chosen column. Partial pivoting swaps rows to put the largest available pivot at the current row.
  • row operations: Swap two rows, multiply a row by a non-zero scalar, and add a multiple of one row to another. These three operations are the entire toolset the algorithm uses.
  • rank: The number of non-zero rows in the REF, which is the same as the number of pivots.
  • form selector: REF stops at upper-triangular; RREF also scales each pivot to 1 and clears the entries above it.

The algorithm picks the first column with a non-zero entry at or below the current row, swaps that row to the pivot position, and clears the entries directly below. For RREF, after the staircase is built, the calculator scales each pivot row so the pivot equals 1, then sweeps upward to clear the entries above each pivot.

Worked 3x3 example

A = [[2, 1, -1], [-3, -1, 2], [-2, 1, 2]]

Pick pivot 2 in (1,1) and use it to zero the entries below. Then pick pivot 0.5 in (2,2) and zero (3,2) = 2.

REF = [[2, 1, -1], [0, 0.5, 0.5], [0, 0, -1]]. Rank is 3.

Worked 2x2 example

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

Subtract 2 * row1 from row2 to zero out (2,1). Row2 becomes [0, 0].

REF = [[1, 2], [0, 0]]. Rank is 1, so the matrix is singular.

According to Wikipedia, a matrix is in row echelon form if all zero rows are at the bottom and the leading entry of each non-zero row is strictly to the right of the leading entry of the row above it, with the same three elementary row operations defining both REF and RREF.

When the next step is to solve the actual system instead of just reducing the matrix, elimination method calculator takes the REF and finishes with back-substitution.

Key Concepts Behind REF

Four ideas cover the entire pipeline from a raw matrix to the REF and RREF, and they are the same vocabulary any linear-algebra textbook uses.

Elementary row operations

The three legal moves are swapping two rows, multiplying a row by a non-zero scalar, and adding a multiple of one row to another. Every REF and RREF reachable from a matrix A is built from these three operations, in any order.

Pivot entries

A pivot is the first non-zero entry in a non-zero row of the REF. Pivots are the staircase corners of the upper-triangular shape, and their column positions are the pivot columns.

Rank of a matrix

The rank is the number of pivots in any REF of the matrix. Two matrices share the same REF if and only if they are row equivalent, and that is the working definition of 'same row space'.

REF vs RREF

REF is upper-triangular with pivots shifted to the right. RREF is the unique, fully reduced shape: every pivot equals 1 and every entry above a pivot is zero. RREF is what Gaussian-Jordan elimination produces.

These four ideas are the entire vocabulary this calculator uses. When the matrix is square and the rank equals the size, the original matrix is invertible. When the rank is less than the size, the matrix is singular and at least one row of the REF will be all zeros.

For the bigger picture of how the REF of the coefficient matrix connects to a solved system of equations, system of equations calculator is the natural next page.

How to Use This Calculator

Pick the matrix size, choose REF or RREF, type the matrix entries, and read the reduced matrix, rank, and pivot count in the right-hand panel. The numbers update on every keystroke.

  1. 1 Choose the matrix size: Select 2x2, 3x3, or 4x4 from the size selector.
  2. 2 Choose REF or RREF: Pick REF for the upper-triangular form or RREF for the fully reduced form.
  3. 3 Type the matrix entries: Real numbers and decimals are accepted. Empty fields are read as zero.
  4. 4 Read the reduced matrix: The result grid is the REF (or RREF) of the input.
  5. 5 Read the rank and pivots: The rank is the number of pivots in the reduced form.
  6. 6 Check the singular flag: If the matrix is singular (rank less than the matrix size), the singular flag is Yes.

Drop the singular matrix A = [[1, 2], [2, 4]] into the 2x2 grid. The REF is [[1, 2], [0, 0]], the rank is 1, and the singular flag is Yes. If the matrix is a coefficient matrix for a linear system, the singular flag tells you the system has either no solution or infinitely many, not a unique one.

After the calculator gives the upper-triangular matrix, substitution method calculator is a clean way to verify the back-substitution step by step.

Benefits of Using This Calculator

Row reduction is one of the few linear-algebra procedures that turns a messy system into a clean triangular shape, and the calculator keeps every step of the answer in one panel.

  • REF and RREF in one tool: Switch between the upper-triangular REF and the unique fully reduced RREF without reloading the page, so the user can compare both shapes on the same matrix.
  • Rank and pivots reported: The result panel shows the rank, the pivot count, and a singular-matrix flag, so the user reads off linear independence and invertibility at the same time as the reduced matrix.
  • 2x2, 3x3, and 4x4 support: A size selector covers the three square sizes that show up in homework, statics problems, and computer-graphics transforms.
  • Singular-matrix handling: When the matrix is singular the algorithm still finishes, leaving a row of zeros at the bottom of the reduced form, and the singular flag is Yes so the user does not chase a non-existent inverse.
  • Decimal-friendly arithmetic: Entries can be decimals, and the calculation runs in full double precision while the display is rounded to 4 decimal places.

The result panel is laid out so the reduced matrix, the rank, the pivot count, and the singular flag are visible together. That visual structure is the fastest way to learn the difference between REF and RREF. For a 3x3 matrix that is the Jacobian of a small structural system, the rank tells the user whether the system is statically determinate (rank 3) or under-constrained (rank less than 3) without running the matrix through a separate rank check.

When the same reduced matrix feeds the normal equations in a small regression problem, linear regression calculator closes the loop from row reduction to a fitted model.

Factors That Affect the Reduced Form

A handful of input choices and structural facts decide whether the reduced form is well-conditioned and whether the rank matches the matrix size.

Matrix size

The number of row operations grows with the square of the size. A 4x4 matrix needs more pivots and more arithmetic than a 2x2, so the chance of a sign or entry mistake is higher by hand.

Partial pivoting

Choosing the row with the largest available pivot avoids dividing by a tiny number, which would otherwise amplify floating-point error. The calculator does this by default.

Linear dependence of rows

If two rows are scalar multiples of each other, the reduction leaves a row of zeros at the bottom and the rank drops below the matrix size.

Zero first column

When the first column is all zero, the first pivot lands in the second column. The rank is unaffected, but the staircase shape starts further to the right.

Decimal precision

Output is rounded to 4 decimal places for display, but the calculation uses full double precision internally. Round only the final shown values when copying the result into a homework solution.

  • The calculator is restricted to 2x2, 3x3, and 4x4 square matrices. For 5x5 and larger the same algorithm applies, but the input grid gets unwieldy.
  • Numerical round-off can hide a singular matrix when the determinant is just above zero in floating point.

For a square matrix, the rank and the matrix size agree when the matrix is invertible. The calculator reports the rank directly so the user does not have to compute the determinant separately. If the matrix comes from a linear system Ax = b, the same algorithm applied to the augmented matrix [A | b] produces an REF whose back-substitution gives the solution, or shows that no unique solution exists.

According to Wolfram MathWorld, the rank of a matrix equals the number of pivots in any of its row echelon forms, and two matrices are row equivalent if and only if they share a row echelon form.

Row echelon form calculator showing a 3x3 input matrix and the reduced REF and RREF result panels with rank and pivot count
Row echelon form calculator showing a 3x3 input matrix and the reduced REF and RREF result panels with rank and pivot count

Frequently Asked Questions

Q: What is this form?

A: It is an upper-triangular shape a matrix reaches after Gaussian elimination. All zero rows sit at the bottom, the leading entry of each non-zero row is strictly to the right of the row above, and the entries below each leading entry are zero.

Q: How do you find the row echelon form of a matrix?

A: Pick a pivot in the first column with a non-zero entry, swap it to the top row, use it to clear the entries below, then move to the next column. Repeat the same three row operations until the matrix is upper-triangular. This calculator runs the algorithm automatically.

Q: What is the difference between REF and RREF?

A: REF is upper-triangular with pivots shifted to the right. RREF goes one step further: every pivot is scaled to 1 and every entry above a pivot is also cleared, which makes RREF unique for a given matrix while REF can vary by row scaling.

Q: What are the three row operations used here?

A: The three elementary row operations are swapping two rows, multiplying a row by a non-zero scalar, and adding a multiple of one row to another. Any REF and any RREF of a matrix A can be reached from A using only these three moves.

Q: How is REF used to solve a system of linear equations?

A: Apply Gaussian elimination to the augmented matrix [A | b] to reach REF, then back-substitute the upper-triangular system starting from the last row. The rank of A equals the rank of the augmented matrix, so a mismatch in rank means either no solution or infinitely many.

Q: Can a matrix have more than one REF?

A: Yes. Any non-zero scalar multiple of a pivot row is still a valid REF, so REF is not unique. RREF, on the other hand, is unique for a given matrix, which is why textbook examples and the calculator both report the RREF when the row reduction needs to be canonical.