Linear Algebra

RREF Calculator

This RREF calculator row-reduces any matrix up to 6 × 7 to reduced row echelon form by Gauss–Jordan elimination, or to row echelon form (REF), in exact fractions with every row operation shown.

Try
Matrix

Up to 6 rows and 7 columns. Type whole numbers, decimals or fractions such as 2/3, or paste a block copied from a spreadsheet.

Tick this for an augmented matrix [A | b]: each row is an equation, the other columns are the coefficients of x₁, x₂, … and the result says whether the system has one, none or infinitely many solutions.

Reduce to

RREF clears every entry above and below each pivot (Gauss–Jordan elimination). REF stops once the entries below each pivot are 0 (Gaussian elimination).

Result

Reduced row echelon form: [[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3]]

Reduced row echelon form

rref[A∣b]=[100∣1010∣2001∣3]\operatorname{rref}[A \mid b] = \begin{bmatrix} 1 & 0 & 0 & \mid & 1 \\ 0 & 1 & 0 & \mid & 2 \\ 0 & 0 & 1 & \mid & 3 \end{bmatrix}

[[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3]]

Solution
x1=1,x2=2,x3=3x_{1} = 1, \; x_{2} = 2, \; x_{3} = 3
Type of solution
Exactly one solution
Rank of A (coefficients)
3
Rank of [A | b]Equal ranks mean the system is consistent.
3
Nullity of AUnknowns 3 − rank 3.
0
Size
3 equations, 3 unknowns

The system is consistent and every unknown has a pivot, so it has exactly one solution: x₁ = 1, x₂ = 2, x₃ = 3.

The unknowns are named x₁, x₂, x₃ in column order.

Step-by-step working (10 steps)
  1. Write the augmented matrix [A | b]

    Each row is one equation. The columns left of the bar hold the coefficients of the unknowns; the last column holds the constants.

    [12−1∣2231∣113−12∣7]\begin{bmatrix} 1 & 2 & -1 & \mid & 2 \\ 2 & 3 & 1 & \mid & 11 \\ 3 & -1 & 2 & \mid & 7 \end{bmatrix}
  2. R2 → R2 − 2R1

    Subtract 2 times row 1 from row 2 to make the entry in column 1 zero.

    [12−1∣20−13∣73−12∣7]\begin{bmatrix} 1 & 2 & -1 & \mid & 2 \\ 0 & -1 & 3 & \mid & 7 \\ 3 & -1 & 2 & \mid & 7 \end{bmatrix}
  3. R3 → R3 − 3R1

    Subtract 3 times row 1 from row 3 to make the entry in column 1 zero.

    [12−1∣20−13∣70−75∣1]\begin{bmatrix} 1 & 2 & -1 & \mid & 2 \\ 0 & -1 & 3 & \mid & 7 \\ 0 & -7 & 5 & \mid & 1 \end{bmatrix}
  4. R2 → −R2

    Multiply row 2 by −1 so that the pivot in column 2 becomes 1.

    [12−1∣201−3∣−70−75∣1]\begin{bmatrix} 1 & 2 & -1 & \mid & 2 \\ 0 & 1 & -3 & \mid & -7 \\ 0 & -7 & 5 & \mid & 1 \end{bmatrix}
  5. R1 → R1 − 2R2

    Subtract 2 times row 2 from row 1 to make the entry in column 2 zero.

    [105∣1601−3∣−70−75∣1]\begin{bmatrix} 1 & 0 & 5 & \mid & 16 \\ 0 & 1 & -3 & \mid & -7 \\ 0 & -7 & 5 & \mid & 1 \end{bmatrix}
  6. R3 → R3 + 7R2

    Add 7 times row 2 to row 3 to make the entry in column 2 zero.

    [105∣1601−3∣−700−16∣−48]\begin{bmatrix} 1 & 0 & 5 & \mid & 16 \\ 0 & 1 & -3 & \mid & -7 \\ 0 & 0 & -16 & \mid & -48 \end{bmatrix}
  7. R3 → −(1/16)R3

    Multiply row 3 by −1/16 so that the pivot in column 3 becomes 1.

    [105∣1601−3∣−7001∣3]\begin{bmatrix} 1 & 0 & 5 & \mid & 16 \\ 0 & 1 & -3 & \mid & -7 \\ 0 & 0 & 1 & \mid & 3 \end{bmatrix}
  8. R1 → R1 − 5R3

    Subtract 5 times row 3 from row 1 to make the entry in column 3 zero.

    [100∣101−3∣−7001∣3]\begin{bmatrix} 1 & 0 & 0 & \mid & 1 \\ 0 & 1 & -3 & \mid & -7 \\ 0 & 0 & 1 & \mid & 3 \end{bmatrix}
  9. R2 → R2 + 3R3

    Add 3 times row 3 to row 2 to make the entry in column 3 zero.

    [100∣1010∣2001∣3]\begin{bmatrix} 1 & 0 & 0 & \mid & 1 \\ 0 & 1 & 0 & \mid & 2 \\ 0 & 0 & 1 & \mid & 3 \end{bmatrix}
  10. Read off the solution

    The left part of the matrix is now the identity (plus any zero rows), so each row gives one unknown directly.

    x1=1,x2=2,x3=3x_{1} = 1, \quad x_{2} = 2, \quad x_{3} = 3

