Cholesky Decomposition Calculator
Compute Cholesky decomposition (LLT) and LDLT factorization for symmetric positive-definite 2x2 and 3x3 matrices with step-by-step math.
What is Cholesky Decomposition?
The Cholesky decomposition (or Cholesky factorization) is a matrix decomposition that factors a symmetric, positive-definite matrix $A$ into the product of a lower triangular matrix $L$ and its transpose $L^T$:
Cholesky Factorization Formula:
$$A = L L^T$$
Where $L$ is a lower triangular matrix with strictly positive real numbers along its main diagonal, and $L^T$ is the transpose of $L$.
Requirements for Cholesky Factorization
For a real matrix $A$ to have a unique Cholesky decomposition, it must satisfy two essential properties:
- Symmetry ($A = A^T$): The matrix must equal its own transpose, meaning $a_{ij} = a_{ji}$ for all row and column indices.
- Positive-Definiteness ($x^T A x > 0$ for all $x \neq 0$): By Sylvester's criterion, this holds if and only if all leading principal minors (the determinants of top-left submatrices) are strictly greater than zero: $$\det(A_{1 \times 1}) > 0, \quad \det(A_{2 \times 2}) > 0, \quad \det(A_{3 \times 3}) > 0$$
Step-by-Step Cholesky Algorithm Formulas
1. For a $2 \times 2$ Matrix
Given $A = \begin{pmatrix} a_{11} & a_{12} \\ a_{12} & a_{22} \end{pmatrix}$, the lower triangular matrix $L = \begin{pmatrix} l_{11} & 0 \\ l_{21} & l_{22} \end{pmatrix}$ is calculated as:
- $l_{11} = \sqrt{a_{11}}$
- $l_{21} = \frac{a_{12}}{l_{11}}$
- $l_{22} = \sqrt{a_{22} - l_{21}^2}$
2. For a $3 \times 3$ Matrix
For $A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{12} & a_{22} & a_{23} \\ a_{13} & a_{23} & a_{33} \end{pmatrix}$ and $L = \begin{pmatrix} l_{11} & 0 & 0 \\ l_{21} & l_{22} & 0 \\ l_{31} & l_{32} & l_{33} \end{pmatrix}$:
- $l_{11} = \sqrt{a_{11}}$
- $l_{21} = \frac{a_{12}}{l_{11}}, \quad l_{31} = \frac{a_{13}}{l_{11}}$
- $l_{22} = \sqrt{a_{22} - l_{21}^2}$
- $l_{32} = \frac{a_{23} - l_{31} l_{21}}{l_{22}}$
- $l_{33} = \sqrt{a_{33} - l_{31}^2 - l_{32}^2}$
$LDL^T$ Decomposition (Square-Root-Free Variant)
The $LDL^T$ decomposition decomposes $A = L D L^T$ where $L$ is a unit lower triangular matrix (diagonal elements equal 1) and $D$ is a diagonal matrix containing the squared diagonal factors. This formulation avoids computing square roots, which is useful in fixed-point embedded computing.
Applications of Cholesky Decomposition
- Solving Linear Systems: For symmetric positive-definite systems $Ax = b$, Cholesky decomposition is roughly twice as fast and much more numerically stable than standard Gaussian elimination or LU decomposition.
- Monte Carlo Simulation: Generates correlated random variables by multiplying uncorrelated standard normal vectors by the Cholesky factor $L$.
- Kalman Filtering: Used in navigation and signal processing to update covariance matrices accurately.
- Machine Learning: Fundamental to Gaussian process regression and kernel methods.
Related Linear Algebra Tools
Explore more matrix calculation tools in our math collection:
- Characteristic Polynomial Calculator: Find matrix eigenvalues, trace, and characteristic equations.
- Adjoint Matrix Calculator: Compute matrix minors, cofactors, and adjugate matrices.
Frequently Asked Questions
How can you tell if a matrix can undergo Cholesky decomposition?
The matrix must be square, symmetric ($A = A^T$), and positive-definite. Positive definiteness can be checked by verifying that all leading principal minors are positive ($D_1 > 0, D_2 > 0, \dots, D_n > 0$) or that all eigenvalues are strictly positive.
How do you compute the determinant of $A$ from its Cholesky factor $L$?
Because $L$ is triangular, $\det(L)$ is simply the product of its diagonal elements: $\det(L) = \prod_{i=1}^n l_{ii}$. Since $\det(A) = \det(L L^T) = (\det(L))^2$, the determinant of $A$ is $(\prod_{i=1}^n l_{ii})^2$.
Why is Cholesky decomposition preferred over LU decomposition?
For symmetric positive-definite matrices, Cholesky decomposition requires only half as many arithmetic operations (roughly $n^3 / 3$ flops compared to $2n^3 / 3$ flops for LU) and does not require pivoting for numerical stability.
What happens if the matrix has negative or zero eigenvalues?
If a matrix has zero or negative eigenvalues, it is not strictly positive-definite. During the Cholesky algorithm, a diagonal term under the square root will be zero or negative, causing the algorithm to fail.