Iterative Linear Solvers
Solving huge systems of linear equations not by direct elimination but by repeated guessing-and-improving — starting from a rough guess and refining it step by step, which scales to problems too large for Gaussian elimination to touch.
Prerequisites: Gaussian Elimination and Pivoting
A large risk model's covariance matrix might have tens of thousands of assets, making a system with tens of thousands of equations. Gaussian elimination solves this exactly, but its cost grows like — for , that's on the order of operations, far too slow. Iterative solvers take an entirely different approach: start from a rough guess for , and repeatedly refine it using cheap operations (just multiplying by , not inverting anything), stopping once the guess is close enough. For huge, sparse systems, this trade of exactness for speed is not just acceptable — it's the only practical option.
An analogy: tuning a radio dial by feel
Gaussian elimination is like a mechanic taking the radio apart to compute the exact dial position for a station from the circuit diagram — precise, but a lot of work per station. An iterative solver is like turning the dial, listening to how close you are to a clear signal, and nudging it a bit closer, then repeating — each nudge is cheap, and after enough small adjustments you're close enough that further tuning wouldn't be audible. You never take the radio apart, and for a radio with a thousand stations to find, this is dramatically faster overall even though it never gives you the mathematically exact dial position.
The math, one piece at a time
The simplest iterative scheme, Jacobi iteration, updates every component of the guess simultaneously using the current guess's other components:
In words: solve equation for as if every other variable's current (possibly still-wrong) guess were correct, then update all variables this way at once using last iteration's values, and repeat. Each iteration costs only a matrix-vector multiply — , or far less if is sparse (mostly zeros, common in real covariance and network structures), versus for a full direct solve. Gauss-Seidel improves on this by using already-updated values within the same sweep instead of waiting for the next iteration, typically converging faster for the same cost per step. More advanced methods like conjugate gradient (for symmetric positive-definite , the common case for covariance matrices) choose each step's direction and size more cleverly, often converging in far fewer iterations than simple sweeps.
Convergence isn't automatic: Jacobi and Gauss-Seidel are guaranteed to converge for certain well-behaved matrices (notably diagonally dominant ones, where each diagonal entry exceeds the sum of the absolute values of the rest of its row), but can diverge or converge painfully slowly otherwise. This is the trade quants make deliberately: iterative solvers gain speed and memory efficiency by giving up the direct method's unconditional guarantee.
Worked example 1: Jacobi iteration by hand
Solve (true answer: — check: ... let's instead solve directly: from equations and , substituting gives approximately). Starting guess . Iteration 1: , . Iteration 2: , . Iteration 3: , . The guesses are visibly oscillating in but converging toward roughly over further iterations, getting closer each sweep without ever needing to invert the matrix.
Worked example 2: when the cost saving matters
For a covariance matrix with assets (sparse, with most cross-asset entries near zero after thresholding), a direct solve costs on the order of operations. An iterative solver like conjugate gradient, needing perhaps 50-100 iterations to converge to acceptable precision, each costing roughly — say 200 nonzero entries per row after sparsification — costs on the order of operations: roughly four orders of magnitude cheaper than the direct solve, which is the entire reason large-scale risk systems use iterative solvers rather than Gaussian elimination.
What this means in practice
Iterative solvers are what makes large-scale portfolio optimization, big sparse risk-factor models, and machine-learning-adjacent linear algebra (like solving huge regularized regression systems) computationally feasible at all — direct methods simply don't scale to the sizes involved. The tradeoff to keep in mind is that an iterative solver returns an approximate answer with a chosen tolerance, not an exact one, and its convergence speed depends heavily on the matrix's condition number: a poorly-conditioned system can force far more iterations, sometimes eroding the speed advantage that motivated using an iterative method in the first place.
Iterative solvers approximate the solution to through repeated cheap updates rather than one expensive direct computation, trading Gaussian elimination's exact answer and unconditional guarantee for dramatic speed gains on large, sparse systems — a trade that only pays off when the matrix converges reasonably fast, which is not guaranteed for every system.
The classic mistake is assuming an iterative solver will converge for any matrix simply because it converged nicely on a previous, well-behaved test system. Convergence speed for methods like Jacobi and Gauss-Seidel depends heavily on the matrix's structure (diagonal dominance) and condition number, and a poorly-conditioned or non-diagonally-dominant matrix can converge painfully slowly or not at all — silently returning a "converged" but inaccurate answer if a loose stopping tolerance is used. Always check the residual directly rather than trusting a fixed iteration count to mean the answer is accurate.
Related concepts
Practice in interviews
Further reading
- Golub & Van Loan, Matrix Computations, ch. 10-11
- Trefethen & Bau, Numerical Linear Algebra, lecture 38