Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Cholesky Decomposition


A = L Lᵀ for a symmetric positive definite matrix — a square root on each diagonal, a division for each entry below.

Preset?The Cholesky factorization writes a symmetric positive definite matrix as A = L Lᵀ with L lower triangular and a positive diagonal — a matrix square root. It is LU with the symmetry used: only one factor is computed, the other is its transpose, and no pivoting is ever needed. It costs half of LU, and it doubles as the standard test for positive definiteness: the factorization succeeds exactly when every radicand stays positive.
Size (square)
A3× 3
Entries of A (edits are mirrored)
A3×3
4
2
2
2
5
3
2
3
6
=
L3×3
?
0
0
?
?
0
?
?
?
·
Lᵀ3×3
?
?
?
0
?
?
0
0
?
Step 1 / 8

Step explanations

1Cholesky factorization of a 3×3 matrix
A will be written as A = L Lᵀ: L lower triangular with a positive diagonal, and the second factor its own transpose — drawn on the right and filled in step with L. The zeros above the diagonal of L are known already. The entries are computed column by column: a square root on the diagonal, then a division for each entry below it. Two preconditions: A must be symmetric, and every square root must be of a positive number.
One triangular factor; the other is its transpose. Learn more about the opening scene · what it is








Key Terms

Cholesky factorizationA=LLTA = LL^T with LL lower triangular and a positive diagonal; exists exactly for symmetric positive definite AA.

SymmetricAT=AA^T = A; every entry equals its mirror image across the diagonal.

Positive definitexTAx>0\mathbf{x}^T A \mathbf{x} > 0 for every non-zero x\mathbf{x}; equivalently all eigenvalues positive, equivalently all leading principal minors positive, equivalently Cholesky succeeds.

Diagonal entryj,j=aj,jk<jj,k2\ell_{j,j} = \sqrt{a_{j,j} - \sum_{k<j} \ell_{j,k}^2}, a square root of what is left of aj,ja_{j,j} after the earlier columns are accounted for.

Below the diagonali,j=(ai,jk<ji,kj,k)/j,j\ell_{i,j} = \left(a_{i,j} - \sum_{k<j} \ell_{i,k}\ell_{j,k}\right) / \ell_{j,j}.

Radicand — the number under each square root; the factorization exists exactly when all of them are positive.

Matrix square root — the sense in which LL is one: A=LLTA = LL^T as a number is a=a = \ell \cdot \ell.

LDLTLDL^T form — the variant with unit diagonal LL and a diagonal DD, which avoids square roots.

Getting Started with the Visualizer

Choose a matrix, then watch LL fill column by column while its transpose fills alongside.

• Use the Preset pills for six matrices: a classic 3×33 \times 3 with an integer factor, a 2×22 \times 2, a 4×44 \times 4 Pascal matrix whose factor is the Pascal triangle, one whose square roots do not simplify, one that is symmetric but not positive definite, and one that is not symmetric
• Use the Size stepper for 2×22 \times 2 up to 4×44 \times 4
• Edit any entry; edits are mirrored across the diagonal so the matrix stays symmetric, since an unsymmetric matrix has no Cholesky factorization
• Press Shuffle for a random symmetric positive definite matrix, built as BBT+IBB^T + I so it is guaranteed to factor
• Hover the ? icon for a reminder of what the factorization is and why it doubles as a test
• Press play or step manually; the step log on the right lists every entry computed

Two presets stop early on purpose. The not-symmetric one stops before any arithmetic; the not-positive-definite one runs until a square root of a negative number is demanded and stops there with the explanation.

How the Factorization Runs

The visualizer computes LL one column at a time, top to bottom within each column.

