Cholesky Decomposition Matrix Calculator With Steps

Symmetric positive-definite factorization bench

Cholesky Decomposition Calculator

Factor a real symmetric 3×3 matrix as A = LLᵀ. The bench verifies symmetry, stops at the exact non-positive pivot, displays the lower-triangular factor, reconstructs the input, and reports leading principal minors and numerical residuals.

Default symmetric positive-definite matrixL diagonal: 2, 3, √7

The three leading principal minors are 4, 36, and 252; reconstructed maximum residual is zero at displayed precision.

Enter all nine matrix entries

The calculator does not silently average Aᵢⱼ and Aⱼᵢ. If entries differ beyond the entered tolerance, it reports asymmetry.

Factorization and diagnostics

Matrix qualificationSymmetric positive definite
Maximum reconstruction residual0.000000
L
2.0000000.0000000.000000
1.0000003.0000000.000000
1.0000001.0000002.645751
×
Lᵀ
2.0000001.0000001.000000
0.0000003.0000001.000000
0.0000000.0000002.645751
=
LLᵀ
4.0000002.0000002.000000
2.00000010.0000004.000000
2.0000004.0000009.000000
Leading minor Δ₁4.000000
Leading minor Δ₂36.000000
Leading minor Δ₃ = det(A)252.000000

Residual A − LLᵀ

0.0000000.0000000.000000
0.0000000.0000000.000000
0.0000000.0000000.000000

The factor uses unrounded arithmetic. Displayed L entries are rounded, so multiplying only the printed values can create a small residual not present in the internal reconstruction.

What Cholesky decomposition produces

For a real symmetric positive-definite matrix A, Cholesky decomposition produces a lower-triangular matrix L with positive diagonal entries such that A = LLᵀ. Some references instead use an upper-triangular factor R and write A = RᵀR. The two conventions are transposes of one another.

The default factor is L = [[2,0,0],[1,3,0],[1,1,√7]]. Multiplying it by its transpose reconstructs [[4,2,2],[2,10,4],[2,4,9]]. The factor is unique when its diagonal is required to be positive.

Entry-by-entry algorithm

Lᵢᵢ = square root of [Aᵢᵢ − sum from k<i of Lᵢₖ²]
Lⱼᵢ = [Aⱼᵢ − sum from k<i of LⱼₖLᵢₖ] ÷ Lᵢᵢ for j>i

The calculation moves by columns. It computes a diagonal pivot from prior columns, verifies that the pivot is positive, takes its square root, then fills entries below it. Values above the diagonal are zero by definition.

Default first column

The first pivot is A₁₁ = 4, so L₁₁ = 2. The entries below are L₂₁ = 2 ÷ 2 = 1 and L₃₁ = 2 ÷ 2 = 1. No earlier-column products exist in this first step.

The second pivot is A₂₂ − L₂₁² = 10 − 1 = 9, so L₂₂ = 3. Then L₃₂ = (A₃₂ − L₃₁L₂₁) ÷ L₂₂ = (4 − 1) ÷ 3 = 1.

Default final pivot

The last pivot is A₃₃ − L₃₁² − L₃₂² = 9 − 1 − 1 = 7. Therefore L₃₃ = √7 ≈ 2.645751. A zero pivot would indicate positive semidefiniteness or singularity under exact symmetric arithmetic; a negative pivot indicates the matrix is not positive definite.

The calculator stops rather than taking a real square root of a non-positive pivot. A tiny negative value from floating-point rounding in a theoretically positive matrix may require higher precision or a stable specialist library, not arbitrary deletion of the sign.

Symmetry is checked explicitly

A real Cholesky factorization in this form requires Aᵢⱼ = Aⱼᵢ. The interface accepts all nine entries so transcription mistakes are visible. It reports the largest mirrored difference when the entered tolerance is exceeded; it does not silently replace the pair with an average.

A covariance estimate may appear slightly asymmetric after unrelated rounding or data-processing paths. Resolve the source and use a principled symmetrization method only when justified. Making a matrix symmetric does not guarantee it becomes positive definite.

Positive definite versus semidefinite

A symmetric matrix is positive definite when xᵀAx is positive for every nonzero real vector x. Positive semidefinite permits zero. Standard Cholesky with positive diagonal needs positive definiteness; a semidefinite matrix can create a zero pivot and division problem.

Pivoted, modified, or LDLᵀ methods can address other cases, but they answer different numerical questions. Do not add a diagonal “jitter” merely to force success without recording its size and effect on the model.

Sylvester’s criterion and leading minors

For a real symmetric matrix, positive definiteness is equivalent to all leading principal minors being positive. The default minors are Δ₁ = 4, Δ₂ = determinant [[4,2],[2,10]] = 36, and Δ₃ = det(A) = 252.

The calculator reports those three diagnostics. Positive minors support the factorization but do not replace the symmetry check. The full determinant alone is insufficient: an indefinite matrix can have a positive determinant in even dimension.

Reconstruction is a numerical audit

After computing L, the calculator forms LLᵀ and subtracts it from A cell by cell. The maximum absolute residual summarizes the worst reconstruction error. Default exact inputs produce residuals near machine precision, displayed as zeros at six decimals.

