# CholeskyDecomposition

gives the Cholesky decomposition of a matrix m.

# Details • The matrix m can be numerical or symbolic, but must be Hermitian and positive definite.
• yields an uppertriangular matrix u so that ConjugateTranspose[u].u==m.

# Examples

open allclose all

## Basic Examples(2)

Compute the Cholesky decomposition of a 2×2 real matrix:

Verify the decomposition:

The original matrix is positive definite:

Compute the Cholesky decomposition of a 3×3 complex Hermitian matrix:

The result is upper triangular:

## Scope(10)

### Basic Uses (6)

Find the Cholesky decomposition of a machine-precision matrix:

Verify the result:

Cholesky decomposition for a complex matrix:

CholeskyDecomposition will detect if the input fails to be Hermitian and positive definite: The matrix m is positive definite but not Hermitian:

Use CholeskyDecomposition with an exact matrix:

Verify the result:

Cholesky decomposition for an arbitrary-precision matrix:

Use CholeskyDecomposition with a symbolic matrix:

When verifying the result, conditions are needed to make sure the matrix is positive definite:

This can be understood as making sure all eigenvalues are positive:

The Cholesky decomposition for a large numerical matrix is computed efficiently:

### Special Matrices (4)

Find the Cholesky decomposition for sparse matrices:

Verify the decomposition:

Cholesky decompositions of structured matrices:

Use with a QuantityArray structured matrix:

Cholesky decomposition of an identity matrix is an identity matrix:

Cholesky decomposition of HilbertMatrix:

## Applications(2)

A triangular linear system is a system of linear equations in which the first equation has one variable and each subsequent equation introduces exactly one additional variable. Rewrite the following system in three variables as two triangular linear systems in six variables:

Rewrite the system in matrix form and compute the Cholesky decomposition of :

The original system can be reordered into :

Introduce new variables and set ; the result is a triangular system in :

Substituting into gives , a triangular system in :

The six triangular equations together give the same result for as the original system of equations:

The Cholesky decomposition can be used to create random samples having a specified covariance from many independent random values, for example, in Monte Carlo simulation. Starting from the desired covariance matrix, compute the lower triangular matrix , where is the Cholesky decomposition:

Generate a million independent samples and multiply each one by :

The covariance of the sample agrees with the desired covariance to roughly three digits:

## Properties & Relations(6)

The Cholesky decomposition requires the input matrix to be Hermitian and positive definite:

Compute the decomposition:

Verify ConjugateTranspose[u].u == m:

is upper triangular and positive definite:

The Cholesky decomposition is not the same thing as the matrix square root:

The Cholesky decomposition is upper triangular, whereas the square root is Hermitian:

However, both matrices are positive definite and have the same determinant:

For a real matrix , the Cholesky decomposition of coincides with 's QR decomposition up to sign:

Find the Cholesky decomposition of Transpose[m].m:

Compute : is the same as except for the choice of sign for each row:

For any matrix , the Cholesky decomposition of coincides with 's QR decomposition up to phase:

Find the Cholesky decomposition of ConjugateTranspose[m].m:

Compute : is the same as except for the choice of phase for each row:

CholeskyDecomposition is a kind of LU decomposition:

This is generally a different decomposition from the one given by LUDecomposition:

## Possible Issues(2)

Matrices need to be positive definite enough to overcome numerical roundoff: The smallest eigenvalue is effectively zero to machine precision:

The decomposition can be computed when the precision is high enough to resolve it:

s is a sparse tridiagonal matrix:

The Cholesky decomposition is computed as a dense matrix even if the result is sparse:

Using LinearSolve will give a LinearSolveFunction that has a sparse Cholesky factorization: