Free Cholesky Decomposition Calculator

[
]

Enter matrix values to see the Cholesky decomposition

Matrix Decomposition Basics

In linear algebra, a matrix decomposition (or factorization) rewrites a given matrix as the product of two or more simpler matrices, analogous to factoring an integer into prime factors. Many decomposition methods exist — among the most widely used are the LU decomposition, QR decomposition, singular value decomposition (SVD), and the Cholesky decomposition. Each method is designed for specific types of matrices and applications. The Cholesky decomposition, in particular, provides a fast and numerically stable way to work with a certain class of matrices, and is often implemented in scientific computing, optimization, and machine learning.

Defining the Cholesky Decomposition

The Cholesky decomposition (also called the Cholesky factorization) factorizes a real, symmetric, and positive‑definite matrix AA into the product of a lower triangular matrix LL and its transpose LTL^{T}:

A=LLT.A = L L^{T}.

For this factorization to exist, AA must satisfy three conditions:

  • AA must be symmetric, i.e. AT=AA^{T} = A.
  • Hence AA must be square.
  • AA must be positive definite (all its eigenvalues are positive, or equivalently zTAz>0z^{T} A z > 0 for every nonzero vector zz).

When these requirements are met, LL is unique and its diagonal entries are real. The lower triangular structure of LL — zeros above the main diagonal — makes many subsequent computations (e.g., solving linear systems) much simpler.

Computing Cholesky Factors

There is no single closed‑form formula for the Cholesky decomposition, but an algorithmic process exists: entries of LL are computed from the top‑left corner to the bottom‑right. For a general n×nn\times n matrix, the following recurrence yields the elements of LL.

Diagonal entries ( i=ji = j ):

Lii=Aii−∑k=1i−1Lik2L_{ii} = \sqrt{ A_{ii} - \sum_{k=1}^{i-1} L_{ik}^{2} }

Off‑diagonal entries ( i>ji > j ):

Lij=1Ljj(Aij−∑k=1j−1LikLjk)L_{ij} = \frac{1}{L_{jj}} \left( A_{ij} - \sum_{k=1}^{j-1} L_{ik} L_{jk} \right)

These formulas show that each element depends on previously computed entries. The process can be applied to matrices of any size; the online Cholesky factorization calculator automates it for the most common sizes: 2×2, 3×3, and 4×4.

Example: 2×2 Cholesky Decomposition

For a 2×2 matrix AA, the recurrence simplifies to:

L11=A11,L21=A21L11,L22=A22−L212.L_{11} = \sqrt{A_{11}}, \quad L_{21} = \frac{A_{21}}{L_{11}}, \quad L_{22} = \sqrt{A_{22} - L_{21}^{2}}.

Take A=(4225)A = \begin{pmatrix} 4 & 2 \\ 2 & 5 \end{pmatrix}. Then

L11=4=2,L21=22=1,L22=5−1=2,L_{11} = \sqrt{4}=2,\quad L_{21} = \frac{2}{2}=1,\quad L_{22} = \sqrt{5-1}=2,

so

L=(2012).L = \begin{pmatrix} 2 & 0 \\ 1 & 2 \end{pmatrix}.

Multiplying LLTL L^{T} recovers the original AA, confirming the decomposition.

Example: 3×3 Cholesky Decomposition

Now consider the 3×3 symmetric positive‑definite matrix

A=(4−22−251216).A = \begin{pmatrix} 4 & -2 & 2\\ -2 & 5 & 1\\ 2 & 1 & 6 \end{pmatrix}.

The entries of LL are obtained in a fixed order:

  1. L11=4=2L_{11} = \sqrt{4} = 2
  2. L21=−22=−1,L31=22=1L_{21} = \dfrac{-2}{2} = -1,\quad L_{31} = \dfrac{2}{2} = 1
  3. L22=5−(−1)2=4=2L_{22} = \sqrt{5 - (-1)^{2}} = \sqrt{4} = 2
  4. L32=1−[(−1)(1)]2=1+12=1L_{32} = \dfrac{1 - [(-1)(1)]}{2} = \dfrac{1+1}{2} = 1
  5. L33=6−(12+12)=4=2L_{33} = \sqrt{6 - (1^{2}+1^{2})} = \sqrt{4} = 2

Hence

L=(200−120112).L = \begin{pmatrix} 2 & 0 & 0\\ -1 & 2 & 0\\ 1 & 1 & 2 \end{pmatrix}.

One can verify that LLTL L^{T} equals the original AA. The same pattern extends to 4×4 matrices and beyond.

Using the Online Cholesky Factorization Calculator

The Cholesky decomposition calculator on this page makes the factorization effortless. Simply:

  1. Select the matrix size — 2×2, 3×3, or 4×4.
  2. Fill in the matrix elements in the provided grid.
  3. Click the button to compute.

The tool instantly returns the lower triangular matrix LL. If the input matrix is not symmetric or not positive definite, the calculator will alert you. It also supports displaying the result with rational or decimal numbers, making it ideal for homework checks, engineering analysis, or data science tasks.

Why the Cholesky Decomposition Matters

Because LL is lower triangular, the factorization A=LLTA = L L^{T} drastically speeds up many linear algebra operations. Solving a system Ax=bA x = b becomes a two‑step substitution process (forward followed by backward substitution) that is much faster than general Gaussian elimination. The Cholesky method also requires less memory and is more numerically stable for symmetric positive‑definite matrices. These advantages make it the method of choice in applications like Monte Carlo simulations, Kalman filtering, finite‑element analysis, and portfolio optimization.

FAQ

1. What conditions must a matrix satisfy to have a Cholesky decomposition?

A matrix must be symmetric (equal to its transpose), square, and positive definite (all eigenvalues positive) to be Cholesky‑decomposable. If these criteria are not met, a lower triangular factor L such that A = L L^T does not exist.

2. How is the Cholesky decomposition of a 2×2 matrix computed?

For a 2×2 matrix A, first compute L₁₁ = √A₁₁, then L₂₁ = A₂₁ / L₁₁, and finally L₂₂ = √(A₂₂ − L₂₁²). The lower triangular matrix L formed from these entries satisfies A = L L^T.

3. Does the calculator support matrices larger than 4×4?

The current Cholesky decomposition calculator handles 2×2, 3×3, and 4×4 matrices. For larger sizes, the same recurrence formulas apply but are not implemented in this specific tool.

4. What does it mean if the calculator tells me the matrix is not positive definite?

A matrix that is not positive definite has at least one eigenvalue that is zero or negative. Such a matrix cannot be factorized using the Cholesky method because the square‑root step in the diagonal entries would involve an imaginary number or zero, violating the factorization's assumptions.

5. How does the Cholesky decomposition compare to the LU decomposition?

Both decompose a matrix into triangular factors, but Cholesky works only for symmetric positive‑definite matrices and produces L and its transpose instead of separate lower and upper matrices. For such matrices, Cholesky uses about half the operations and requires less storage than general LU decomposition.

How to Use

  1. Select the matrix size (2×2, 3×3, or 4×4) from the dropdown.
  2. Enter the values of your symmetric positive definite matrix into the input grid.
  3. The lower triangular matrix L from the Cholesky factorization appears instantly below.