It also gives the rank, pivot columns and null space, and for an augmented matrix [A∣b][A \mid b] whether the system has one solution, none or infinitely many.

By Hira Noor, mathematicianLast reviewed Free, no sign-up, runs in your browserReport a problem

How to use this calculator

  1. Set the number of rows and columns, then type the entries or paste a block from a spreadsheet. Decimals and fractions such as −3/4 are kept exact.
  2. For a linear system, write one equation per row with the constant last, and tick the box so the last column is treated as constants. For 2x − y = 3, the row is 2, −1, 3.
  3. Leave the box unticked to analyze the matrix itself: rank, pivot columns, nullity and a basis for its null space.
  4. Choose RREF for the reduced row echelon form, or REF to stop at row echelon form as in Gaussian elimination.
  5. Read the result at the top, then follow the steps. Each step names one row operation, such as R2 → R2 − 3R1, and shows the matrix after it.

Formulas

Reduced row echelon form

[10∗001∗00001]\begin{bmatrix} 1 & 0 & * & 0 \\ 0 & 1 & * & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

Plain-text formula: [1, 0, ∗, 0; 0, 1, ∗, 0; 0, 0, 0, 1]

11
a pivot (leading 1): the first nonzero entry of its row
∗*
any number, in a column without a pivot (a free column)

The shape every RREF has: a staircase of pivots equal to 1, zeros above and below each pivot, and any zero rows at the bottom. The four rules are spelled out below.

Rank–nullity theorem

rank(A)+nullity(A)=n\operatorname{rank}(A) + \operatorname{nullity}(A) = n

Plain-text formula: rank(A) + nullity(A) = n

rank(A)\operatorname{rank}(A)
the number of pivots in the RREF
nullity(A)\operatorname{nullity}(A)
the dimension of the null space, the number of free columns
nn
the number of columns of A

For a matrix with n columns, the number of pivot columns plus the number of free columns is n. The nullity is the number of free variables in A·x = 0.

When does a system have solutions?

rank(A)=rank([A∣b])\operatorname{rank}(A) = \operatorname{rank}([A \mid b])

Plain-text formula: rank(A) = rank([A∣b])

A system is consistent exactly when the constants column is not a pivot column. Then it has one solution if rank(A) equals the number of unknowns, and infinitely many if it is smaller (the Rouché–Capelli theorem).

Reading the result

Each pivot marks a basic variable and each column without a pivot marks a free variable. In a system, the free variables can take any value, and the RREF rows give the basic variables in terms of them. That is why the general solution is written as a particular solution plus combinations of null space vectors.

A row of zeros on the left with a nonzero constant on the right, such as [0;0∣1][0 ; 0 \mid 1], means the equations contradict each other: no solution. A zero row with a zero constant just means one equation was a combination of the others.

The rank is the number of independent rows (equal to the number of independent columns). A square matrix is invertible exactly when its RREF is the identity matrix, which you can confirm with the inverse matrix calculator.

What is reduced row echelon form (RREF)?

Reduced row echelon form is the simplest matrix you can reach from a given matrix with row operations. A matrix is in RREF when it meets four rules: any rows of zeros are at the bottom; the first nonzero entry of every other row is 1, called a pivot or leading 1; each pivot is to the right of the pivot in the row above; and each pivot is the only nonzero entry in its column.

For example, [10201−3]\begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & -3 \end{bmatrix} is in RREF, but [14201−3]\begin{bmatrix} 1 & 4 & 2 \\ 0 & 1 & -3 \end{bmatrix} is not, because the 4 sits above the pivot in column 2. Every matrix has exactly one RREF, so it is a reliable way to compare answers, read off the rank and solve a system in one pass. That unique matrix is what this reduced row echelon form calculator returns by default.

Row echelon form vs reduced row echelon form

Row echelon form (REF) only asks for the staircase shape: zeros below each pivot. Reduced row echelon form also clears the entries above each pivot and makes every pivot 1. Gaussian elimination stops at REF and finishes with back substitution; Gauss–Jordan elimination keeps going to RREF so the answer can be read directly. Choose REF above and the page works as a row echelon form calculator: it runs Gaussian elimination and stops once every pivot has zeros below it.