Residual size should be interpreted relative to input scale and numerical precision. An absolute residual of 10⁻⁸ can be negligible for million-scale entries but material for nanometer-scale data. Specialist software often reports relative or normwise backward error.

Solving a linear system

If Ax = b and A = LLᵀ, first solve Ly = b by forward substitution, then solve Lᵀx = y by backward substitution. Triangular solves are efficient and avoid computing an explicit inverse. This calculator factors A but does not accept b.

For repeated right-hand sides with the same SPD matrix, factor once and reuse L. Recompute when A changes. Validate conditioning because an exact-looking factor does not ensure a sensitive system yields reliable x under noisy data.

Covariance and correlation matrices

Valid covariance matrices are symmetric positive semidefinite; full-rank covariance matrices are positive definite. Cholesky factors are used to transform independent standard variables into correlated variables, evaluate multivariate normal likelihoods, and solve generalized least-squares problems.

Sample covariance can be singular when variables are redundant or observations are too few. Rounding a correlation matrix can also destroy positive definiteness. Diagnose the data and model before forcing a factor.

Numerical stability and conditioning

Cholesky is generally efficient and stable for SPD systems, using roughly half the storage of a full matrix and fewer operations than general LU factorization. Yet an ill-conditioned matrix can amplify data and rounding error. Scaling and a numerically robust library matter.

This browser implementation is educational, fixed at 3×3, and uses JavaScript double precision. Production scientific work should use tested linear-algebra libraries with condition estimation, error handling, and suitable precision.

Why not use LU for everything

LU factorization applies more broadly to square matrices and may use pivoting. Cholesky exploits symmetry and positive definiteness, providing a simpler factor with favorable efficiency. Choosing it also asserts important structure that should be verified.

If A is nonsymmetric or indefinite, use a method designed for that structure. Applying Cholesky formulas to the lower triangle while ignoring a different upper triangle does not factor the entered matrix.

Rounding discipline

Do not round L after every step. The calculator retains full floating-point values and rounds only the display. If you manually verify, carry extra digits; multiplying 2.645751 instead of √7 creates a small final difference.

It does not use this matrix factorization as a substitute for its own production logic.

Failure diagnostics

Asymmetry should prompt input correction or model review. A non-positive first pivot points to A₁₁. A later failure means the corresponding Schur-complement pivot is non-positive after earlier columns are removed. The location helps debugging but does not identify the scientific cause.

Check units, duplicated variables, linear dependence, sign errors, covariance construction, missing-data handling, and rounding. Preserve the failed matrix and tolerance so another analyst can reproduce the issue.

Pre-factorization input audit

Before treating a successful factorization as evidence that a model is sound, identify what every row and column represents and confirm that both use the same ordering. A symmetric-looking matrix can still be wrong when one side was exported as age, income, balance while the other side was interpreted as income, age, balance. Confirm signs and units from the originating data rather than from the rounded display. If the matrix is a covariance matrix, diagonal entries are variances and therefore cannot be negative; off-diagonal entries must use compatible paired observations and the same missing-data rule.

Large scale differences deserve attention. A matrix containing a variance near one trillion beside another near one millionth may be mathematically positive definite yet difficult to use accurately in finite precision. Standardizing variables or applying a documented diagonal scaling can make the numerical problem easier, but the transformed factor belongs to the scaled matrix. Keep the scaling factors so downstream solutions or simulations can be returned to the original units.

How to read the result panel

Start with the status statement, not the rounded factor. A passing symmetry check says only that mirrored entries agree within the tolerance. Positive leading minors and positive pivots then support the SPD conclusion for this 3×3 case. The L table is the requested factor, its transpose is shown to make the multiplication order visible, and the reconstructed table provides a direct check against the original input. Finally, the residual table localizes any difference that the single maximum-residual number would hide.

A result should be reproducible from saved inputs, tolerance, and display precision. Display precision changes presentation only; it does not change the internal factor. If another program appears to disagree, first check whether it reports an upper factor R, whether rows were permuted, and whether values were rounded during export. Compare LLᵀ or RᵀR against the same original matrix before concluding that either implementation is incorrect.

Frequently asked questions

Does every symmetric matrix have a Cholesky factor?

No. Standard real Cholesky with positive diagonal requires positive definiteness, not symmetry alone.

Why enter both halves of the matrix?

It exposes asymmetry and transcription errors. The calculator will not silently copy or average mirrored entries.

Why is L unique?

For an SPD matrix, requiring positive diagonal entries selects one lower-triangular factor.

Can I factor a semidefinite covariance matrix?

Standard unpivoted Cholesky may fail at a zero pivot. Use a semidefinite-aware or pivoted method.

Why does multiplying displayed L give a tiny error?

Displayed entries are rounded. Internal reconstruction uses unrounded double-precision values.

Should I invert A with L?

Usually solve triangular systems instead of forming an explicit inverse. It is more efficient and often more stable.

References

NIST Dataplot — Cholesky Decomposition

NIST Mathematical and Computational Sciences — Matrix Market

Netlib — LAPACK Linear Algebra Package

Scroll to Top