Skip to content
Math

Cholesky Decomposition Calculator

Enter a symmetric, positive-definite matrix and this calculator finds the lower triangular factor L such that A = L times L^T. Choose a 2x2 or 3x3 matrix, fill in the entries, and the tool instantly shows L, the LDL^T decomposition, the matrix determinant, a full step-by-step derivation, and a verification that L times L^T reconstructs the original matrix.

Your details

Choose the dimension of the square matrix to decompose.
Element in row 1, column 1 of matrix A.
Element in row 1, column 2 of matrix A. Must equal A[2,1] for symmetry.
Element in row 1, column 3 of matrix A. Must equal A[3,1] for symmetry.
Element in row 2, column 1 of matrix A. Must equal A[1,2] for symmetry.
Element in row 2, column 2 of matrix A.
Element in row 2, column 3 of matrix A. Must equal A[3,2] for symmetry.
Element in row 3, column 1 of matrix A. Must equal A[1,3] for symmetry.
Element in row 3, column 2 of matrix A. Must equal A[2,3] for symmetry.
Element in row 3, column 3 of matrix A.
L[1,1]
2

Diagonal element of L, row 1

L[2,1]1
L[2,2]3
L[3,1]-1
L[3,2]1
L[3,3]1.732051
det(A)108
Symmetric?Yes
Positive definite?Yes
Reconstruction error ||A - LL^T||0
L[1,1]2
L[2,2]3
L[3,3]1.732051

Cholesky decomposition succeeded for your 3x3 matrix.

  • The lower triangular factor L has diagonal entries 2, 3, 1.732051, all positive, confirming positive definiteness.
  • det(A) = 108, computed cheaply as the square of the product of L's diagonal elements.
  • Reconstruction error ||A - LL^T|| is 0.00e+0, showing the factorization is numerically exact.
  • Once L is known, you can solve Ax = b in two back-substitution passes (Ly = b, then L^T x = y), which is about twice as fast as LU decomposition for symmetric systems.

Next stepTo solve a linear system Ax = b, use L to perform forward substitution (Ly = b), then back substitution (L^T x = y).

LDL^T Decomposition (unit lower triangular L, diagonal D)

ElementL row (unit lower triangular)D (diagonal)
Row 1L[1,1]=1, L[1,2]=0, L[1,3]=0D[1]=4
Row 2L[2,1]=0.333333, L[2,2]=1, L[2,3]=0D[2]=9
Row 3L[3,1]=-0.57735, L[3,2]=0.57735, L[3,3]=1D[3]=3

LDL^T is a square-root-free variant of Cholesky. A = L * D * L^T where L has ones on the diagonal and D holds the squared diagonal entries of the standard Cholesky L.

Formula

Lkk=Akkj=1k1Lkj2,Lik=1Lkk ⁣(Aikj=1k1LijLkj) for i>kL_{kk} = \sqrt{A_{kk} - \sum_{j=1}^{k-1} L_{kj}^2}, \quad L_{ik} = \frac{1}{L_{kk}}\!\left(A_{ik} - \sum_{j=1}^{k-1} L_{ij} L_{kj}\right) \text{ for } i > k

Worked example

For the 3x3 matrix A = [[4,2,-2],[2,10,2],[-2,2,5]]: L[1,1] = sqrt(4) = 2; L[2,1] = 2/2 = 1; L[2,2] = sqrt(10 - 1^2) = 3; L[3,1] = -2/2 = -1; L[3,2] = (2 - (-1)(1))/3 = 1; L[3,3] = sqrt(5 - (-1)^2 - 1^2) = sqrt(3) approx 1.7321. The result is A = L * L^T.

What is the Cholesky decomposition?

The Cholesky decomposition (also called Cholesky factorization) expresses a symmetric, positive-definite matrix A as the product A = L times L^T, where L is a lower triangular matrix with strictly positive diagonal entries and L^T is its transpose. It was developed by French military officer Andre-Louis Cholesky around 1910 for geodetic calculations and remains one of the most widely used matrix algorithms today. A matrix is positive definite when every quadratic form x^T A x is strictly positive for any nonzero vector x. In practice, this means all eigenvalues are positive, all leading principal minors have positive determinant, and all diagonal entries of the Cholesky factor are real and positive. The decomposition exists and is unique for any symmetric positive-definite matrix.

How to use this calculator

Select either a 2x2 or 3x3 matrix using the size selector. Enter every element of the matrix in the corresponding fields. The off-diagonal entries must satisfy the symmetry condition A[i,j] = A[j,i]. If they do not match, the calculator reports the matrix as non-symmetric. If the matrix is not positive definite - meaning some diagonal entry of the intermediate computation becomes negative under the square root - the calculator will report failure and flag the matrix as not positive definite. When the decomposition succeeds, you see: all elements of L, the matrix determinant det(A) computed from the diagonal of L, and the LDL^T table showing the square-root-free variant. The reconstruction error ||A - LL^T|| confirms numerical accuracy.