For the system in the worked example below, the REF is [12−1∣201−3∣−7001∣3]\begin{bmatrix} 1 & 2 & -1 & \mid & 2 \\ 0 & 1 & -3 & \mid & -7 \\ 0 & 0 & 1 & \mid & 3 \end{bmatrix}. Back substitution gives z=3z = 3, then y=−7+3z=2y = -7 + 3z = 2, then x=2−2y+z=1x = 2 - 2y + z = 1: the same solution the RREF shows at once.

Rules for row echelon form (REF) and reduced row echelon form (RREF)
RuleREFRREF
Rows of zeros are at the bottomRequiredRequired
Each pivot is to the right of the pivot above itRequiredRequired
Entries below each pivot are 0RequiredRequired
Each pivot equals 1Optional (often used)Required
Entries above each pivot are 0Not requiredRequired
Unique for a given matrixNoYes
Method that produces itGaussian eliminationGauss–Jordan elimination

How to row reduce a matrix

Row reduction uses only three operations, and none of them changes the solutions of the system or the rank of the matrix. The table lists them with the notation the calculator uses in its steps.

Work one column at a time, left to right. (1) Find the leftmost column that has a nonzero entry at or below the current row; swap rows if needed to bring it into the pivot position. (2) Divide that row by the pivot so the pivot becomes 1. (3) Subtract multiples of the pivot row to make every other entry in the column 0: only the entries below for REF, above and below for RREF. (4) Move down one row and right to the next column, and repeat until you run out of rows or columns.

Doing this by hand, fractions appear quickly. The calculator keeps them exact, so you can compare each of its steps with your own working line by line. Each row operation is the same as multiplying on the left by an elementary matrix, which you can confirm with the matrix calculator.

The three elementary row operations
OperationNotationExample
Swap two rowsRi ↔ RjR1 ↔ R2 brings a nonzero pivot to the top
Multiply a row by a nonzero numberRi → kRiR2 → −R2 turns a pivot of −1 into 1
Add a multiple of one row to anotherRi → Ri + kRjR3 → R3 − 3R1 clears column 1 of row 3

RREF of an augmented matrix: one, none or infinitely many solutions

To solve a system, put the coefficients and constants in an augmented matrix [A∣b][A \mid b] and row reduce it. The last nonzero rows of the RREF tell you which of the three cases you are in, as the table shows. The examples above load one of each.

For x₁ + 2x₂ + x₃ = 4, 2x₁ + 4x₂ + 3x₃ = 11 and x₁ + 2x₂ = 1 (the Infinitely many solutions example), the RREF is [120∣1001∣3000∣0]\begin{bmatrix} 1 & 2 & 0 & \mid & 1 \\ 0 & 0 & 1 & \mid & 3 \\ 0 & 0 & 0 & \mid & 0 \end{bmatrix}. Column 2 has no pivot, so x₂ is free: x1=1−2x2x_1 = 1 - 2x_2, x3=3x_3 = 3, and every value of x₂ gives a solution.

If you would rather type the equations themselves, such as 2x − y = 3, the system of equations calculator builds the augmented matrix for you.

Reading the RREF of [A | b]
What the RREF showsRanksSolutions
A row [0 0 … 0 | c] with c ≠ 0rank A < rank [A | b]None: the system is inconsistent
A pivot in every coefficient columnrank A = rank [A | b] = number of unknownsExactly one
A coefficient column without a pivot, and no 0 = c rowrank A = rank [A | b] < number of unknownsInfinitely many, one free variable per non-pivot column

Rank, nullity and null space from the RREF

Untick the system box to analyze a matrix on its own. The rank is the number of pivots, the pivot columns of the original matrix form a basis for its column space, and each free column gives one vector of the null space: set that free variable to 1, the others to 0, and solve Ax→=0→A\vec{x} = \vec{0} from the RREF.

For the Rank of a 4 × 5 matrix example the RREF is [12013001110000000000]\begin{bmatrix} 1 & 2 & 0 & 1 & 3 \\ 0 & 0 & 1 & 1 & 1 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \end{bmatrix}. The pivots are in columns 1 and 3, so the rank is 2 and the nullity is 5 − 2 = 3, with null space basis (−2, 1, 0, 0, 0), (−1, 0, −1, 1, 0) and (−3, 0, −1, 0, 1). For a square matrix, the determinant calculator gives the same verdict: full rank exactly when det A ≠ 0.

RREF on a TI-84 or in Desmos

