Linear AlgebraIterative SolversConjugate GradientNumerical MethodsCalibration

Iterative Solvers for Calibration Problems

Module 5 of 525 min readLevel: Hard

Setup

Direct solvers — LU factorisation (Module 2) and Cholesky (Module 2) — cost O(n3)O(n^3) flops and require O(n2)O(n^2) storage. For a Crank-Nicolson finite difference grid with N=104N = 10^4 spatial nodes, forming and factorising the full stiffness matrix is 101210^{12} flops and 800 MB of storage — impractical. For a 2-factor interest rate PDE on a 200×200200 \times 200 grid, the system is n=4×104n = 4 \times 10^4 — far beyond direct methods.

Iterative solvers exploit the structure of the system: they require only matrix-vector products ApAp, never the factorisation. For sparse matrices (finite difference stencils, sparse covariance models), each ApAp costs O(n)O(n) rather than O(n2)O(n^2). The cost of the solve is O(nkiter)O(n \cdot k_\text{iter}) where kiterk_\text{iter} depends on the condition number.

Where iterative solvers appear in quant finance:

  1. PDE pricing (finite differences). Black-Scholes and Heston PDEs on dense grids produce large tridiagonal or banded systems at each time step. For 1D grids the Thomas algorithm (a direct tridiagonal solver, O(n)O(n)) is standard; for 2D grids, alternating direction implicit (ADI) splits into 1D tridiagonals. For 3D or coupled systems, iterative solvers (PCG) are used.

  2. Yield curve calibration. Bootstrapping a swap curve with nn pillars gives an n×nn \times n lower-triangular system (direct, trivial). Fitting a regularised Nelson-Siegel-Svensson model to mnm \gg n market quotes leads to a normal-equations solve (AA+λI)x=Ab(A^\top A + \lambda I)x = A^\top b — either direct (via Cholesky) or iterative (CG) depending on nn.

  3. Portfolio optimisation. Mean-variance with n=500n = 500 assets and kk linear constraints gives a KKT system of dimension n+k600n + k \approx 600. Cholesky is fine here. But factor-model covariance Σ=FF+D\Sigma = F F^\top + D (low-rank plus diagonal) inverts analytically via Woodbury — no solver needed.

  4. Large-scale calibration of stochastic vol models. Iterative refinement is used when the Jacobian is large and only approximately known (numerical differentiation), making direct factorisation unreliable.

Mathematical setting. We focus on three cases:

  • SPD system Ax=bAx = b with AA sparse and symmetric positive definite: solved by Conjugate Gradient (CG).
  • Non-symmetric system: GMRES (Generalised Minimal RESidual).
  • Overdetermined LS minAxb2\min \|Ax - b\|_2: LSQR.

Conventions. ARn×nA \in \mathbb{R}^{n \times n} SPD unless stated. rk=bAxkr_k = b - Ax_k is the residual at step kk. ek=xxke_k = x^* - x_k is the error. vA=vAv\|v\|_A = \sqrt{v^\top A v} is the A-norm (energy norm).

INSIGHT

Financial Insight. In production calibration at a bank, iterative solvers are used not just for speed but for robustness: they can be stopped early (before convergence) when the residual is below market-quote precision. Solving to 101010^{-10} accuracy when quotes are only known to 10410^{-4} wastes computation. Early stopping is equivalent to a form of regularisation — an important practical insight.


Theory

1. Quadratic Minimisation and the CG Motivation

For AA SPD, solving Ax=bAx = b is equivalent to minimising the strictly convex quadratic: f(x)=12xAxbx.f(x) = \frac{1}{2} x^\top A x - b^\top x. The gradient is f(x)=Axb=r(x)\nabla f(x) = Ax - b = -r(x). The minimum is at x=A1bx^* = A^{-1}b.

Steepest descent. The simplest iterative approach: move in the direction of the residual rk=bAxkr_k = b - Ax_k by the optimal step size:

DEFINITION

Definition 5.1 (Steepest Descent). Given x0x_0, iterate: αk=rkrkrkArk,xk+1=xk+αkrk.\alpha_k = \frac{r_k^\top r_k}{r_k^\top A r_k}, \qquad x_{k+1} = x_k + \alpha_k r_k. The step αk\alpha_k is chosen to minimise f(xk+αrk)f(x_k + \alpha r_k) over αR\alpha \in \mathbb{R}.

