Cholesky Decomposition
March 23, 2026 · View on GitHub
Overview & Motivation
The Cholesky decomposition factors a symmetric positive-definite matrix into the product , where is a lower triangular matrix with positive diagonal entries. This is the matrix equivalent of taking a "square root."
It is approximately twice as fast as LU decomposition for symmetric positive-definite systems and is numerically stable without pivoting. In this library, it is used primarily by the Unscented Kalman Filter to generate sigma points from the state covariance matrix.
Mathematical Theory
Given symmetric positive-definite, compute such that :
Complexity Analysis
| Operation | Time | Space | Notes |
|---|---|---|---|
| Decomposition | Half the cost of general LU decomposition |
Step-by-Step Walkthrough
Input: (symmetric positive-definite).
Compute column by column:
| Step | Formula | Value |
|---|---|---|
| $2$ | ||
| $1$ | ||
| $2$ |
Result:
Verify: ✓
Pitfalls & Edge Cases
- Non-positive-definite input. If is not positive-definite, a diagonal element under the square root will be negative, producing NaN. Always verify the input or add a small regularization .
- Numerical precision. In fixed-point arithmetic, the intermediate sums and square root can lose precision. Use float for the decomposition and convert back if needed.
- Zero diagonal. A zero or near-zero diagonal in indicates a singular or nearly singular matrix.
Variants & Generalizations
- Decomposition. Avoids the square root by factoring where is diagonal. Preferred in fixed-point arithmetic where
sqrtis expensive or imprecise. - Cholesky–Banachiewicz vs Cholesky–Crout. Two orderings of the same algorithm: row-oriented (Banachiewicz, used in this implementation) vs column-oriented (Crout). Performance differs by cache access pattern.
- Incomplete Cholesky. Drops small entries during factorization to produce a sparse approximate factor. Used as a preconditioner for iterative solvers (e.g., conjugate gradient).
- Rank-1 Update/Downdate. Given the existing factor of , efficiently compute the factor of (or ) in without recomputing from scratch. Central to the square-root UKF.
- Block Cholesky. Exploits block structure in large matrices for better cache utilization and parallelism.
Applications
- Sigma point generation — The Unscented Kalman Filter uses Cholesky decomposition of the covariance matrix to spread sigma points along the principal uncertainty directions.
- Solving symmetric positive-definite systems — Given , compute , then solve (forward substitution) and (back substitution). Twice as fast as general LU.
- Multivariate normal sampling — To generate , compute from and set where .
- Least squares — The normal equations produce a symmetric positive-definite system solvable via Cholesky.
- Optimization — Newton-type methods with positive-definite Hessians use Cholesky to compute search directions.
Connections to Other Algorithms
| Algorithm | Relationship |
|---|---|
| Unscented Kalman Filter | Uses Cholesky to generate sigma points from the covariance matrix |
| Gaussian Elimination | General-purpose alternative; does not exploit symmetry |
References & Further Reading
- Golub, G.H. and Van Loan, C.F., Matrix Computations, 4th ed., Johns Hopkins University Press, 2013.
- Press, W.H. et al., Numerical Recipes, 3rd ed., Cambridge University Press, 2007 — Section 2.9.