The Cholesky algorithm step by step

The algorithm processes columns from left to right. For each column k: 1. Diagonal: L[k,k] = sqrt(A[k,k] - sum of L[k,j]^2 for j from 1 to k-1). This requires the running square root at each step. 2. Off-diagonals: for each row i below k, compute L[i,k] = (A[i,k] - sum of L[i,j]*L[k,j] for j from 1 to k-1) divided by L[k,k]. The total operation count is approximately n^3 / 3 floating-point operations, exactly half that of the general LU decomposition, which is why Cholesky is preferred whenever the matrix is known to be symmetric positive-definite.

The LDL^T variant and applications

The LDL^T decomposition (shown in the table below the result) avoids the square roots entirely. It writes A = L * D * L^T where L is a unit lower triangular matrix (ones on the diagonal) and D is a diagonal matrix. The diagonal entries of D are simply the squares of the diagonal entries of the standard Cholesky L. LDL^T is useful in contexts where floating-point square roots are expensive or when working with integer matrices. Common applications include: solving symmetric positive-definite linear systems Ax = b (two triangular substitutions take only n^2 operations each once L is known), computing the log-determinant log(det A) = 2 * sum(log(L[i,i])) which appears in Gaussian likelihood calculations, Kalman filtering in control theory and navigation, finite-element method stiffness matrices, Monte Carlo simulation of correlated random variables, and principal component analysis covariance matrices.

Cholesky vs. LU decomposition: key differences

PropertyCholesky (A = LL^T)LU decomposition (A = LU)
Matrix requirementSymmetric positive definiteSquare (general)
Operation countn^3 / 3 flops2n^3 / 3 flops
Memoryn(n+1)/2 entries (lower triangle)n^2 entries
Numerical stabilityInherently stable - no pivoting neededNeeds partial pivoting for stability
Pivot strategyNone requiredPartial or full pivoting
Determinantdet(A) = (product of L diagonals)^2det(A) = product of U diagonals
Inverse solve cost2 triangular solves2 triangular solves

Comparison of Cholesky and general LU factorization for n x n symmetric positive-definite matrices.

Frequently asked questions

What does it mean for a matrix to be positive definite?

A symmetric matrix A is positive definite if the scalar x^T A x is strictly greater than zero for every nonzero vector x. Equivalently, all eigenvalues are strictly positive, all determinants of leading submatrices are positive, and all diagonal entries of the Cholesky factor are real and positive. Covariance matrices in statistics and stiffness matrices in structural engineering are the most common examples of positive definite matrices in practice.

Why does Cholesky decomposition require a symmetric matrix?

The decomposition A = L * L^T is inherently symmetric: the product of any matrix with its transpose is always symmetric. So the factorization can only represent a symmetric matrix. More precisely, the algorithm exploits symmetry to process only the lower triangle of A, halving both storage and computation compared to a general factorization. If your matrix is not symmetric, you need LU decomposition (or QR for least-squares problems) instead.

How do I test whether a matrix is positive definite before computing?

The most reliable test is to attempt the Cholesky decomposition itself: if every diagonal entry L[k,k] computed by the algorithm is strictly positive (no negative value appears under a square root), the matrix is positive definite. Other approaches include checking that all eigenvalues are positive, or verifying that all leading principal minor determinants are positive. This calculator runs the factorization and reports the result directly.

What is the LDL^T decomposition and when should I use it?

LDL^T writes A = L * D * L^T where L is unit lower triangular (ones on the diagonal) and D is diagonal. It avoids computing any square roots, which is beneficial in exact arithmetic (integer or rational matrices) or on processors without fast square-root hardware. The diagonal of D holds the squares of the Cholesky diagonal entries. Both decompositions are equivalent and can be converted to each other in O(n) extra operations.

Can Cholesky decomposition be used to solve a linear system Ax = b?

Yes, and that is one of its primary applications. Once L is known, solve Ly = b by forward substitution, then solve L^T x = y by back substitution. Each step is O(n^2) once L is available. Because Cholesky is twice as fast as LU for symmetric positive-definite systems and is numerically stable without pivoting, it is the standard solver for such systems in scientific computing libraries like LAPACK.

What happens if I enter a matrix that is not positive definite?

The algorithm will fail at the step where a diagonal entry would require the square root of a negative number. This calculator detects this condition and reports that the matrix is not positive definite, returning no numeric results. Common causes include a matrix that is only positive semi-definite (has a zero eigenvalue), a matrix with negative diagonal entries, or one that is not actually symmetric.

Sources

Written by Dr. Rajiv Menon, PhD Applied Mathematician · Bengaluru, India

Applied mathematician bridging algebraic theory and computational tools for students, engineers, and everyday problem-solvers.

Search 3,500+ calculators

Loading search…