TI-84 Plus: press 2nd then x⁻¹ to open MATRIX, go to EDIT, choose [A], set the size and type the entries. On the home screen press 2nd, x⁻¹, go to MATH and choose rref(, then press 2nd, x⁻¹, choose [A] under NAMES, close the bracket and press ENTER. The same MATH menu has ref( for row echelon form. To see fractions, press MATH and choose ►Frac before ENTER.

Desmos: open the Desmos Matrix Calculator, create a matrix with New Matrix, type the entries, then press rref with the matrix name, for example rref(A).

Both show only the final matrix. Use this page to see the row operations that lead to it, the rank and the solution of the system.

Worked example

Solve a 3 × 3 system with Gauss–Jordan elimination

Solve x + 2y − z = 2, 2x + 3y + z = 11 and 3x − y + 2z = 7 (augmented matrix rows 1, 2, −1, 2 / 2, 3, 1, 11 / 3, −1, 2, 7).

  1. Column 1 already has a pivot of 1. R2 → R2 − 2R1 and R3 → R3 − 3R1 give rows (0, −1, 3 | 7) and (0, −7, 5 | 1).
  2. Column 2: R2 → −R2 makes the pivot 1, giving (0, 1, −3 | −7). Then R1 → R1 − 2R2 gives (1, 0, 5 | 16) and R3 → R3 + 7R2 gives (0, 0, −16 | −48).
  3. Column 3: R3 → −(1/16)R3 gives (0, 0, 1 | 3). Then R1 → R1 − 5R3 and R2 → R2 + 3R3 clear the rest of the column.
  4. The RREF is [1, 0, 0 | 1; 0, 1, 0 | 2; 0, 0, 1 | 3]. All three unknowns have pivots and there is no contradictory row.
  5. Check in the first equation: 1 + 2(2) − 3 = 2. The other two also hold.

Answer: Exactly one solution: x = 1, y = 2, z = 3 (shown as x₁, x₂, x₃). Both the coefficient matrix and the augmented matrix have rank 3. This is the calculator's default input, so its steps match the ones above.

Frequently asked questions

What is the difference between REF and RREF?

Row echelon form (REF) only needs zeros below each pivot, and the pivots need not be 1. Reduced row echelon form (RREF) also needs each pivot to be 1 with zeros above it. A matrix has many echelon forms but only one RREF.

Is the reduced row echelon form of a matrix unique?

Yes. Different sequences of valid row operations can pass through different intermediate matrices, but they always end at the same reduced row echelon form. The row echelon form is not unique.

How do I enter a system of equations?

Move all variables to the left and constants to the right, then write one row per equation with the coefficients in a fixed variable order and the constant last. Use 0 for a missing variable, then tick the augmented-matrix box.

How can I tell if a system has no solution or infinitely many?

Look at the RREF of the augmented matrix. A row that reads 0 = c with c not 0 means no solution. Otherwise, a coefficient column without a pivot means a free variable and infinitely many solutions; a pivot in every coefficient column means exactly one.

What does a free variable mean?

A free variable has no pivot in its column, so it can be any number. For example, x₁ + 2x₂ + x₃ = 4 together with x₃ = 3 leaves x₂ free: x₁ = 1 − 2x₂, so every choice of x₂ gives a solution.

Can the RREF calculator handle variables such as a or k?

No. Every entry must be a number, a decimal or a fraction. For a matrix with a parameter, row reduce by hand and note which values of the parameter make a pivot 0, then check those cases here with numbers.

How is the rank related to the determinant?

For a square n × n matrix, the rank is n exactly when the determinant is nonzero, and then the RREF is the identity matrix. A rank below n means det A = 0 and the matrix is singular.

What is RREF used for?

Solving systems of linear equations, finding the rank, a basis for the null space and column space, testing whether vectors are linearly independent, and finding an inverse by reducing [A | I] to [I | A⁻¹].

Matrix Calculator

Multiply, add and subtract matrices up to 6 × 6, plus determinant, inverse, transpose and powers, exactly.

Linear Algebra

Inverse Matrix Calculator

Exact inverses of 2x2 to 6x6 matrices by Gauss–Jordan elimination, with every row operation and a check.

Linear Algebra

Determinant Calculator

Exact determinants of 2x2 to 6x6 matrices by row reduction or cofactor expansion, with every step.

Linear Algebra

Step-by-Step Math Solver

Free worked solutions for equations, systems, inequalities, factoring, derivatives, integrals, limits and matrices.

Tools

Learn more: To see row reduction used on a real problem, read how to solve a system of three equations.

Sources and further reading

  1. Interactive Linear Algebra, Section 1.2: Row Reduction (opens in a new tab), Georgia Institute of Technology (Dan Margalit and Joseph Rabinoff)
  2. Solving Systems with Gaussian Elimination (Section 7.6, College Algebra 2e) (opens in a new tab), OpenStax, Rice University
  3. 18.06 Linear Algebra (Gilbert Strang) (opens in a new tab), MIT OpenCourseWare

Results are calculated in your browser with methods checked by automated tests, and are intended for learning and general use. For engineering, medical, financial, legal or safety-critical decisions, verify important values independently and follow the rounding rules your work requires. How accurate are these results?