DigitHelm

Matrix RREF Calculator

Reduce any matrix to Row Reduced Echelon Form (RREF) using Gauss-Jordan elimination. Shows pivot positions, rank, and step-by-step row operations.

Rows:
Cols:

The last column is the right-hand side b. Enter your system as [A | b].

What Is the Matrix RREF Calculator?

The RREF Calculator reduces any matrix to Row Reduced Echelon Form (RREF) using Gauss-Jordan elimination with partial pivoting for numerical stability. RREF is the unique canonical form of a matrix, every invertible matrix has exactly one RREF, and for augmented systems it directly reveals the solution type and solution values.

  • Any size: supports matrices from 2×2 up to 5×6, suitable for systems with up to 5 equations and 5 unknowns (plus augmented column).
  • Augmented matrix mode: tick [A|b] to display a vertical separator between coefficient and right-hand-side columns.
  • Solution type detection: automatically classifies the system as unique solution, infinitely many solutions, or inconsistent.
  • Pivot tracking: highlighted orange cells mark each leading 1 so you can read basic and free variables at a glance.
  • Row operation log: every swap, scale, and elimination step is shown with exact symbolic notation.
  • Partial pivoting: selects the row with the largest absolute value in each column to minimise floating-point round-off errors.

Formula

Gauss-Jordan Elimination → RREF
Three elementary row operations applied until every pivot = 1 and every pivot column has zeros elsewhere
Row OperationSymbolEffect on det
Swap two rowsRᵢ ↔ RⱼSign negated (×−1)
Multiply row by nonzero scalar kRᵢ → k·RᵢMultiplied by k
Add k × row j to row iRᵢ → Rᵢ + k·RⱼUnchanged

How to Use

  1. 1Choose the number of rows and columns using the dimension buttons (2–5 rows, 2–6 columns).
  2. 2Tick "Augmented [A|b]" if your matrix represents a linear system, the last column is the right-hand side b.
  3. 3Enter each matrix entry (blank cells are treated as 0).
  4. 4Click "Reduce to RREF", or press Enter, to compute the result.
  5. 5Read the rank and pivot column list. For augmented matrices, read the solution type.
  6. 6Check the RREF matrix: orange highlighted cells are the leading 1s (pivots). Columns without a pivot contain free variables.
  7. 7Expand "Row operations" to see every elementary row operation applied, in order.

Example Calculation

Example 1, Unique solution (2 equations, 2 unknowns)

Augmented matrix [A|b]: [ 2 3 | 8 ] [ 5 1 | 7 ] Step 1, Scale R1: R1 ÷ 2 [ 1 1.5 | 4 ] [ 5 1 | 7 ] Step 2, Eliminate below: R2 − 5·R1 [ 1 1.5 | 4 ] [ 0 −6.5 | −13 ] Step 3, Scale R2: R2 ÷ (−6.5) [ 1 1.5 | 4 ] [ 0 1 | 2 ] Step 4, Eliminate above: R1 − 1.5·R2 [ 1 0 | 1 ] [ 0 1 | 2 ] RREF → x = 1, y = 2 (Rank = 2, unique solution)

Example 2, Infinite solutions (rank < variables)

[ 1 2 3 | 6 ] [ 2 4 6 | 12 ] [ 0 1 1 | 3 ] R2 − 2·R1 → row of zeros RREF: [ 1 0 1 | 0 ] [ 0 1 1 | 3 ] [ 0 0 0 | 0 ] Rank = 2, variables = 3 → 1 free variable (z) Solution: x = −z, y = 3 − z, z free

Augmented matrix tip

For a system of n equations with n unknowns, enter an n×(n+1) matrix. The first n columns are the coefficients of x₁, x₂, …, xₙ. The last column is the right-hand side. If RREF shows a row like [0 0 … 0 | c] where c ≠ 0, the system has no solution.

Understanding Matrix RREF

What RREF Reveals About a Linear System

RREF is more than a computational result, it is a complete diagnostic of the linear structure of the matrix. Once a matrix is in RREF, every question about the associated linear system has an immediate answer:

  • Rank: the number of pivot positions equals the rank, the dimension of the column space and row space of A.
  • Solution type: if rank equals the number of variables and the system is consistent, there is exactly one solution. If rank is less than the number of variables, there are free variables and infinitely many solutions.
  • Null space (kernel): the free variables directly give the null space basis, set each free variable to 1 (others to 0) and read off the values of basic variables.
  • Linear independence: the row vectors of the original matrix are linearly independent if and only if rank = number of rows.
  • Matrix invertibility: a square n×n matrix is invertible iff its RREF is the identity matrix Iₙ (rank = n).

RREF vs REF, The Key Distinction

Row Echelon Form (REF) requires only that each pivot lies to the right of the pivot in the row above (staircase pattern), and that pivots are nonzero. RREF adds two further requirements: each pivot must equal exactly 1, and every other entry in a pivot column must be zero (not just entries below the pivot).

  • REF is not unique, there are many valid row echelon forms for a given matrix.
  • RREF is unique, there is exactly one reduced row echelon form for any matrix.
  • Gaussian elimination produces REF; Gauss-Jordan continues to produce RREF.
  • Both algorithms have the same computational complexity O(n³) for dense matrices.

Using RREF to Compute the Inverse

