Advertisement

Cholesky decomposition calculator

Choose the matrix size and enter a symmetric matrix row by row. The Cholesky factor L is lower triangular, and L times its transpose returns the original matrix.

Calculator

Lower triangular factor L
2, 0, 0; 6, 1, 0; -8, 5, 3
L times L transpose
4, 12, -16; 12, 37, -43; -16, -43, 98
Result
Symmetric positive definite: a real lower triangular factor exists.

Advertisement

How this calculator works

Cholesky decomposition writes a symmetric positive definite matrix A as L L transpose, where L is lower triangular with positive diagonal entries. It is half the work of an LU decomposition and is used for solving linear systems, least squares and sampling correlated random values. If the matrix is not symmetric, or if an elimination step produces a non-positive diagonal value, no real factor exists and the calculator reports the problem instead of returning a partial answer.

Formula

A = L L^T. For j from 1 to n: Ljj = sqrt(Ajj - sum of Ljk^2 for k < j), and Lij = (Aij - sum of Lik Ljk for k < j) / Ljj for i > j.

Worked example

For the 2 by 2 matrix with rows 4, 2 and 2, 3, L has first column 2 and 1, so L is 2, 0; 1, sqrt(2). Squaring gives back 4, 2; 2, 1 + 2 = 3. The classic 3 by 3 example with rows 4, 12, -16; 12, 37, -43; -16, -43, 98 factors as 2, 0, 0; 6, 1, 0; -8, 5, 3.

Advertisement

Frequently asked questions

When does a real Cholesky factor exist?

Exactly when the matrix is symmetric and positive definite. A symmetric matrix with a negative or zero eigenvalue has no real Cholesky factor.

How is this related to LU decomposition?

Cholesky is a special symmetric version of LU. It stores only the triangular factor instead of separate L and U matrices, which saves space.

Why does the diagonal have to stay positive?

Each diagonal step takes a square root of a pivot. A non-positive pivot means the matrix is not positive definite, so a real square root would not exist.

Sources

Advertisement