Setup
The central operation: solving
Almost every numerical routine in quantitative finance reduces to solving a linear system. Yield curve bootstrapping solves for discount factors. Greeks computed by bump-and-reval solve for a perturbed price. Calibration via Gauss-Newton solves the normal equations . Even generating correlated random variables for Monte Carlo requires factorising a covariance matrix.
The naïve approach — computing explicitly and then forming — is both slower and less numerically stable than direct factorisation. The standard alternatives are:
- LU factorisation with partial pivoting: general square , flops.
- Cholesky factorisation: symmetric positive definite , flops — twice as fast as LU, always stable without pivoting.
Why this matters on a derivatives desk. Cholesky factorisation of the covariance matrix is the backbone of correlated Monte Carlo simulation. If you call np.linalg.cholesky or LAPACK dpotrf in a pricing library, you are using Cholesky. If it throws an error ("matrix is not positive definite"), you have a broken covariance matrix — and you need to know why to fix it.
Assumptions
- is square. For LU: assume is non-singular (otherwise partial pivoting detects the singularity). For Cholesky: assume is symmetric positive definite (SPD).
- All arithmetic is in exact real arithmetic unless otherwise stated; floating-point effects are discussed in Limitations.
- Conventions: LU factorisation produces where is a permutation matrix, is unit lower triangular (diagonal entries all 1), and is upper triangular. Cholesky produces where is lower triangular with positive diagonal.
Theory
1. LU Factorisation
The idea is systematic Gaussian elimination: reduce to upper triangular form by applying elementary row operations, then record those operations as a lower triangular matrix .
Definition 1.1 (LU factorisation). An LU factorisation of is a decomposition where is unit lower triangular (lower triangular with 1s on the diagonal) and is upper triangular.
With partial pivoting: , where is a permutation matrix that reorders the rows of to place the largest element in each column on the diagonal before eliminating — improving numerical stability.
Algorithm (Gaussian elimination with partial pivoting):
At step (for ):
- Find the row with the largest absolute value in column : (partial pivot).
- Swap rows and in .
- For each row : compute the multiplier and subtract times row from row .
- Store in the lower triangular part of .
After steps, has been transformed to and the multipliers fill .
Theorem 1.2 (Existence of LU with partial pivoting). For any non-singular , there exists a permutation matrix such that with unit lower triangular, upper triangular, and for all . The factorisation is unique given .
Solving using LU:
Given , the system becomes . Solve in two triangular passes:
- Forward substitution: solve for — operations.
- Backward substitution: solve for — operations.
Total cost: for the factorisation (done once), then per right-hand side. For bootstrapping with multiple right-hand sides (e.g., different rate scenarios), reusing the factorisation is a significant efficiency gain.
Example 1.3 (2×2 LU by hand). Let .
Step 1: pivot is row 2 (|4| > |2|), so swap: .
Step 2: multiplier . Subtract row 1 from row 2: .
Result: , , .
Verify: ... or more directly: . ✓
2. Cholesky Factorisation
When is symmetric and positive definite, a more efficient and always-stable factorisation exists.
Definition 2.1 (Cholesky factorisation). The Cholesky factorisation of a symmetric positive definite matrix is where is lower triangular with strictly positive diagonal entries .
The factorisation is unique (given the positivity convention for the diagonal).