Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Solve a system of linear equations by Gaussian elimination

Use when: you have a system of linear equations and need its full solution, not just whether one exists

Goal: the numeric value of every unknown

Taught in Row echelon form and Gaussian elimination

  1. 1

    Stack the system's coefficients into one matrix, with the constants as a final column.

    Example

    For the system x+y+z=6, 2x+2y-z=3, 3x-y+2z=7: \left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 2 & 2 & -1 & 3 \\ 3 & -1 & 2 & 7 \end{array}\right] Each row is one equation's coefficients, in variable order, with the constant term split off after the bar.

    Why: row operations on this single object are exactly equivalent to the algebra moves (adding a multiple of one equation to another) that solve the system by hand, but organized so nothing gets lost.

  2. 2

    Working left to right, use the replace operation to zero out every entry below the current column's leading entry.

    Example

    Row 1's leading entry is the 1 in column 1. Clear the 2 and 3 beneath it: R_2\to R_2-2R_1,\quad R_3\to R_3-3R_1 \ \Longrightarrow\ \left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 0 & 0 & -3 & -9 \\ 0 & -4 & -1 & -11 \end{array}\right] (2-2(1)=0, 2-2(1)=0, -1-2(1)=-3, 3-2(6)=-9 for row 2; 3-3(1)=0, -1-3(1)=-4, 2-3(1)=-1, 7-3(6)=-11 for row 3.)

    Why: this is the move that turns a tangled system into a staircase, one column at a time, without changing the solution set.

  3. 3

    If the entry where a pivot should be is 0, swap it with a row below that has a nonzero entry there.

    Example

    Moving to column 2, the entry where row 2's pivot should sit is now 0 (row 2 reads 0,\,0,\,-3,\,-9). Row 3 has a -4 in that same column, so swap them: R_2\leftrightarrow R_3 \ \Longrightarrow\ \left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 0 & -4 & -1 & -11 \\ 0 & 0 & -3 & -9 \end{array}\right]

    Why: scaling can never turn a 0 into a nonzero number, so a missing pivot needs a swap, not more elimination.

  4. 4

    Move one row and one column over and repeat the elimination step until the rows or the columns run out.

    Example

    After the swap, column 2's pivot is the -4 in row 2, and the only row left below it, row 3, already reads 0 in that column — nothing left to clear. With rows and columns both exhausted, the matrix above is already in row echelon form: every entry below every leading number is 0.

    Why: row echelon form is the target shape (zeros below every pivot, any all-zero rows at the bottom), and it's what makes back-substitution possible in the next step.

  5. 5

    Solve the last nonzero row for its one remaining unknown, substitute that value into the row above, and climb the staircase one row at a time.

    Example

    Row 3: -3z=-9\Rightarrow z=3. Substitute into row 2: -4y-z=-11\Rightarrow -4y-3=-11\Rightarrow -4y=-8\Rightarrow y=2. Substitute both into row 1: x+y+z=6\Rightarrow x+2+3=6\Rightarrow x=1. \boxed{(x,y,z)=(1,\,2,\,3)}

    Why: each row up the staircase has exactly one new unknown once the ones below it are known, so the whole system unravels one substitution at a time.

Common mistakes

  • Scaling a row to try to fix a 0 pivot instead of swapping in a row that actually has a nonzero entry there.
  • Eliminating a column out of order, before every entry above it has settled.
  • Forgetting to apply a row operation to the augmented column too, only updating the coefficient part.
  • Back-substituting top to bottom instead of bottom to top, before the last row's single unknown is known.