Convergence of steepest descent:

THEOREM

Theorem 5.1. Let κ=κ2(A)=λmax/λmin\kappa = \kappa_2(A) = \lambda_\text{max}/\lambda_\text{min}. Steepest descent satisfies: ek+1A(κ1κ+1)2ekA.\|e_{k+1}\|_A \leq \left(\frac{\kappa - 1}{\kappa + 1}\right)^2 \|e_k\|_A. For ill-conditioned problems (κ1\kappa \gg 1), the convergence factor approaches 1 — very slow.

The fundamental problem with steepest descent: consecutive search directions rk+1rkr_{k+1} \perp r_k in the Euclidean inner product, but they are not AA-orthogonal. The method revisits the same subspaces, causing "zigzag" convergence along narrow valleys of ff when eigenvalues are spread widely.

2. Conjugate Gradient Method

The CG method eliminates the redundant search directions by enforcing A-conjugacy:

DEFINITION

Definition 5.2 (A-conjugate directions). Vectors p,qp, q are A-conjugate (A-orthogonal) if pAq=0p^\top A q = 0. A set {p0,,pk1}\{p_0, \ldots, p_{k-1}\} is A-conjugate if piApj=0p_i^\top A p_j = 0 for all iji \neq j.

THEOREM

Theorem 5.2 (CG Algorithm — Hestenes-Stiefel, 1952). Starting from x0x_0, r0=bAx0r_0 = b - Ax_0, p0=r0p_0 = r_0, iterate: αk=rkrkpkApk,xk+1=xk+αkpk,rk+1=rkαkApk,\alpha_k = \frac{r_k^\top r_k}{p_k^\top A p_k}, \quad x_{k+1} = x_k + \alpha_k p_k, \quad r_{k+1} = r_k - \alpha_k A p_k, βk=rk+1rk+1rkrk,pk+1=rk+1+βkpk.\beta_k = \frac{r_{k+1}^\top r_{k+1}}{r_k^\top r_k}, \quad p_{k+1} = r_{k+1} + \beta_k p_k.

Key properties (proofs by induction on the Krylov subspace structure):

  • rirjr_i \perp r_j for iji \neq j (residuals are mutually orthogonal in the Euclidean inner product).
  • piApj=0p_i^\top A p_j = 0 for iji \neq j (search directions are A-conjugate).
  • xkx_k minimises f(x)=12xAxbxf(x) = \frac{1}{2}x^\top Ax - b^\top x over the Krylov subspace Kk=span{r0,Ar0,,Ak1r0}\mathcal{K}_k = \text{span}\{r_0, Ar_0, \ldots, A^{k-1}r_0\}.
  • In exact arithmetic, CG terminates in at most nn steps with the exact solution.

CG convergence rate:

THEOREM

Theorem 5.3 (CG convergence). The CG iterates satisfy: ekA2(κ1κ+1)ke0A.\|e_k\|_A \leq 2\left(\frac{\sqrt{\kappa} - 1}{\sqrt{\kappa} + 1}\right)^k \|e_0\|_A. For κ=100\kappa = 100: CG convergence factor 0.82\approx 0.82; steepest descent factor 0.96\approx 0.96.

Comparison: CG depends on κ\sqrt{\kappa} rather than κ\kappa. For κ=104\kappa = 10^4 (typical calibration matrix):

  • Steepest descent: 104\approx 10^4 iterations to reduce error by 10410^{-4}.
  • CG: 100\approx 100 iterations (100× faster).
EXAMPLE

Example 5.1 (Tridiagonal FD system). A Crank-Nicolson price step for a n=500n = 500 node grid gives a tridiagonal SPD matrix AA with κ4n2/π2105\kappa \approx 4n^2/\pi^2 \approx 10^5 (for the standard 1D heat equation stencil). CG converges in 105316\approx \sqrt{10^5} \approx 316 iterations to machine precision — competitive with the Thomas algorithm (O(n)=O(500)O(n) = O(500) steps). For 2D ADI, the subproblems are 1D tridiagonals, so Thomas algorithm dominates.

The full lesson requires Premium

The complete derivation, the C++ / Python implementation, the validation tables, the quiz, and the interview-angle notes are part of Premium. Start a Premium plan to unlock every module in this track.