Symmetry check — if any entry differs from its mirror image, the run stops: no LLTLL^T can equal an unsymmetric matrix
Diagonalj,j\ell_{j,j} is the square root of aj,ja_{j,j} minus the squares of the entries already in row jj of LL; if that radicand is not positive the run stops, because AA is not positive definite
Below the diagonal — each i,j\ell_{i,j} is ai,ja_{i,j} minus the products of the entries already in rows ii and jj, divided by j,j\ell_{j,j}
Mirror — every entry of LL appears at once in LTL^T, drawn on the right
DoneLLT=ALL^T = A, the determinant is the product of the squared diagonal, and the run reports that positive definiteness has been proved

The formulas come from writing out LLT=ALL^T = A entry by entry. Entry (i,j)(i, j) of LLTLL^T is ki,kj,k\sum_k \ell_{i,k}\ell_{j,k}, and since LL is lower triangular the sum stops at k=min(i,j)k = \min(i, j); solving that equation for the last term gives the two rules.

The Opening Scene: L and Its Transpose

The player opens with AA on the left and two empty triangles on the right: LL with its zeros above the diagonal already drawn, and LTL^T with its zeros below. At the default preset AA is the classic 3×33 \times 3.

Nothing is computed yet. What the scene establishes is that there is only one factor to find: the second is the mirror image of the first.
A3×3422253236=L3×3?00??0???·Lᵀ3×3???0??00?
Opening scene, frozen

A on the left and two empty triangles on the right: L with its zeros above the diagonal drawn, LT with its zeros below. One factor to find; the other is its mirror image.

That single factor is the whole economy of the method, and it is possible only because AA is symmetric. A product LLTLL^T is symmetric whatever LL is, so an unsymmetric AA cannot equal one; the tool checks this before doing anything, and the not-symmetric preset stops here.

Symmetry is necessary but not sufficient. The second condition, positive definiteness, is not checked up front; it reveals itself during the run, in the sign of each radicand.

A Diagonal Entry

Each column begins with its diagonal entry, a square root: j,j=aj,jk<jj,k2\ell_{j,j} = \sqrt{a_{j,j} - \sum_{k<j} \ell_{j,k}^2}, the diagonal entry of AA with the squares of the earlier entries in that row of LL subtracted.

The frozen picture below is the second diagonal entry of the classic preset: 2,2=512=2\ell_{2,2} = \sqrt{5 - 1^2} = 2, with the subtracted entry 2,1\ell_{2,1} highlighted and the value mirrored into LTL^T.
A3×3422253236=L3×32001201??·Lᵀ3×321102?00?
Second diagonal entry, frozen

2,2 = √(5 − 1²) = 2, with the subtracted entry ℓ2,1 highlighted and the value mirrored into LT. The radicand is the pivot LU would find here.

The subtraction is what makes each column depend on the ones before it. The entry a2,2a_{2,2} is 2,12+2,22\ell_{2,1}^2 + \ell_{2,2}^2 by the rule for LLTLL^T, so 2,22\ell_{2,2}^2 is what remains once the first column's contribution is removed.

The radicand is the pivot that LU would have found at this position, and its sign is the test. A positive radicand means the leading principal minor through this position is positive; the sequence of positive radicands, one per column, is exactly the statement that AA is positive definite.

An Entry Below the Diagonal

Below each diagonal entry, the entries of the column are divisions: i,j=(ai,jk<ji,kj,k)/j,j\ell_{i,j} = (a_{i,j} - \sum_{k<j} \ell_{i,k}\ell_{j,k}) / \ell_{j,j}, the entry of AA minus the products of earlier entries in rows ii and jj, divided by the diagonal entry just found.

The frozen picture below is the last such entry of the classic preset: 3,2=(311)/2=1\ell_{3,2} = (3 - 1 \cdot 1) / 2 = 1, with the divisor and the subtracted entries highlighted.
A3×3422253236=L3×320012011?·Lᵀ3×321102100?
Last off-diagonal entry, frozen

3,2 = (3 − 1·1) / 2 = 1: the entry of A minus the products of earlier entries in rows 3 and 2, divided by the diagonal entry just found.

