Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Solve a System by Gaussian Elimination

Write the system as an augmented matrix and use row operations to clear every entry below the pivots. The result is a staircase (echelon form) whose last equation has one unknown, so you solve from the bottom up.

Recognize the task

Any system of linear equations, of any size: x+y+z=6x + y + z = 6, 2x+3y+z=112x + 3y + z = 11, x−y+2z=5x - y + 2z = 5; two equations in two unknowns; more unknowns than equations. Test: every unknown appears only to the first power, with no products of unknowns. Then elimination always works and also tells you when there is no solution.
The method is laid out in the Gaussian elimination lesson.

Two ways to do it

Echelon form, then back substitutionstandard
[A∣b]∼REF  ⇒  solve from the last row up[A \mid \mathbf{b}] \sim \text{REF} \;\Rightarrow\; \text{solve from the last row up}
Clear below each pivot only, then back-substitute. The least work by hand and by computer.
Gauss-Jordan to reduced formno back substitution
[A∣b]∼RREF  ⇒  read x off[A \mid \mathbf{b}] \sim \text{RREF} \;\Rightarrow\; \text{read } \mathbf{x} \text{ off}
Also clear above each pivot and scale it to 11; see Gauss-Jordan elimination. Useful when free variables appear.

Steps

StepOn x+y+z=6, 2x+3y+z=11, x−y+2z=5x + y + z = 6,\ 2x + 3y + z = 11,\ x - y + 2z = 5
1Write the augmented matrix. One row per equation, one column per unknown, the constants behind the bar (augmented matrix). Line up the unknowns in the same order in every row.[1116231111−125]\left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 2 & 3 & 1 & 11 \\ 1 & -1 & 2 & 5 \end{array}\right]
2Get a nonzero pivot in the top-left position. If the entry is 00, swap in a row below that has a nonzero entry in that column.pivot 11 already in place
3Clear every entry below the pivot. For each lower row use Ri−ai1a11R1→RiR_i - \frac{a_{i1}}{a_{11}}R_1 \to R_i, constants included.Elementary row operations ↗R2−2R1, R3−R1R_2 - 2R_1,\ R_3 - R_1: rows [0 1 −1∣−1][0\ 1\ {-1} \mid {-1}], [0 −2 1∣−1][0\ {-2}\ 1 \mid {-1}]
4Move one row down and one column right, and repeat. Stop when every row has been used or the rest are zero rows. A row [0⋯0∣d][0 \cdots 0 \mid d] with d≠0d \neq 0 means no solution.R3+2R2R_3 + 2R_2: [111601−1−100−1−3]\left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 0 & 1 & -1 & -1 \\ 0 & 0 & -1 & -3 \end{array}\right]
5Back-substitute and check. Solve the last row, then work upward (back substitution). Put the answer into the original equations.z=3, y=−1+3=2, x=6−2−3=1z = 3,\ y = -1 + 3 = 2,\ x = 6 - 2 - 3 = 1; check 1−2+6=51 - 2 + 6 = 5 ✓

Worked examples

Example 1 · two equations

2 × 2
x+2y=5, 3x+4y=6x + 2y = 5,\ 3x + 4y = 6
augmented rows [1 2∣5][1\ 2 \mid 5], [3 4∣6][3\ 4 \mid 6]
R2−3R1R_2 - 3R_1: [0 −2∣−9][0\ {-2} \mid {-9}]
clear below the first pivot
y=92, x=5−2⋅92=−4y = \frac{9}{2},\ x = 5 - 2 \cdot \frac{9}{2} = -4
bottom row first

Example 2 · a zero in the pivot position

row swap
[0127111621314]\left[\begin{array}{ccc|c} 0 & 1 & 2 & 7 \\ 1 & 1 & 1 & 6 \\ 2 & 1 & 3 & 14 \end{array}\right]
top-left entry is zero
R1↔R2R_1 \leftrightarrow R_2, then R3−2R1R_3 - 2R_1: [0 −1 1∣2][0\ {-1}\ 1 \mid 2]
swap, then clear column 1
R3+R2R_3 + R_2: [0 0 3∣9][0\ 0\ 3 \mid 9]
clear column 2
z=3, y=7−6=1, x=6−1−3=2z = 3,\ y = 7 - 6 = 1,\ x = 6 - 1 - 3 = 2
back substitution

Example 3 · a row of zeros appears

infinitely many
x+y+z=2, x+2y+3z=5, 2x+3y+4z=7x + y + z = 2,\ x + 2y + 3z = 5,\ 2x + 3y + 4z = 7
R2−R1, R3−2R1R_2 - R_1,\ R_3 - 2R_1: both give [0 1 2∣3][0\ 1\ 2 \mid 3]
rows 2 and 3 now equal
R3−R2R_3 - R_2: [0 0 0∣0][0\ 0\ 0 \mid 0]
zero row, no contradiction
z=t, y=3−2t, x=−1+tz = t,\ y = 3 - 2t,\ x = -1 + t
zz has no pivot: free
Run the same reduction on your own numbers in the linear systems calculator.

See it happen

Each equation of a 3×33 \times 3 system is a plane, and the solution is the point where all three meet. A row operation swaps one plane for a combination of two of them; the new plane still passes through that common point, so the solution never changes. Elimination keeps tilting planes until they line up with the axes one unknown at a time. Watch it step by step in the Gaussian elimination visualizer.

Common mistakes

Leaving out the constant

✗ R2−2R1R_2 - 2R_1 on [2 3 1∣11][2\ 3\ 1 \mid 11] gives [0 1 −1∣11][0\ 1\ {-1} \mid 11]
✓ the constant changes too: 11−2⋅6=−111 - 2 \cdot 6 = -1, so [0 1 −1∣−1][0\ 1\ {-1} \mid {-1}]

Wrong sign of the multiplier

✗ R3−2R2R_3 - 2R_2 on [0 −2 1∣−1][0\ {-2}\ 1 \mid {-1}] gives [0 −4 3∣1][0\ {-4}\ 3 \mid 1]
✓ the entry is −2-2, so add: R3+2R2=[0 0 −1∣−3]R_3 + 2R_2 = [0\ 0\ {-1} \mid {-3}]
The multiplier is minus (entry to clear) ÷ (pivot).

Reading the answer straight off echelon form

✗ last column (6,−1,−3)(6, -1, -3) as (x,y,z)(x, y, z)
✓ back-substitute: (1,2,3)(1, 2, 3); the first try fails x+y+z=6x + y + z = 6

Treating a zero row as no solution

✗ [0 0 0∣0][0\ 0\ 0 \mid 0]: "the system is inconsistent"
✓ it reads 0=00 = 0; only [0 0 0∣d][0\ 0\ 0 \mid d] with d≠0d \neq 0 means no solution