Cholesky Decomposition
Visualize the factorization of a symmetric positive-definite matrix into a lower triangular matrix and its transpose.
By Riano · Published · Updated · Report a correction
Cholesky decomposition: reconstruct a symmetric matrix
A real symmetric positive-definite matrix A has a unique factorization A = LLT with L lower triangular and strictly positive diagonal entries. Transposing L exchanges its rows and columns. Multiplying a row of L by a row of L gives an entry of LLT, so the product is symmetric.
This module constructs A from a lower-triangular base matrix B, then computes its Cholesky factor. The adjustable entries are B11, B21, B22 and B31; B32 and B33 stay at 1, and the upper triangle stays at zero. Because B already has a positive diagonal, the resulting L agrees with B, up to floating-point arithmetic.
Why a product entry can become zero
Set B11 = 2, B21 = 2, B22 = 2 and B31 = −1. The rows of L are (2, 0, 0), (2, 2, 0) and (−1, 1, 1).
- The first diagonal entry is A11 = 22 = 4.
- The second diagonal entry is A22 = 22 + 22 = 8.
- The entry A23 is (2, 2, 0) dotted with (−1, 1, 1): −2 + 2 + 0 = 0. Symmetry also gives A32 = 0.
- The last diagonal entry is A33 = (−1)2 + 12 + 12 = 3.
| Row | A | L | LT |
|---|---|---|---|
| 1 | (4, 4, −2) | (2, 0, 0) | (2, 2, −1) |
| 2 | (4, 8, 0) | (2, 2, 0) | (0, 2, 1) |
| 3 | (−2, 0, 3) | (−1, 1, 1) | (0, 0, 1) |
The factor can also be recovered from A: L11 = √4 = 2, L21 = 4/2 = 2 and L31 = −2/2 = −1. Next, L22 = √(8 − 22) = 2, L32 = (0 − (−1)·2)/2 = 1 and L33 = √(3 − (−1)2 − 12) = 1.
Predict a sign change, then check the matrices
Open Cholesky Decomposition. Each slider edits B; the displayed matrices are A, L and LT. On a small screen, scroll the control panel for its remaining sliders and the matrix panel for later matrices and formulas.
- Set B11 to 2, B21 to 2, B22 to 2 and B31 to −1. Check A22 = 8.00 and A23 = 0.0 against the calculation above.
- Change only B31 to 1. Now A13 = 2.00, A23 = 4.00 and A33 = 3.00. Squaring the changed entry preserves A33, while the cross products change sign or magnitude.
- Keep those values and reduce B11 to its minimum 0.1. Predict the first row (0.01, 0.20, 0.10); check L11 = 0.10. The determinant of A is (0.1·2·1)2 = 0.04, so this boundary remains positive definite.
- Restore B11 to 2, then reduce B22 to 0.1. The second diagonal becomes 4.01 and A23 becomes 2.10. Check that L22 is still positive.
A guaranteed positive-definite family, not arbitrary matrix input
The positive adjustable diagonal entries lie between 0.1 and 4. Therefore B is invertible throughout the supported range. For a nonzero vector x, xTAx = xTBBTx = ‖BTx‖2 is positive. The off-diagonal sliders, ranging from −3 to 3, do not remove that guarantee.
The interface does not accept an arbitrary A, a zero diagonal in B, a singular matrix or a nonsymmetric matrix. Those are paper comparisons, not available experiments. A real symmetric positive-semidefinite matrix may have a singular triangular square root, but it lacks the strictly positive diagonal required here. For example, B = diag(0, 1, 1) would produce a singular A; zero is outside this module's diagonal controls.
The factorization uses ordinary floating-point arithmetic. Matrix cells show two decimal places for nonzero values and 0.0 for values whose magnitude is below 0.0001. Multiplying rounded displayed factors can differ slightly from the unrounded calculation. The background grid is decorative and does not encode matrix entries or a spatial transformation.
Definition and input conditions
NumPy's official Cholesky documentation describes the lower-triangular LLT factorization for real symmetric positive-definite inputs and the distinction between transpose and conjugate transpose. The matrices, row products and slider experiment above are independently calculated examples for this module.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Cholesky Decomposition module.
Try Cholesky Decomposition on Riano →