The pattern is the row-times-row rule for LLTLL^T read backwards. Entry (3,2)(3, 2) of the product is row 33 of LL dotted with row 22 of LL, which is 3,12,1+3,22,2\ell_{3,1}\ell_{2,1} + \ell_{3,2}\ell_{2,2}; everything except 3,2\ell_{3,2} is known, so it is solved for.

Every off-diagonal entry divides by a diagonal entry, which is why the diagonal must be computed first and why it must be non-zero. Positive definiteness guarantees both, and it guarantees the division never amplifies error the way a small pivot in LU can.

When the Matrix Is Not Positive Definite

On the not-positive-definite preset the first column succeeds, 1,1=1\ell_{1,1} = 1 and 2,1=2\ell_{2,1} = 2, and the second diagonal entry demands 122=3\sqrt{1 - 2^2} = \sqrt{-3}. The run stops.

The frozen picture below is that stop: the failed position muted in both AA and LL, the first column of LL already in place.
A2×21221=L2×2102?·Lᵀ2×2120?
Not positive definite, frozen

The first column succeeded, then ℓ2,2 would be √(1 − 4). The run stops with the failed position muted: A is symmetric but indefinite, and that is the verdict, not an error.

This is not a failure of the method but its verdict. A symmetric matrix is positive definite exactly when all of its leading principal minors are positive, and the radicands are those minors divided by the previous ones; a non-positive radicand means a non-positive minor, and the quadratic form xTAx\mathbf{x}^T A \mathbf{x} takes a non-positive value somewhere.

In practice this is the standard way to test definiteness. It is cheaper than computing eigenvalues, and it either delivers the factorization or the reason none exists.

The Completed Factorization

The final scene shows LL complete and LTL^T as its mirror image, with A=LLTA = LL^T holding on screen.

The frozen picture below is the classic preset finished: LL with entries 2,1,1,2,1,22, 1, 1, 2, 1, 2, its transpose beside it, and the diagonal highlighted.
A3×3422253236=L3×3200120112·Lᵀ3×3211021002
Completed factorization, frozen

L with entries 2, 1, 1, 2, 1, 2 and its transpose beside it: A = LLT. Every radicand was positive, so A is positive definite; det A = (2·2·2)² = 64.

From here every use is a pair of triangular solves with the same factor: Ly=bL\mathbf{y} = \mathbf{b} forward, LTx=yL^T\mathbf{x} = \mathbf{y} backward. That is the same shape as LU with half the storage and half the factoring cost, and with no pivoting to organize.

Three facts are read off at once: the factorization proves AA positive definite, the determinant is the product of the squared diagonal, and LL is the matrix square root that turns independent random variables into correlated ones. For the symmetric positive definite matrices of statistics, optimization and physics, this is the factorization of first resort.

Reading the Scene Player

Each scene shows AA, LL and LTL^T with the entry being computed and the entries it depends on.

• In a diagonal scene, aj,ja_{j,j} is primary, the new j,j\ell_{j,j} is accent in both LL and LTL^T, and the earlier entries of row jj of LL that are squared and subtracted are secondary
• In an off-diagonal scene, ai,ja_{i,j} is primary, the new i,j\ell_{i,j} is accent in LL and mirrored in LTL^T, the divisor j,j\ell_{j,j} is primary, and the earlier entries of rows ii and jj whose products are subtracted are secondary
• In the stop scenes, the offending entries are highlighted: mismatched pairs for an unsymmetric matrix, the failed diagonal position for a non-positive-definite one
• In the done scene, the diagonal of LL and LTL^T is accent and the rest secondary
• The known zeros of LL above the diagonal and of LTL^T below it are drawn in grey from the first scene; irrational entries are shown to three decimals

Choosing a Matrix

The six presets each make a different point.

