Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 3: Elimination and LU Factorization
Linear Algebra

Foundations

  1. 01Start Here: Python and the Math the Labs Use
  1. 02Week 1: Vectors and Linear Combinations
  2. 03Week 2: Linear Transformations and Matrices
  3. 04Week 3: Elimination and LU Factorization
  4. 05Week 4: Determinants
  5. 06Week 5: Vector Spaces, Independence, and Basis
  6. 07Week 6: The Four Fundamental Subspaces
  7. 08Week 7: Orthogonality and Projections
  8. 09Week 8: Least Squares and QR
  9. 10Week 9: Eigenvalues and Eigenvectors
  10. 11Week 10: Diagonalization and Markov Matrices
  11. 12Week 11: Differential Equations
  12. 13Week 12: Symmetric and Positive Definite Matrices
  13. 14Week 13: The SVD and Complex Matrices
  14. 15Week 14: PCA, the Fourier Matrix and the FFT
Week 03· Linear Algebra7 min read

Week 3: Elimination and LU Factorization

Learning Outcomes
  • Solve Ax=bAx=bAx=b using Gaussian elimination
  • Explain why a row operation changes a plane but not the solution
  • Factor a matrix as A=LUA = LUA=LU (and PA=LUPA=LUPA=LU with row exchanges)
  • Read a zero pivot as three planes with no common point, or with a common line
Prerequisites

Background knowledge assumed:

  • Matrix multiplication as composition of linear transformations

Recommended: Review Week 2: Linear Transformations and Matrices before starting.

You eliminate a 3×33 \times 33×3 system and the last row reads 0=10 = 10=1. You look for the two parallel planes that must cause it, and there are none. The usual picture of "no solution" is wrong for three planes, and elimination shows why.

Before you move anything, commit to an answer.

Exercise · Multiple choice

In the scene below, set a₃₃ = 7 and b₃ = 2. No row of A is a multiple of another, so no two planes are parallel. How many points lie on all three planes?

Exactly one
None
A whole line of them
It depends on the elimination step t

The row picture of a 3 × 3 system: each row of [A | b] is a plane, cut to a box. A thin line marks where each pair of planes crosses, and a dot or a dashed line marks the points on all three. The slider t runs elimination: row 2 − 2 × row 1 from t = 0 to 1, row 3 − 4 × row 1 from 1 to 2, and row 3 − 3 × row 2 from 2 to 3. The sliders a₃₃ and b₃ set the last entry of A and of b. t = 0, a₃₃ = 8, b₃ = 2. Row 1 [2, 1, 1 | 1]. Row 2 [4, 3, 3 | 1]. Row 3 [8, 7, 8 | 2]. All three planes meet at (1, −2, 1). Each pair of planes crosses in a line.

t = 0, a₃₃ = 8, b₃ = 2. Row 1 [2, 1, 1 | 1]. Row 2 [4, 3, 3 | 1]. Row 3 [8, 7, 8 | 2]. All three planes meet at (1, −2, 1). Each pair of planes crosses in a line.

Each translucent sheet is one row of [A∣b][A \mid b][A∣b], the thin dark lines are where two planes cross, and the dot is where all three meet. Slide ttt from 000 to 333 to run elimination one step at a time. The point does not move. Then set a33a_{33}a33​ to 777 and change b3b_3b3​ between 222 and 111.

Elimination on the scene's system#

The scene opens on the first [A∣b][A \mid b][A∣b] below. Gaussian elimination uses each pivot to clear the entries under it. Pivot 222 gives multipliers ℓ21=2\ell_{21} = 2ℓ21​=2 and ℓ31=4\ell_{31} = 4ℓ31​=4. Then pivot 111 gives ℓ32=3\ell_{32} = 3ℓ32​=3:

[211143318782]→[2111011−1034−2]→[2111011−10011].\left[\begin{array}{ccc|c} 2 & 1 & 1 & 1 \\ 4 & 3 & 3 & 1 \\ 8 & 7 & 8 & 2 \end{array}\right] \to \left[\begin{array}{ccc|c} 2 & 1 & 1 & 1 \\ 0 & 1 & 1 & -1 \\ 0 & 3 & 4 & -2 \end{array}\right] \to \left[\begin{array}{ccc|c} 2 & 1 & 1 & 1 \\ 0 & 1 & 1 & -1 \\ 0 & 0 & 1 & 1 \end{array}\right].​248​137​138​112​​→​200​113​114​1−1−2​​→​200​110​111​1−11​​.

Back-substitution gives x3=1x_3 = 1x3​=1, x2=−2x_2 = -2x2​=−2 and x1=1x_1 = 1x1​=1.

Why the point stays. Row 2 becomes row 2 − 2 × row 1. Any xxx on planes 1 and 2 satisfies that combination, so the new plane 2 swings about the line where the old planes 1 and 2 crossed. Adding 2×2 \times2× row 1 back undoes the step, so no point is gained either. The original planes are only 7°7°7° to 18°18°18° apart and read as one thick sheet. The planes of UUU are 45°45°45° to 66°66°66° apart. Elimination does not move the answer. It makes the answer legible.

Elimination as matrices, and A = LU#

Subtracting ℓ\ellℓ times row jjj from row iii is left-multiplication by EijE_{ij}Eij​, the identity with −ℓ-\ell−ℓ at (i,j)(i, j)(i,j). So EA=UEA = UEA=U with E=E32E31E21E = E_{32}E_{31}E_{21}E=E32​E31​E21​. Each EijE_{ij}Eij​ is undone by +ℓ+\ell+ℓ, so EEE is invertible: the algebra of "the point stays".

