Cholesky Decomposition Calculator
Find the Cholesky decomposition of a symmetric positive-definite matrix in the form A = LLT, where L is lower triangular. This factorization is widely used in numerical methods, optimization, and solving linear systems.
A
Learn About Cholesky Decomposition
Cholesky decomposition is a specialized triangular matrix factorization designed for symmetric, positive-definite matrices $\mathbf{A} \in \mathbb{R}^{n \times n}$. It decomposes $\mathbf{A}$ into the product of a unique lower triangular matrix $\mathbf{L}$ and its transpose:
where all main diagonal entries of $\mathbf{L}$ are strictly positive real numbers ($l_{ii} > 0$).
Often termed the "square root" of a matrix, Cholesky decomposition is widely applied in Monte Carlo simulations, Kalman filtering, nonlinear optimization, and solving symmetric linear systems.
Necessary and Sufficient Conditions
A real matrix $\mathbf{A}$ admits a unique Cholesky factorization $\mathbf{A} = \mathbf{L}\mathbf{L}^T$ with positive diagonal entries if and only if it satisfies two conditions:
- Symmetry: $\mathbf{A}^T = \mathbf{A}$.
- Strict Positive Definiteness: $\mathbf{x}^T \mathbf{A} \mathbf{x} > 0$ for all non-zero vectors $\mathbf{x} \in \mathbb{R}^n$. By Sylvester's criterion, this holds if and only if all $n$ leading principal minors of $\mathbf{A}$ have strictly positive determinants ($\det(\mathbf{A}_k) > 0$).
If a matrix is non-symmetric or has non-positive eigenvalues, Cholesky decomposition does not exist.
The Cholesky-Banachiewicz Algorithm
GammaCalculator computes $\mathbf{L}$ column by column using the Cholesky-Banachiewicz algorithm with exact rational and symbolic radical arithmetic:
- Diagonal Elements ($j = 1, 2, \dots, n$):
Because $\mathbf{A}$ is positive definite, the radicand $(a_{jj} - \sum_{k=1}^{j-1} l_{jk}^2)$ is strictly positive.
- Off-Diagonal Sub-Elements ($i > j$):
Computational Advantages over LU Decomposition
- Half the Flops: Cholesky decomposition requires approximately $\frac{1}{3}n^3$ floating-point operations, exactly half the operations of general LU decomposition ($\frac{2}{3}n^3$).
- Inherent Numerical Stability: The algorithm is unconditionally stable without pivoting. Because $l_{ii}^2 \le a_{ii}$, the entries of $\mathbf{L}$ cannot grow arbitrarily large during computation.
Worked Numerical Example
Compute the Cholesky decomposition of the symmetric positive-definite matrix:
- Verify Positive Definiteness:
- $\mathbf{A}^T = \mathbf{A}$ (Symmetric).
- Minor $k=1$: $\det(\mathbf{A}_1) = 4 > 0$.
- Minor $k=2$: $\det(\mathbf{A}) = (4)(10) - (2)(2) = 40 - 4 = 36 > 0$.
- Column 1 ($j=1$):
- Diagonal: $l_{11} = \sqrt{a_{11}} = \sqrt{4} = 2$.
- Sub-diagonal: $l_{21} = \frac{a_{21}}{l_{11}} = \frac{2}{2} = 1$.
- Column 2 ($j=2$):
- Diagonal: $l_{22} = \sqrt{a_{22} - l_{21}^2} = \sqrt{10 - 1^2} = \sqrt{9} = 3$.
- Resulting Factors:
- Verification:
Why does Cholesky decomposition not require pivoting?
In general LU decomposition, row pivoting ($\mathbf{P}\mathbf{A} = \mathbf{L}\mathbf{U}$) is required to prevent division by near-zero pivots. For symmetric positive-definite matrices, the inequality $\sum_{k=1}^j l_{jk}^2 = a_{jj}$ guarantees that $|l_{jk}| \le \sqrt{a_{jj}}$, bounding all entries of $\mathbf{L}$ by the square roots of the diagonal elements of $\mathbf{A}$. This prevents numerical explosion without row swaps.
What happens if the matrix is positive semi-definite?
If $\mathbf{A}$ is positive semi-definite (eigenvalues $\ge 0$, with at least one eigenvalue equal to zero), the term under the square root can become zero ($a_{jj} - \sum l_{jk}^2 = 0$). In this case, a complete Cholesky factorization requires diagonal pivoting, yielding $\mathbf{P}\mathbf{A}\mathbf{P}^T = \mathbf{L}\mathbf{L}^T$ where $\mathbf{L}$ contains zeros on its diagonal.
How is Cholesky decomposition used in Monte Carlo simulations?
To generate correlated random variables $\mathbf{Y}$ with covariance matrix $\mathbf{\Sigma}$, one generates uncorrelated standard normal random variables $\mathbf{Z} \sim \mathcal{N}(\mathbf{0}, \mathbf{I})$ and multiplies by the Cholesky factor: $\mathbf{Y} = \mathbf{L}\mathbf{Z}$. Because $\operatorname{Cov}(\mathbf{Y}) = \mathbf{L}\operatorname{Cov}(\mathbf{Z})\mathbf{L}^T = \mathbf{L}\mathbf{I}\mathbf{L}^T = \mathbf{\Sigma}$, the simulated variables replicate the target covariance structure.
How does Cholesky decomposition find the determinant?
Because $\det(\mathbf{L}^T) = \det(\mathbf{L})$ and $\mathbf{L}$ is triangular, the determinant of $\mathbf{A}$ is simply the square of the product of the diagonal elements of $\mathbf{L}$:
- André-Louis Cholesky: Major André-Louis Cholesky was a French military geodesist and artillery officer who developed this algorithm around 1910 to solve large triangular survey networks. His work was published posthumously in 1924 by his fellow officer Commander Ernest Benoît after Cholesky was killed in action during World War I.
- $LDL^T$ Variant: To eliminate all square root calculations, numerical engineers often use the $LDL^T$ factorization ($\mathbf{A} = \mathbf{L}\mathbf{D}\mathbf{L}^T$), where $\mathbf{L}$ is unit lower triangular ($l_{ii} = 1$) and $\mathbf{D}$ is a diagonal matrix containing the squared pivots. This variant operates entirely within rational arithmetic.