Basic Prerequisites: Linear Algebra & Matrices and 01 · From Zero.
1. Intuition & Practical Objective
Almost every numerical method ends by solving a linear system. A finite-difference scheme is a linear solve per time step; a least-squares fit is a linear solve; a Newton step is a linear solve; a covariance-based portfolio is a linear solve per rebalance. Numerical linear algebra is the study of doing that solve fast and knowing how much accuracy it can deliver.
The practical objective of this page is the algorithm-and-cost lookup: which factorisation or iteration, what it costs, and how the condition number caps the achievable digits.
This page is the numerical counterpart to the conceptual Linear Algebra & Matrices page: that page explains spectral theory, PSD and SVD; this page explains how those objects are computed and where the computation breaks.
The one-sentence essence. “A linear solve is only as good as the condition number - the algorithm decides the cost, the conditioning decides the accuracy, and the two can be traded against each other with iteration.”
2. Mathematical Ground Truth & Derivations
Direct solutions.
- Triangular systems are solved by forward/back substitution in .
- LU decomposition factors ; solve , . Cost once, per solve. With partial pivoting it is the general workhorse.
- Cholesky for SPD : , lower-triangular. Half the work of LU and provably stable without pivoting. If Cholesky fails your matrix was not PSD - the diagnostic behind every covariance-matrix repair (see Linear Algebra & Matrices).
- Special structures pay huge dividends. A tridiagonal system - the form of every 1-D finite-difference scheme - is solved by the Thomas algorithm in instead of :
This is what makes implicit time-stepping affordable: one solve per step instead of one solve.
Conditioning - the accuracy ceiling. The relative error obeys
Loss of accuracy is roughly digits. For SPD , (largest/smallest eigenvalue), which is exactly the number that governs gradient descent (page 04) - conditioning is one theme seen from three angles.
Iterative solutions - preferred when is large and sparse, because they never fill in:
- Jacobi / Gauss–Seidel / SOR. Split ; iterate . Gauss–Seidel uses the newest values; SOR over-relaxes with , . Convergence: Jacobi/GS converge when is diagonally dominant or SPD; SOR converges iff for SPD (Duffy Thm 29.1). The projected version PSOR handles the complementarity constraints of American-option-style problems (Duffy eq. 29.11).
- Conjugate gradient (CG) - for SPD , converges in at most steps in exact arithmetic, faster when is small:
Krylov iteration (CG, GMRES, BiCGStab) is the tool for the sparse systems industry uses; preconditioning () is what makes it fast.
Eigenvalues.
- Gershgorin (Duffy Thm 8.2): the eigenvalues lie in the union of discs - a cheap a-priori bracket, used to bound spectral radii of stability matrices.
- Power iteration for the dominant eigenvalue: , with converging at the rate - linear, fast only when the top eigenvalue is well-separated.
- Tridiagonal Toeplitz spectra are closed-form: (Duffy eqs. 7.8, 8.51) - this is how the stability of an FDM scheme is read off analytically.
- QR algorithm is the general dense eigensolver; the SVD () is the numerically-preferred route to singular values, rank and least-squares solutions (see Linear Algebra & Matrices).
3. Computational Implementation - Thomas vs dense, conditioning, power iteration, CG
Note the conditioning number in dollars and cents: with , a right-hand-side perturbation of moves the solution by of its norm. No algorithm repairs this - the information is gone. Power iteration converges linearly (error over 12 steps) because the top two eigenvalues are not separated enough; CG on the same-class SPD matrix needs only half of .
4. Failure Modes & First-Principles Breakdowns
- Conditioning is the hard ceiling. caps accuracy at lost digits. A Hilbert matrix (, ) cannot be inverted to a single correct digit in double precision, no matter the algorithm. Diagnose with
cond; cure with regularisation (ridge, shrinkage) or preconditioning, not with a different solver. - Normal equations square the condition number. Forming for least squares gives - halving your accuracy. Use QR (or SVD) instead. This is the single most common numerical-linear-algebra mistake in quantitative code.
- Cholesky failure = not PSD. A covariance matrix estimated from returns
LinAlgError: Matrix is not positive definite; the fix is PSD repair / shrinkage, not a pivot trick (Linear Algebra & Matrices). - Iterative methods fail silently on the wrong matrix. Jacobi/GS can diverge for a non-diagonally-dominant matrix; CG requires SPD and breaks on indefinite systems (use GMRES/BiCGStab). Always check the residual, not just the iteration count.
- Power iteration stalls on near-degenerate eigenvalues. Its rate is ; when convergence is glacial, and it finds only the dominant eigenvalue (use QR/subspace iteration for the rest).
- Fill-in destroys sparse advantages. A direct LU on a sparse matrix can become dense in the factors; that is exactly why large systems use iterative Krylov solvers and preconditioners.
- Do not invert to solve. Computing
inv(A) @ bis slower and less accurate thansolve(A, b); never form explicitly.
5. References
- Golub, G. H. & Van Loan, C. F.: Matrix Computations (4th ed.)
- Trefethen, L. N. & Bau, D.: Numerical Linear Algebra
- Duffy, Finite Difference Methods in Financial Engineering
- Strang, Gilbert: Linear Algebra and Learning from Data
6. Connected Graph Bridges
- Base: Linear Algebra & Matrices · 01 · From Zero · 04 · Optimization
- Continue: 06 · Advanced Extensions · Index Hub
- Forward links: Covariance Shrinkage & Denoising · Linear Algebra & Matrices (PSD repair, SVD)