4.5.9 · D3Linear Algebra (Full)

Worked examples — Gaussian elimination — forward elimination, back substitution

3,134 words14 min readBack to topic

This is the workbench child of the parent note. The parent told you the rules; here we play every hand the game can deal. Before a single example, we lay out a matrix of all the situations elimination can throw at you — then we hunt down each one.


The scenario matrix

Every linear system you feed to elimination lands in one of these cells. The last column names the example that nails it.

# Case class What's special Outcome you'll see Example
C1 Clean square system every pivot nonzero as-is unique solution Ex 1
C2 Zero pivot, swap fixes it diagonal pivot but a lower row has a nonzero unique solution after swap Ex 2
C3 Tiny pivot (stability) pivot , division blows up round-off swap for accuracy Ex 3
C4 Inconsistent a row becomes no solution Ex 4
C5 Free variable / infinite a row becomes infinitely many Ex 5
C6 Negative & fractional pivots signs and fractions everywhere unique, sign discipline Ex 6
C7 Rectangular (: rows columns) over- () and under-determined () rank tells the story Ex 7a, 7b
C8 Word problem (real units) translate → solve → interpret numeric answer with units Ex 8
C9 Exam twist (unknown parameter) a letter in the matrix condition on for each outcome Ex 9

We'll cover every cell. Cells C4/C5/C9 connect to Solving Linear Systems — Consistency; C7 to Rank of a Matrix; C3 to Pivoting and Numerical Stability.

Figure — Gaussian elimination — forward elimination, back substitution

Ex 1 — Clean square system (cell C1)

Forecast: every pivot is already nonzero, so we should march straight down with no swaps and land on one unique triple. Guess whether the numbers are "nice" (they are).

Augmented matrix:

  1. Pivot ; clear column 1. so ; so . Why this step? We want the and the under the pivot to become — the multiplier is exactly "how many pivot-rows cancel them."
  2. Pivot ; clear below. so . Why this step? Kill the in column 2 so only the last variable survives in row 3.
  3. Back-substitute (bottom-up). Why bottom-up? Only the last row has a single unknown.
    • Row 3: .
    • Row 2: .
    • Row 1: .

Answer: .

Worked example Verify

Row 3 original: ✓.


Ex 2 — Zero pivot, swap saves the day (cell C2)

Forecast: position is — you cannot divide by it. Predict that a row swap is forced (not optional), and after it we get a unique solution.

  1. Swap . Why this step? A pivot must be nonzero; row 2 offers a clean in column 1.
  2. Pivot ; clear column 1. Only needs work: , . Why this step? Zero out the below the pivot.
  3. Pivot ; clear below. so . Why this step? A negative multiplier means we add the pivot row — the "" template handles the sign automatically.
  4. Back-substitute. Row 3: . Row 2: . Row 1: .

Answer: .

Worked example Verify

Row 1 original (): ✓. Row 3 original: ✓.


Ex 3 — Tiny pivot, swap for accuracy (cell C3)

Forecast: the pivot is legal (nonzero) but tiny. Dividing by it makes the multiplier huge and round-off eats the answer. Predict: partial pivoting (swap in the bigger entry) is the fix — see Pivoting and Numerical Stability.

  1. Naive way (no swap). , :
    • new
    • new RHS . Round to 3 sig figs: . Then . Here it's still ok, but with more digits lost the small pivot amplifies error.
  2. Stable way (swap first). Why this step? Put the largest column-1 entry on top so the multiplier is and round-off can't blow up. , : , RHS . Back-sub: ; .

Answer (true value): . Exact system: . Subtract: , and .

Worked example Verify

: eqn 1 ✓; eqn 2 ✓.


Ex 4 — Inconsistent system, no solution (cell C4)

Forecast: the left column of row 2 is exactly times row 1's — the coefficients are proportional but the RHS is not. Predict a row of the form with : no solution.

  1. Clear column 1. , . Why this step? Standard elimination; the negative multiplier means add.
  2. Read the bottom row. It says , i.e. — impossible. Why does this reveal contradiction? Elimination only makes nonzero when the equations genuinely disagree.

Answer: Inconsistent — no solution. (Two parallel lines, never meeting.)

Worked example Verify

The RHS after elimination: , confirming inconsistency. See Solving Linear Systems — Consistency.


Ex 5 — Free variable, infinitely many solutions (cell C5)

Forecast: same left side as Ex 4, but now the RHS is also row 1's. Predict a full zero row : infinitely many solutions with one free variable.

  1. Clear column 1. , .
  2. Interpret. Row 2 is — always true, carries no info. Why free variable? Only one real equation for two unknowns; one variable is free.
  3. Parametrise. Let (free). Then .

