Basic Prerequisites: 02 · Vectors, Spaces & Matrices.
1. Intuition & Practical Objective
Nearly every computation in the toolbox reduces to solving - find the weight/parameter vector ‘s pre-image. Regression’s normal equations , portfolio optimization’s quadratic-program KKT system, and Monte Carlo’s correlated-normal draw are all linear solves. The practical objective of this page: learn not to solve by brute-force inversion, but to factor once and solve twice. A factorization (LU, Cholesky) splits into easy triangular pieces, so solving becomes two back/forward substitutions - and, critically, the same factorization solves a hundred different right-hand sides for free.
The single most finance-relevant special case is the Cholesky factorization of a covariance matrix (Glasserman §2.2):
which is the standard way to simulate correlated asset returns: draw independent normals , then rotate-and-scale by to get the correct covariance. If your covariance is not positive definite, Cholesky throws an error - which is exactly the signal that the covariance is broken (06).
2. Mathematical Ground Truth & Derivations
Gaussian elimination / LU. Any invertible square matrix can be reduced to an upper-triangular by row operations encoded in a unit lower-triangular (with partial pivoting, ). Then becomes
two triangular solves - each trivially . Flop cost of the factorization is .
Cholesky (Glasserman eqs. 2.29–2.31). For a symmetric positive definite , there is a unique lower-triangular with positive diagonal such that . The entries come from the recursion
For the case this is the textbook result , so . Cholesky costs about flops - half of LU, because it exploits symmetry. If any goes non-positive, the matrix is not PD and the recursion hits a square root of a negative number: the first-principles failure of Cholesky on a non-PSD covariance.
The eigen/PC alternative (Glasserman eq. 2.32). Instead of , use and take ; too. This is the PCA route to the same simulation and connects directly to 04 and 05.
3. Computational Implementation - Cholesky from scratch, then use it
Implementing the recursion above and then sampling correlated normals with it demonstrates the whole loop: factor, verify , draw, and confirm the empirical covariance matches the target. Stdlib only.
The factorization reproduces exactly (it is an algebraic identity, not an approximation), and the Monte Carlo covariance converges to the target - this is the machinery inside every multi-asset path generator (Glasserman Ch 3). The same is then reused for thousands of draws at negligible marginal cost, which is why you factor once and sample many times.
4. Failure Modes & First-Principles Breakdowns
- The non-PSD crash is a diagnosis, not a bug. Cholesky of a non-PSD covariance hits - the routine throws (
Matrix is not positive definite). That exception is telling you the covariance violates , which happens with , pairwise-assembled correlations, or missing-data covariance estimates. Fix the covariance (06, shrinkage), not the solver. - Naive inversion is wasteful and unstable. Computing to solve costs and squares the round-off; the factor-and-substitute route is cheaper and more accurate. Never form explicitly when is wide or ill-conditioned (05 has the SVD alternative).
- No pivoting division-by-near-zero. LU without partial pivoting can divide by an exactly/tiny pivot and blow up. Cholesky avoids pivoting only because PD guarantees positive diagonal pivots - another reason PD-ness matters.
5. References
- Glasserman, Monte Carlo Methods in Financial Engineering
- Strang, Introduction to Linear Algebra (5th ed.)
- Horn & Johnson, Matrix Analysis
- Tsay, Analysis of Financial Time Series
6. Connected Graph Bridges
- Back: 02 · Vectors & Matrices · Index Hub
- Continue: 04 · Eigenvalues & Covariance · 05 · SVD, PCA & Regression
- Forward: Stochastic Calculus (Cholesky drives correlated-GBM/multi-asset SDE simulation) · Backtesting & Simulation Engines (production correlated-path generation) · Numerical Methods (05 · Numerical Linear Algebra)