LU Factorization and Solving Linear Systems
Gaussian elimination as a matrix factorization, why we pivot, and the two triangular solves that do the real work.
Leads to: LU is the workhorse; Cholesky (5.4) is its symmetric specialization.
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- Derive the LU factorization from Gaussian elimination and count its cost.
- Explain why partial pivoting is needed for stability and how it yields PA=LU.
- Implement forward and back substitution and verify them against a known solution.
- Interpret the growth factor and the backward stability of LU with pivoting.
- Solve multiple right-hand sides efficiently by reusing one factorization.
Key Vocabulary
- LU factorization
- Writing \(A=LU\) with \(L\) unit lower-triangular and \(U\) upper-triangular.
- Partial pivoting
- Row-swapping to put the largest available entry on the pivot, giving \(PA=LU\).
- Forward substitution
- Solving \(Ly=b\) top-to-bottom in \(O(n^2)\) work.
- Back substitution
- Solving \(Ux=y\) bottom-to-top in \(O(n^2)\) work.
- Growth factor
- The largest magnitude appearing during elimination relative to \(A\); controls LU stability.
- Permutation matrix
- A reordering of the identity, \(P\), encoding the row swaps; orthogonal with \(P^{-1}=P^\top\).
Intuition & Motivation
From elimination to a factorization
Eliminating column \(k\) subtracts multiples \(\ell_{ik}=a_{ik}/a_{kk}\) of row \(k\) from rows below. Collecting the multipliers into a unit lower-triangular \(L\) and the reduced matrix into \(U\) gives:
With the factorization in hand, solving \(Ax=b\) is two cheap triangular solves:
Interactive: forward and back substitution
Implement the two triangular solves that every dense linear-algebra library calls millions of times.
- Skipping pivoting: a zero or tiny pivot makes \(\ell_{ik}\) explode and destroys accuracy.
- Recomputing the factorization for each new \(b\) instead of reusing \(L,U\).
- Forgetting to permute the right-hand side: you must solve \(Ly=Pb\), not \(Ly=b\).
- Inverting \(A\) to solve one system - slower and less stable than two triangular solves.
- Call a factorization once and cache \(L,U,P\) for repeated solves (e.g. rolling risk systems).
- For symmetric positive-definite systems, use Cholesky (5.4): half the cost, no pivoting needed.
- Check the returned pivots; a near-zero pivot after partial pivoting signals a near-singular matrix.
- Use library LAPACK (
numpy.linalg/scipy.linalg.lu_factor) in production; hand code only to learn.
Knowledge Check
Practical Exercise
Show that once \(PA=LU\) is known, solving \(Ax=b\) requires only \(O(n^2)\) work, and count the multiplications in forward substitution for \(Ly=Pb\).
Forward substitution computes \(y_i=(Pb)_i-\sum_{j\lt i}\ell_{ij}y_j\). Row \(i\) uses \(i-1\) multiplications, so the total is \(\sum_{i=1}^n(i-1)=n(n-1)/2\).
Back substitution for \(Ux=y\) is symmetric, another \(\approx n^2/2\) multiplications. Together the two solves are \(O(n^2)\), dominated by the one-time \(O(n^3)\) factorization.
lu_factor from lu_solve?Lesson Summary
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: Its multipliers satisfy \(|\ell_{ik}|\le1\), bounding error growth and giving practical backward stability.
A: Factorization is \(O(n^3)\); each right-hand-side solve is \(O(n^2)\) via forward then back substitution.
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check
Source References
This lesson synthesizes and paraphrases concepts from the sources below. No copyrighted text, problem sets, or solutions are reproduced. Return to the originals for full depth.
- Numerical Linear Algebra (Trefethen & Bau, SIAM, 1997) foundational - Lec 20–22 - Lectures 20–22: LU, pivoting, stability of Gaussian elimination.
- Linear Algebra Done Right (Sheldon Axler, 4th ed., 2024) current - Ch. 5 - Triangular operators and invertibility underlying the solves.