Classic 3×33 \times 3 — radicands 44, 44 and 44, so every square root is 22 and every division is exact; LL has entries 2,1,1,2,1,22, 1, 1, 2, 1, 2
2×22 \times 2 — one square root, one division, one more square root; the whole pattern in three steps
Pascal 4×44 \times 4 — the symmetric Pascal matrix factors as the lower Pascal triangle times its transpose, a classic identity made visible
Irrational factor — the tridiagonal matrix with 22 on the diagonal and 11 beside it; the radicands are 2,32,432, \tfrac{3}{2}, \tfrac{4}{3} and the square roots do not simplify
Not positive definite — symmetric, with 11 on the diagonal and 22 off it; the second radicand is 14=31 - 4 = -3 and the run stops
Not symmetric — the run stops before any arithmetic, because LLTLL^T is always symmetric

Shuffle never produces a failing matrix; edit an entry by hand to see the tests trip.

What the Cholesky Factorization Is

A symmetric positive definite matrix AA can be written as

A=LLTA = LL^T


with LL lower triangular and its diagonal positive, and with those conditions the factor is unique. It is the matrix version of a square root: for a positive number, a=a = \ell \cdot \ell.

The formulas follow from multiplying out. Entry (i,j)(i, j) of LLTLL^T, for iji \geq j, is kji,kj,k\sum_{k \leq j} \ell_{i,k}\ell_{j,k}. Setting this equal to ai,ja_{i,j} and solving for the last term of the sum gives

j,j=aj,jk<jj,k2,i,j=ai,jk<ji,kj,kj,j\ell_{j,j} = \sqrt{a_{j,j} - \sum_{k<j} \ell_{j,k}^2}, \qquad \ell_{i,j} = \frac{a_{i,j} - \sum_{k<j} \ell_{i,k}\ell_{j,k}}{\ell_{j,j}}


Computed column by column, every quantity on the right is already known when it is needed, which is the order the tool follows.

The connection to LU is direct. For a symmetric matrix, Gaussian elimination without pivoting gives A=LUA = LU with U=DLTU = DL^T, where DD is the diagonal of pivots; positive definiteness makes every pivot positive, so D=D1/2D1/2D = D^{1/2}D^{1/2} and A=(LD1/2)(LD1/2)TA = (LD^{1/2})(LD^{1/2})^T. Cholesky's LL is LD1/2LD^{1/2}, and the pivots of elimination are the squared diagonal entries of the factor. That is also why no pivoting is ever needed: positive definiteness guarantees every pivot is positive before it is reached.

For the full treatment, including the LDLTLDL^T variant and the equivalent characterizations of positive definiteness, see the Cholesky decomposition theory page.

Key Properties

The factorization inherits the strong properties of its class.

Existence and uniqueness: exactly for symmetric positive definite AA, with LL unique once its diagonal is required positive
Test for positive definiteness: a symmetric matrix is positive definite exactly when the factorization runs to completion with all radicands positive — the cheapest test in practice
No pivoting: every pivot is positive, so rows are never swapped and the factorization is numerically stable as it stands
Half the cost of LU: about 13n3\tfrac{1}{3}n^3 operations, since only one triangular factor is computed
Determinant: detA=(detL)2=jj,j2\det A = (\det L)^2 = \prod_j \ell_{j,j}^2, always positive
Solving systems: Ax=bA\mathbf{x} = \mathbf{b} becomes Ly=bL\mathbf{y} = \mathbf{b} then LTx=yL^T\mathbf{x} = \mathbf{y}, two triangular solves sharing one factor
Relation to LU: the pivots of elimination are j,j2\ell_{j,j}^2; LCholesky=LLUD1/2L_{\text{Cholesky}} = L_{\text{LU}} D^{1/2}
Inverse: A1=LTL1A^{-1} = L^{-T}L^{-1}, and L1L^{-1} is easy because LL is triangular
Semidefinite case: if some radicand is exactly zero, AA is positive semidefinite and a factorization still exists, but it is no longer unique

Why It Matters

Symmetric positive definite matrices are everywhere, and Cholesky is how they are handled.

