MatrixCalc

Cholesky decomposition calculator

Factor a symmetric positive definite matrix as A = L·Lᵀ, with every step shown. Twice as fast as LU, and the failure itself is the standard test for positive definiteness.

Matrix A
rows: 3
cols: 3
Matrix B
rows: 3
cols: 3
Operations

Open the steps below to see the full answer.

Result
Pick an operation to see the result here. Errors will show up in this area.

Tips: adjust sizes (max 50×50). For A×B, cols(A)=rows(B). det/inverse/trace/power require square matrices.

React, Tailwind & shadcn/ui. No external math deps. — English

Cholesky decomposition writes a matrix as A = L·Lᵀ, where L is lower triangular — a square root for matrices. Press Cholesky(A) and open the steps to see L built one column at a time.

When it applies

The matrix must be symmetric and positive definite. Symmetric means A = Aᵀ; positive definite means every eigenvalue is greater than zero. That sounds restrictive, but the matrices this describes are everywhere: covariance matrices, Gram matrices, the normal equations of least squares, and the stiffness matrices of finite element analysis are all symmetric positive definite by construction.

Where LU decomposition produces two triangular factors, Cholesky produces one and derives the other by transposing it. That halves both the arithmetic and the storage, and it needs no pivoting to stay stable — which is why solvers test for symmetry first and reach for Cholesky whenever they can.

Worked example

42
25
=
20
12
·
21
02

Each diagonal entry of L is a square root — here √4 = 2 and √(5 − 1²) = 2 — which is why the method needs the quantity under every root to stay positive. That requirement is exactly positive definiteness, and it turns the algorithm into a test: if the decomposition completes, the matrix is positive definite; if it hits a non-positive value under a root, it is not.

Common mistakes

  • Applying it to a non-symmetric matrix. A = L·Lᵀ is symmetric by construction, so a non-symmetric input has no such factorisation. Use LU.
  • Assuming symmetry is enough. A symmetric matrix with a negative eigenvalue is indefinite and will fail mid-algorithm.
  • Expecting integer factors. The diagonal involves square roots, so L is usually irrational even when A is not.
  • Confusing L·Lᵀ with Lᵀ·L. The order matters; both are symmetric but they are not the same matrix.

Frequently asked questions

What is a positive definite matrix?
A symmetric matrix whose eigenvalues are all strictly positive — equivalently, one where xᵀAx > 0 for every non-zero vector x.
What happens if my matrix is not positive definite?
The algorithm reaches a square root of a non-positive number and stops. That failure is informative: it is the standard numerical test for positive definiteness.
How is Cholesky different from LU decomposition?
LU works on any square matrix and gives two distinct triangular factors. Cholesky needs symmetry and positive definiteness, gives a single factor plus its transpose, and costs about half as much.
Why is Cholesky preferred in practice?
It is twice as fast, uses half the memory, and is numerically stable without pivoting. Whenever a solver knows a matrix is symmetric positive definite, it uses Cholesky.

Want the full explanation? Read the guide: LU decomposition, step by step

Other calculators