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.
Cholesky factorization — A=LLT with L lower triangular and a positive diagonal; exists exactly for symmetric positive definite A.
Symmetric — AT=A; every entry equals its mirror image across the diagonal.
Positive definite — xTAx>0 for every non-zero x; equivalently all eigenvalues positive, equivalently all leading principal minors positive, equivalently Cholesky succeeds.
Diagonal entry — ℓj,j=aj,j−∑k<jℓj,k2, a square root of what is left of aj,j after the earlier columns are accounted for.
Below the diagonal — ℓi,j=(ai,j−∑k<jℓi,kℓj,k)/ℓ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 L is one: A=LLT as a number is a=ℓ⋅ℓ.
LDLT form — the variant with unit diagonal L and a diagonal D, which avoids square roots.
Getting Started with the Visualizer
Choose a matrix, then watch L fill column by column while its transpose fills alongside.
• Use the Preset pills for six matrices: a classic 3×3 with an integer factor, a 2×2, a 4×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×2 up to 4×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+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 L 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 LLT can equal an unsymmetric matrix • Diagonal — ℓj,j is the square root of aj,j minus the squares of the entries already in row j of L; if that radicand is not positive the run stops, because A is not positive definite • Below the diagonal — each ℓi,j is ai,j minus the products of the entries already in rows i and j, divided by ℓj,j • Mirror — every entry of L appears at once in LT, drawn on the right • Done — LLT=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=A entry by entry. Entry (i,j) of LLT is ∑kℓi,kℓj,k, and since L is lower triangular the sum stops at 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 A on the left and two empty triangles on the right: L with its zeros above the diagonal already drawn, and LT with its zeros below. At the default preset A is the classic 3×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.
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 A is symmetric. A product LLT is symmetric whatever L is, so an unsymmetric A 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,j−∑k<jℓj,k2, the diagonal entry of A with the squares of the earlier entries in that row of L subtracted.
The frozen picture below is the second diagonal entry of the classic preset: ℓ2,2=5−12=2, with the subtracted entry ℓ2,1 highlighted and the value mirrored into LT.
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,2 is ℓ2,12+ℓ2,22 by the rule for LLT, so ℓ2,22 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 A is positive definite.
An Entry Below the Diagonal
Below each diagonal entry, the entries of the column are divisions: ℓi,j=(ai,j−∑k<jℓi,kℓj,k)/ℓj,j, the entry of A minus the products of earlier entries in rows i and j, divided by the diagonal entry just found.
The frozen picture below is the last such entry of the classic preset: ℓ3,2=(3−1⋅1)/2=1, with the divisor and the subtracted entries highlighted.
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 LLT read backwards. Entry (3,2) of the product is row 3 of L dotted with row 2 of L, which is ℓ3,1ℓ2,1+ℓ3,2ℓ2,2; everything except ℓ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 and ℓ2,1=2, and the second diagonal entry demands 1−22=−3. The run stops.
The frozen picture below is that stop: the failed position muted in both A and L, the first column of L already in place.
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 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 L complete and LT as its mirror image, with A=LLT holding on screen.
The frozen picture below is the classic preset finished: L with entries 2,1,1,2,1,2, its transpose beside it, and the diagonal highlighted.
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=b forward, LTx=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 A positive definite, the determinant is the product of the squared diagonal, and L 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 A, L and LT with the entry being computed and the entries it depends on.
• In a diagonal scene, aj,j is primary, the new ℓj,j is accent in both L and LT, and the earlier entries of row j of L that are squared and subtracted are secondary • In an off-diagonal scene, ai,j is primary, the new ℓi,j is accent in L and mirrored in LT, the divisor ℓj,j is primary, and the earlier entries of rows i and j 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 L and LT is accent and the rest secondary • The known zeros of L above the diagonal and of LT 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×3 — radicands 4, 4 and 4, so every square root is 2 and every division is exact; L has entries 2,1,1,2,1,2 • 2×2 — one square root, one division, one more square root; the whole pattern in three steps • Pascal 4×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 2 on the diagonal and 1 beside it; the radicands are 2,23,34 and the square roots do not simplify • Not positive definite — symmetric, with 1 on the diagonal and 2 off it; the second radicand is 1−4=−3 and the run stops • Not symmetric — the run stops before any arithmetic, because LLT 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 A can be written as
A=LLT
with L 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=ℓ⋅ℓ.
The formulas follow from multiplying out. Entry (i,j) of LLT, for i≥j, is ∑k≤jℓi,kℓj,k. Setting this equal to ai,j and solving for the last term of the sum gives
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=LU with U=DLT, where D is the diagonal of pivots; positive definiteness makes every pivot positive, so D=D1/2D1/2 and A=(LD1/2)(LD1/2)T. Cholesky's L is LD1/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 LDLT 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 A, with L 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 31n3 operations, since only one triangular factor is computed • Determinant: detA=(detL)2=∏jℓj,j2, always positive • Solving systems: Ax=b becomes Ly=b then LTx=y, two triangular solves sharing one factor • Relation to LU: the pivots of elimination are ℓj,j2; LCholesky=LLUD1/2 • Inverse: A−1=L−TL−1, and L−1 is easy because L is triangular • Semidefinite case: if some radicand is exactly zero, A 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: ATA in least squares is symmetric positive definite whenever A has independent columns, and Cholesky is the classical way to solve ATAx=ATb • Covariance matrices: symmetric positive definite by construction; their Cholesky factors generate correlated random samples from independent ones, x=Lz • 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
Column 1.ℓ1,1=4=2. Then ℓ2,1=2/2=1 and ℓ3,1=2/2=1.
Column 2.ℓ2,2=5−ℓ2,12=5−1=2. Then ℓ3,2=(3−ℓ3,1ℓ2,1)/ℓ2,2=(3−1)/2=1.
Column 3.ℓ3,3=6−ℓ3,12−ℓ3,22=6−1−1=2.
L=211021002,LLT=422253236=A
Check row 3 of LLT against row 3 of A: (1,1,2)⋅(2,0,0)=2, (1,1,2)⋅(1,2,0)=3, (1,1,2)⋅(1,1,2)=6. The determinant is (2⋅2⋅2)2=64, and every radicand was positive, so A is positive definite.
For contrast, the not-positive-definite preset has ℓ1,1=1, ℓ2,1=2, and then ℓ2,2=1−4, which does not exist. Its eigenvalues are 3 and −1: symmetric, but indefinite.
Common Mistakes
A few mistakes recur.
• Applying it to an unsymmetric matrix — LLT is symmetric no matter what L is, so there is nothing to find; use LU • Skipping the subtraction — from column 2 on, the radicand and the numerators include the contributions of earlier columns; using aj,j alone gives wrong entries • Using the wrong rows in the products — ℓi,j subtracts ∑kℓi,kℓj,k, entries from row i paired with entries from row j, 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 L 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
Related Concepts
LU decomposition — the general factorization that Cholesky specializes; the pivots of LU are the squared diagonal of L.
Symmetric matrices — the class this applies to, and whose transpose invariance makes one factor enough.
Positive definiteness — the condition, tested by the factorization itself.
Determinant — the product of the squared diagonal, always positive here.
Least squares — the normal equations are the classic SPD system.
Eigenvalues — all positive for an SPD matrix, though Cholesky never computes them.
QR decomposition — the other route to least squares, avoiding ATA altogether.
Matrix square root — the idea Cholesky makes concrete for triangular factors.