The inverse of a square matrix A can be computed by forming the augmented matrix [A | I] (where I is the identity) and reducing to RREF. When the left half becomes I, the right half becomes A⁻¹. If the left half cannot be reduced to I (the matrix is singular), no inverse exists.

  • Form [A | I], a 3×3 matrix gives a 3×6 augmented matrix.
  • Apply RREF. If rank(A) = n, left block becomes I and right block becomes A⁻¹.
  • If a zero row appears in the left block, A is singular, stop, no inverse.

Numerical Stability and Partial Pivoting

This calculator uses partial pivoting, at each step it selects the row with the largest absolute value in the current column as the pivot row. This strategy minimises the amplification of floating-point rounding errors, which can otherwise accumulate to produce nonsensical results for ill-conditioned matrices.

  • Without pivoting, dividing by a very small pivot magnifies round-off errors dramatically.
  • Partial pivoting bounds the growth factor, keeping errors proportional to machine precision.
  • Near-zero values below 10⁻¹⁰ are snapped to exactly zero to prevent spurious non-zero entries.

Frequently Asked Questions

What is RREF and why is it useful?

RREF stands for Row Reduced Echelon Form, the unique simplest form of a matrix obtained by Gauss-Jordan elimination. A matrix is in RREF when:

  • Every leading (leftmost nonzero) entry in each row is 1 (called a pivot)
  • All other entries in each pivot column are 0
  • Each pivot lies strictly to the right of the pivot in the row above
  • All zero rows are at the bottom

RREF is useful because reading solutions to a linear system from it is trivial, no back substitution needed. Pivot columns correspond to basic variables (determined); non-pivot columns correspond to free variables (arbitrary).

How do I read the solution to a linear system from RREF?

For an augmented matrix [A|b] reduced to RREF:

  • Each row with a pivot gives one equation: basic variable = (linear combination of free variables) + constant from last column
  • Non-pivot columns correspond to free variables, assign them parameter names (s, t, etc.)
  • Substitute the parameters back to express all basic variables
  • A row [0 0 … 0 | c] with c ≠ 0 means the system is inconsistent (no solution)

Example: RREF = [[1,0,2|3],[0,1,−1|1]] with 3 variables means x₁ = 3−2x₃, x₂ = 1+x₃, x₃ free. Set x₃ = t to get the full solution family.

What is the rank of a matrix and how does RREF show it?

The rank is the number of linearly independent rows (and columns), equivalently, the number of pivot positions in the RREF. This calculator displays the rank directly after computing the RREF.

  • Rank = number of nonzero rows in RREF = number of pivot columns
  • For an m×n matrix: rank ≤ min(m, n)
  • Full rank means rank = min(m, n): no redundant rows or columns

The Rank-Nullity Theorem states: rank(A) + nullity(A) = n (number of columns). The nullity is the number of free variables, i.e., how many parameters the solution family has.

What does it mean when RREF has a row of all zeros?

A row of all zeros in the RREF of a coefficient matrix (without augmentation) means the original rows were linearly dependent, one row was a combination of the others. This reduces the rank.

For an augmented matrix [A|b], a zero row means:

  • If the entire row is zero (including the last entry): a redundant equation, it provides no information and is simply removed from consideration.
  • If the row is [0 0 … 0 | c] with c ≠ 0: an inconsistent equation (0 = c), the system has no solution.

The 3×3 matrix [[1,2,3],[2,4,6],[3,6,9]] has RREF with two zero rows because all rows are multiples of [1,2,3], rank 1.

How can I use the RREF calculator to find a matrix inverse?

Form the augmented matrix [A | I] where I is the n×n identity matrix. Enter this as a matrix with 2n columns (disable augmented mode or use it with awareness that the split is now at column n, not n+1).

  • For a 2×2 matrix A, enter a 2×4 matrix: [A | I₂]
  • For a 3×3 matrix A, enter a 3×6 matrix: [A | I₃]
  • If RREF produces [I | B], left block is identity, then B = A⁻¹
  • If the left block has a zero row, A is singular and no inverse exists

This is computationally equivalent to solving Ax = eᵢ for each standard basis vector eᵢ simultaneously, which is exactly what the augmented Gauss-Jordan method does.

What is the difference between Gaussian elimination and Gauss-Jordan?

Both algorithms use elementary row operations to simplify a matrix. The difference is how far the process goes:

  • Gaussian elimination produces Row Echelon Form (REF): pivots are nonzero (not necessarily 1), and entries below each pivot are zero. Back substitution is still needed to solve the system.
  • Gauss-Jordan elimination extends Gaussian elimination by also zeroing entries above each pivot and scaling pivots to 1, producing RREF. No back substitution is needed.

Gauss-Jordan requires approximately 50% more operations than Gaussian elimination for solving linear systems, but produces a result that is directly readable. For computing matrix inverses and RREF, Gauss-Jordan is the natural choice.

Can RREF be used to find the null space of a matrix?

Yes, the null space (kernel) of a matrix A is the set of all vectors x such that Ax = 0. To find it:

  • Compute RREF of A (not augmented, or augmented with zero b column)
  • Identify free variable columns (non-pivot columns)
  • For each free variable, set it to 1 and all other free variables to 0
  • Solve for the basic variables using the pivot equations
  • Each resulting vector is a basis vector of the null space

The number of free variables equals the nullity, the dimension of the null space. If RREF = I (identity), the null space contains only the zero vector, confirming the matrix is injective (one-to-one).

Related Calculators