Normal equations: ATAA^TA in least squares is symmetric positive definite whenever AA has independent columns, and Cholesky is the classical way to solve ATAx=ATbA^TA\mathbf{x} = A^T\mathbf{b}
Covariance matrices: symmetric positive definite by construction; their Cholesky factors generate correlated random samples from independent ones, x=Lz\mathbf{x} = L\mathbf{z}
Optimization: Hessians at a minimum, Newton steps, and interior-point methods all factor SPD matrices at every iteration
Physics and engineering: stiffness, mass and conductance matrices are SPD, and finite-element solvers rely on Cholesky or its sparse variants
Gaussian processes and Kalman filters: kernel matrices and covariance updates are factored this way for both speed and stability
The definiteness test: asking whether a quadratic form is positive, or a critical point is a minimum, comes down to whether Cholesky succeeds

Worked Example

Take the classic preset,

A=(422253236)A = \begin{pmatrix} 4 & 2 & 2 \\ 2 & 5 & 3 \\ 2 & 3 & 6 \end{pmatrix}


Column 1. 1,1=4=2\ell_{1,1} = \sqrt{4} = 2. Then 2,1=2/2=1\ell_{2,1} = 2 / 2 = 1 and 3,1=2/2=1\ell_{3,1} = 2 / 2 = 1.

Column 2. 2,2=52,12=51=2\ell_{2,2} = \sqrt{5 - \ell_{2,1}^2} = \sqrt{5 - 1} = 2. Then 3,2=(33,12,1)/2,2=(31)/2=1\ell_{3,2} = (3 - \ell_{3,1}\ell_{2,1}) / \ell_{2,2} = (3 - 1) / 2 = 1.

Column 3. 3,3=63,123,22=611=2\ell_{3,3} = \sqrt{6 - \ell_{3,1}^2 - \ell_{3,2}^2} = \sqrt{6 - 1 - 1} = 2.

L=(200120112),LLT=(422253236)=AL = \begin{pmatrix} 2 & 0 & 0 \\ 1 & 2 & 0 \\ 1 & 1 & 2 \end{pmatrix}, \qquad LL^T = \begin{pmatrix} 4 & 2 & 2 \\ 2 & 5 & 3 \\ 2 & 3 & 6 \end{pmatrix} = A


Check row 33 of LLTLL^T against row 33 of AA: (1,1,2)(2,0,0)=2(1, 1, 2) \cdot (2, 0, 0) = 2, (1,1,2)(1,2,0)=3(1, 1, 2) \cdot (1, 2, 0) = 3, (1,1,2)(1,1,2)=6(1, 1, 2) \cdot (1, 1, 2) = 6. The determinant is (222)2=64(2 \cdot 2 \cdot 2)^2 = 64, and every radicand was positive, so AA is positive definite.

For contrast, the not-positive-definite preset has 1,1=1\ell_{1,1} = 1, 2,1=2\ell_{2,1} = 2, and then 2,2=14\ell_{2,2} = \sqrt{1 - 4}, which does not exist. Its eigenvalues are 33 and 1-1: symmetric, but indefinite.

Common Mistakes

A few mistakes recur.

Applying it to an unsymmetric matrixLLTLL^T is symmetric no matter what LL is, so there is nothing to find; use LU
Skipping the subtraction — from column 22 on, the radicand and the numerators include the contributions of earlier columns; using aj,ja_{j,j} alone gives wrong entries
Using the wrong rows in the productsi,j\ell_{i,j} subtracts ki,kj,k\sum_k \ell_{i,k}\ell_{j,k}, entries from row ii paired with entries from row jj, over the columns already done
Taking the negative square root — either sign gives a valid factor, but the convention is positive, and it is what makes LL unique
Reading a negative radicand as an arithmetic slip — it may well be the correct conclusion: the matrix is not positive definite
Confusing positive entries with positive definiteness — a matrix of positive numbers can fail the test, and a matrix with negative off-diagonal entries can pass it