Lab 2.4 · Optional

Gaussian Elimination in Detail

Focus
choose pivot → swap → cancel
Notebook
Ch2-4 Gaussian elimination in detail (Optional).ipynb

Lab goal

Choose a stable pivot, compute an elimination multiplier, and explain why the row update creates a zero.

Lecture-note concepts
  • Partial pivoting
  • Row exchange
  • Elimination multiplier
  • Upper-triangular form

Code extensionThe full optional notebook turns these same actions into nested loops and reconstructs the permutation and lower factors.

Key ideas

Terms you will use

Partial pivotingpivot = arg max_{i ≥ r} |U[i,j]|

Choose the largest absolute candidate in the active column and move it into the pivot position.

Multiplierm = target / pivot

Divide the target entry by the pivot to find how much of the pivot row to subtract.

Row updatetarget row ← target row − m × pivot row

Subtracting m times the pivot row makes the active target entry zero.

Lab 2.4 · Optional guided example

Make each elimination step visible

Instead of tracing the full 10×10 function, this page performs the two essential cancellations by hand. The notebook link keeps the complete loop available.

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

Simplified fromCh2-4 Gaussian elimination in detail (Optional).ipynbThe source implements the general loop; this trace isolates its pivot and row-update ideas.

Line 1: import numpy as np
L01 / 10Copy the matrix
Predict

The first pivot candidate U[0,0] is zero.

Before

Look below the diagonal

Gaussian elimination will turn the two highlighted lower-triangle positions into zeros.

goal: U[2,0] = 0 and U[2,1] = 0
After
?

Reveal to compare.

TARGET

Continue in Python

Run the complete notebook in Colab

Run the original code and change the inputs.