L=E−1L = E^{-1}L=E−1 is unit lower triangular and holds the multipliers below its diagonal. That is the LULower-Upper (matrix factorization) factorization A=LUA = LUA=LU:

L=(100210431),U=(211011001).L = \begin{pmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 4 & 3 & 1 \end{pmatrix}, \quad U = \begin{pmatrix} 2 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}.L=​124​013​001​​,U=​200​110​111​​.

Factoring costs O(n3)O(n^3)O(n3) once. Each new bbb then costs a forward solve Ly=bLy = bLy=b and a back solve Ux=yUx = yUx=y, about n2n^2n2 operations. With no row exchanges, det⁡A\det AdetA is the product of the pivots, here 222.

When a pivot is zero#

Keep the first two rows and let a33=aa_{33} = aa33​=a vary. Elimination gives a third pivot of a−7a - 7a−7 and a third right side of b3−1b_3 - 1b3​−1, so

x3=b3−1a−7,x2=−1−x3,x1=1.x_3 = \frac{b_3 - 1}{a - 7}, \qquad x_2 = -1 - x_3, \qquad x_1 = 1.x3​=a−7b3​−1​,x2​=−1−x3​,x1​=1.

Rows 1 and 2 never change, so the point slides along their crossing line as aaa nears 777. At a=7a = 7a=7 plane 3 turns parallel to that line, and the left side of row 3 is −2×-2 \times−2× row 1 +3×+ 3 \times+3× row 2. The right side decides:

  • b3=1b_3 = 1b3​=1: row 3 reduces to 0=00 = 00=0, and the planes share the line through (1,−1,0)(1, -1, 0)(1,−1,0) along (0,−1,1)(0, -1, 1)(0,−1,1).
  • b3≠1b_3 \ne 1b3​=1: row 3 reads 0=b3−10 = b_3 - 10=b3​−1, and the three crossing lines are parallel.

Neither case needs parallel planes. Strang's instructor manual (5th ed., Problem Set 2.2, Problem 20) puts it this way: "No parallel planes but still no solution. The three planes in the row picture form a triangular tunnel."

A zero pivot with a nonzero entry below it is a different problem. The matrix is fine and the rows are in the wrong order. Exchange them with a permutation matrix PPP and factor PA=LUPA = LUPA=LU. Libraries always pick the largest entry below (partial pivoting), so their LLL and UUU can differ from yours and still be correct.

Knowledge Check#

Question 1 of 4

Set t = 1, so row 2 − 2 × row 1 is done. The caption shows Row 2 [0, 1, 1 | −1]. Where do the three planes meet now?

(1, −2, 1), the same point as at t = 0
(0, −1, 0)
They no longer meet
(1, −1, 0)

Browser lab: elimination on the scene's system#

Run plain elimination (no pivoting) on the scene's matrix for any a33a_{33}a33​ and b3b_3b3​, then read the last row.

python · runs in browser
import numpy as np

def eliminate(a33, b3):
    M = np.array([[2., 1., 1., 1.],
                  [4., 3., 3., 1.],
                  [8., 7., a33, b3]])
    L = np.eye(3)
    for k in range(2):
        for i in range(k + 1, 3):
            L[i, k] = M[i, k] / M[k, k]
            M[i] -= L[i, k] * M[k]
    return L, M

L, M = eliminate(8, 2)
U, c = M[:, :3], M[:, 3]
print("L =\n", L)
print("U =\n", U, "\nc =", c)
print("pivots:", np.diag(U), " LU == A:", np.allclose(L @ U, [[2, 1, 1], [4, 3, 3], [8, 7, 8]]))
print("x =", np.linalg.solve(U, c))

for a33, b3 in [(7.5, 2), (7, 2), (7, 1)]:
    _, M = eliminate(a33, b3)
    print(f"a33 = {a33}, b3 = {b3}: last row {M[2].round(3)}")

It prints pivots 222, 111, 111 and x=(1,−2,1)x = (1, -2, 1)x=(1,−2,1), then last rows [0,0,0.5∣1][0, 0, 0.5 \mid 1][0,0,0.5∣1], [0,0,0∣1][0, 0, 0 \mid 1][0,0,0∣1] and [0,0,0∣0][0, 0, 0 \mid 0][0,0,0∣0]: one point, no point, a line. Match each to the scene at t=3t = 3t=3.

Key takeaways#

Elimination replaces a plane with another plane through the same crossing line, so the solution never moves. The multipliers fill LLL and the result is UUU, with A=LUA = LUA=LU. A zero last pivot makes AAA singular without any parallel planes: the last row of UUU reads 0=00 = 00=0 for a common line, or 0=0 = 0= nonzero for a triangular tunnel.

Further reading#

  • Gilbert Strang, Introduction to Linear Algebra (6th ed., Wellesley-Cambridge Press, 2023), Chapter 2. Elimination, the row picture and A=LUA = LUA=LU.
  • Gilbert Strang, Introduction to Linear Algebra, 5th ed.: Manual for Instructors, Problem Sets 2.1 and 2.2. The triangular tunnel.
  • Lloyd N. Trefethen & David Bau, Numerical Linear Algebra (SIAM, 1997), Lectures 20–21. LULULU with partial pivoting.

Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.

← Previous
Week 2: Linear Transformations and Matrices
Next →
Week 4: Determinants
On this page
  • Elimination on the scene's system
  • Elimination as matrices, and A = LU
  • When a pivot is zero
  • Knowledge Check
  • Browser lab: elimination on the scene's system
  • Key takeaways
  • Further reading