Answer: infinitely many: for any real .

Worked example Verify

Take : . Eqn 1: ✓. Eqn 2: ✓. Take : , eqn 1 ✓.


Ex 6 — Negative and fractional pivots (cell C6)

Forecast: the first pivot is negative. Predict fractions appearing but a clean unique answer if you keep the "" template religiously.

  1. Pivot ; clear column 1. , ; , . Why negative pivot is fine? The multiplier formula never assumed positivity — it just cancels.
  2. Pivot ; clear below. , .
  3. Back-substitute. Row 3: . Row 2: . Row 1: .

Answer: .

Worked example Verify

Row 2 original: ✓.


Ex 7a — Rectangular: over-determined, (cell C7)

Forecast: here equations and unknowns, so . Usually over-determined systems have no solution — unless the third equation is a hidden combination of the first two. Predict we must finish eliminating, then inspect the last row (per the strategy box above): if it collapses to , the extra equation was redundant and a unique solution survives. (This is Rank of a Matrix in action.)

  1. Clear column 1. , .
  2. Clear column 2. Pivot , , . Why this step? Test whether row 3 adds new information or collapses.
  3. Inspect, then interpret. Bottom row : consistent and carries no info, so the third equation was dependent. Two pivots for two unknowns → rank → unique solution. Back-sub: ; .

Answer: (and it satisfies all three originals).

Worked example Verify

Eqn 2: ✓. Eqn 3: ✓. Rank number of unknowns → unique.


Ex 7b — Rectangular: under-determined, (cell C7)

Forecast: here equations and unknowns, so . There are more variables than pivots can pin down, so predict at least one free variable and hence infinitely many solutions (assuming no contradiction). Rank is the tell: see Rank of a Matrix.

  1. Clear column 1. , . Why this step? Zero the below the first pivot, as always.
  2. Count pivots (the stop-and-inspect step). Pivots sit in columns 1 and 2 (values and ). Column 3 has no pivot. No row is , so the system is consistent; rank . Why does this matter? A column without a pivot corresponds to a free variable — nothing forces its value, so we expect a whole family, not a single point.
  3. Parametrise the free variable. The pivot-less column is column 3, whose unknown is , so we set (free) and let it range over all real numbers. Why and not or ? and each own a pivot (columns 1 and 2), so their values are forced once is chosen; only the pivot-less variable is genuinely free.
    • Row 2: . Why this substitution? With known, row 2 has a single remaining unknown .
    • Row 1: . Why last? Climbing up, row 1 now has only unknown once and are in hand.

Answer: infinitely many: for any real . (Rank unknowns, so exactly one free variable — a line of solutions in 3-D space.)

Worked example Verify

Take : . Eqn 1: ✓. Eqn 2: ✓. Take : . Eqn 1: ✓; eqn 2: ✓.


Ex 8 — Word problem with real units (cell C8)

Forecast: translate three sentences into three equations, then it's a plain . Guess whether the counts come out as whole numbers (they must — you cannot have half a coin!).

Let be the counts.

  1. Clear column 1. , ; , . Why this step? Zero the and the under the first pivot so rows 2–3 lose the variable .
  2. Clear column 2. Pivot , , . Why this step? Kill the in column 2 so row 3 holds only the last variable .
  3. Back-substitute (bottom-up). Why bottom-up? The last row has a single unknown . . Then . Then .

Answer: nickels, dimes, quarters.

Worked example Verify (with units)

Count: coins ✓. Value: ¢ =\1.70d=6,\ n+q=6$ ✓.


Ex 9 — Exam twist: a parameter (cell C9)

Forecast: the pivot in column 2 will contain . Predict a special value of that makes that pivot ; then the RHS decides between "no solution" and "infinitely many." This is a Solving Linear Systems — Consistency classic.

  1. Clear column 1. , . Why this step? Isolate all the -dependence into one entry so the fork is easy to see.
  2. Case-split on the pivot . Why split here? The next step divides by ; the behaviour changes exactly when that pivot is zero.
    • If : pivot , so , then . Unique solution.
    • If : row 2 becomes , i.e. . Inconsistent — no solution.
    • Infinitely many? Would need row 2 . That requires and RHS ; but the RHS is , so it never happens here.

Answer: unique for all ; no solution at ; infinitely many for no value of .

Worked example Verify

: . Check eqn 2: ✓. : row gives , inconsistent ✓.


Recall checkpoint


Connections