Cholesky Decomposition Calculator
Our free linear algebra calculator solves cholesky decomposition problems. Get worked examples, visual aids, and downloadable results.
Calculator
Adjust values & calculateEnter the upper triangle; the matrix is assumed symmetric (a21 = a12).
Formula
The Cholesky decomposition factors a symmetric positive definite matrix A into the product of a lower triangular matrix L and its transpose L^T. For a 2x2 matrix: l11 = sqrt(a11), l21 = a12/l11, l22 = sqrt(a22 - l21^2).
Last reviewed: December 2025
Worked Examples
Example 1: Cholesky of a 2x2 Positive Definite Matrix
Example 2: Solving a System via Cholesky
Background & Theory
The Cholesky Decomposition Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.
History
The history behind the Cholesky Decomposition Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.
Frequently Asked Questions
Formula
A = L * L^T
The Cholesky decomposition factors a symmetric positive definite matrix A into the product of a lower triangular matrix L and its transpose L^T. For a 2x2 matrix: l11 = sqrt(a11), l21 = a12/l11, l22 = sqrt(a22 - l21^2).
Worked Examples
Example 1: Cholesky of a 2x2 Positive Definite Matrix
Problem: Find the Cholesky decomposition of A = [[4, 2], [2, 5]].
Solution: Step 1: l11 = sqrt(4) = 2\nStep 2: l21 = 2 / 2 = 1\nStep 3: l22 = sqrt(5 - 1^2) = sqrt(4) = 2\n\nL = [[2, 0], [1, 2]]\nL^T = [[2, 1], [0, 2]]\n\nVerification: L * L^T = [[4, 2], [2, 5]] = A\nDeterminant = (l11 * l22)^2 = (2*2)^2 = 16\nActual det = 4*5 - 2*2 = 16
Result: L = [[2, 0], [1, 2]] | det(A) = 16 | log(det) = 2.773
Example 2: Solving a System via Cholesky
Problem: Solve Ax = b where A = [[9, 3], [3, 5]] and b = [12, 7].
Solution: Cholesky: l11 = sqrt(9) = 3, l21 = 3/3 = 1, l22 = sqrt(5-1) = 2\nL = [[3, 0], [1, 2]]\n\nForward solve Ly = b: y1 = 12/3 = 4, y2 = (7-1*4)/2 = 1.5\nBack solve L^Tx = y: x2 = 1.5/2 = 0.75, x1 = (4-1*0.75)/3 = 1.083\n\nSolution: x = [1.083, 0.75]
Result: x = [1.083, 0.75] | L = [[3, 0], [1, 2]]
Frequently Asked Questions
How is the Cholesky decomposition computed step by step?
For a 2x2 matrix A = [[a, b], [b, d]], the Cholesky factor L = [[l11, 0], [l21, l22]] is computed as follows. First, l11 = sqrt(a). Then l21 = b / l11. Finally, l22 = sqrt(d - l21^2). The algorithm proceeds column by column for larger matrices. For column j, first compute l_jj = sqrt(a_jj - sum of l_jk^2 for k < j), then for each i > j compute l_ij = (a_ij - sum of l_ik * l_jk for k < j) / l_jj. The total cost for an n x n matrix is n^3/3 floating point operations, which is half the cost of standard LU decomposition.
Why is Cholesky decomposition preferred for solving symmetric positive definite systems?
Cholesky decomposition is preferred for several compelling reasons. First, it requires only n^3/3 operations compared to 2n^3/3 for general LU decomposition, making it roughly twice as fast. Second, it is backward stable, meaning roundoff errors are well-controlled. Third, it requires no pivoting, simplifying implementation and improving cache performance. Fourth, it guarantees real results since all intermediate quantities under square roots are positive. Fifth, it preserves symmetry and positive definiteness in the factors. These advantages make it the method of choice for large-scale systems arising in finite elements, statistics, optimization, and machine learning.
How is Cholesky decomposition used in statistics and machine learning?
In statistics, Cholesky decomposition is essential for working with multivariate normal distributions. The log-likelihood involves log(det(Sigma)), which equals 2*sum(log(L_ii)) using Cholesky, avoiding explicit determinant computation. Sampling from a multivariate normal N(mu, Sigma) is done by computing z = mu + L*u where u is a standard normal vector. In machine learning, Gaussian processes use Cholesky decomposition to solve kernel matrix systems efficiently. Bayesian inference frameworks use it for computing posterior distributions. The decomposition also appears in Kalman filters, factor analysis, and any algorithm requiring covariance matrix operations.
What is the relationship between Cholesky and LDL decomposition?
The LDL decomposition factors a symmetric matrix as A = L * D * L^T, where L is unit lower triangular (ones on the diagonal) and D is diagonal. It is closely related to Cholesky: if A = L_c * L_c^T is the Cholesky factorization, then L = L_c * D^(-1/2) and D = diag(L_c)^2. The LDL decomposition avoids computing square roots, making it faster and applicable to symmetric indefinite matrices (not just positive definite ones). LDL is preferred in some applications like interior point methods in optimization where the matrix may become indefinite during iterations.
Can Cholesky decomposition be used for matrix inversion?
Yes, Cholesky decomposition provides an efficient method for inverting symmetric positive definite matrices. After factoring A = L * L^T, the inverse is computed by first inverting L (which is triangular and therefore easy to invert) and then computing A^(-1) = (L^(-1))^T * L^(-1). Alternatively, you can solve A * x_i = e_i for each standard basis vector e_i using forward and back substitution with L and L^T. The inverse inherits the positive definite and symmetric properties of the original matrix. In practice, computing the full inverse is often unnecessary; solving Ax = b via forward and back substitution is more efficient and numerically stable.
What happens when Cholesky decomposition fails?
Cholesky decomposition fails when the matrix is not positive definite, which manifests as encountering a negative number or zero under a square root during the algorithm. This failure is actually useful as a definitive test for positive definiteness: a matrix is positive definite if and only if the Cholesky algorithm completes successfully. If the decomposition fails at step j, it means the j-th leading principal minor is non-positive. Common causes include: the matrix is indefinite, it is only positive semi-definite (has zero eigenvalues), numerical errors have destroyed positive definiteness, or the matrix was not truly symmetric to begin with.
References
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy