Elimination, remembered
Gaussian elimination solves Ax=b by subtracting multiples of one row from the rows below it until the matrix is upper triangular, U. The multipliers you used are worth keeping: put them below the diagonal of a lower triangular matrix L with ones on the diagonal, and then A=LU. The decomposition records the whole elimination, so the work is done once and reused.
A=LU,Ly=b,Ux=y(1) To solve, first Ly=b by forward substitution (top to bottom), then Ux=y by back substitution (bottom to top). Each costs about n2 operations, while the factorisation costs about 32n3. With many right-hand sides (many scenarios on the same matrix) you factor once and pay only n2 per scenario.
An LU by handTake
A=(2415). The multiplier is
4/2=2: subtract 2 times row 1 from row 2 to get
U=(2013), and
L=(1201). Check:
LU=(2412+3)=A. Solve
Ax=(3,9):
Ly=b gives
y1=3,
y2=9−2⋅3=3; then
Ux=y gives
x2=1,
2x1+1=3, so
x=(1,1).
- L: lower triangular, ones on the diagonal, the elimination multipliers below it.
- U: upper triangular, the result of the elimination; its diagonal holds the pivots.
- Pivoting: swap rows so the pivot is large, giving PA=LU with a permutation matrix P.
A zero or tiny pivot needs a row swapFor (0111) the first pivot is 0 and plain elimination divides by zero, yet the matrix is perfectly invertible. Swapping the rows fixes it. A pivot that is tiny rather than zero does not crash, but it produces huge multipliers and wrecks accuracy, so real libraries always pivot. Lab · what's graded
- The matrix L15 pts
- The matrix U15 pts
- A determinant from U15 pts
- Solving with L and U15 pts
- Why pivot15 pts
- The steps of an LU solve10 pts
- Why factor once15 pts