Lab 2.1

Gaussian Elimination

Focus
row order → LDU → solve
Notebook
Ch2-1 Gaussian Elimination.ipynb

Lab goal

Explain why the rows of b must follow the rows of A, then read the solution from three simple triangular solves.

Lecture-note concepts
  • Gaussian elimination
  • Pivoted LU
  • LDU
  • Ax = b

Code extensionThe full notebook repeats this flow on a seeded 10×10 system and writes out forward and backward substitution.

Key ideas

Terms you will use

Row permutationQ A = L U_raw; rhs = Q b

Pivoting reorders the equations, so the same row order must be applied to b.

Diagonal scalingU_raw = D U_unit

The pivots of U_raw become a diagonal matrix; the remaining upper factor has ones on its diagonal.

Triangular solveL y = Qb → D z = y → U_unit x = z

Solve from left to right through L, D, and U_unit instead of forming an inverse.

Lab 2.1 · Guided example

Solve a 3×3 system through LDU

This is a smaller teaching example, not a copy of every notebook cell. It keeps the same factor-and-solve idea with values that fit on one screen.

Select a line to see its action, array shape, and concrete operation.

Simplified fromCh2-1 Gaussian Elimination.ipynbThe source uses a random 10×10 system; this trace uses a deterministic 3×3 system.

Line 1: import numpy as np
L01 / 14Create a small system
Predict

A[0,0] is zero, so another row must supply the first pivot.

Before

Start with one question

Find the vector x that makes A @ x equal b.

A x = b
After
?

Reveal to compare.

TARGET
A.shapenot stored Three equations.
bnot stored Three target values.

Continue in Python

Run the complete notebook in Colab

Run the original code and change the inputs.