# Cholesky decomposition

Last updated

In linear algebra, the Cholesky decomposition or Cholesky factorization (pronounced /ʃo-LESS-key/) is a decomposition of a Hermitian, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose, which is useful for efficient numerical solutions, e.g., Monte Carlo simulations. It was discovered by André-Louis Cholesky for real matrices. When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations. [1]

Linear algebra is the branch of mathematics concerning linear equations such as

In the mathematical discipline of linear algebra, a matrix decomposition or matrix factorization is a factorization of a matrix into a product of matrices. There are many different matrix decompositions; each finds use among a particular class of problems.

In mathematics, a Hermitian matrix is a complex square matrix that is equal to its own conjugate transpose—that is, the element in the i-th row and j-th column is equal to the complex conjugate of the element in the j-th row and i-th column, for all indices i and j:

## Statement

The Cholesky decomposition of a Hermitian positive-definite matrix A is a decomposition of the form

${\displaystyle \mathbf {A} =\mathbf {LL} ^{*},}$

where L is a lower triangular matrix with real and positive diagonal entries, and L* denotes the conjugate transpose of L. Every Hermitian positive-definite matrix (and thus also every real-valued symmetric positive-definite matrix) has a unique Cholesky decomposition. [2]

In mathematics, the conjugate transpose or Hermitian transpose of an m-by-n matrix with complex entries is the n-by-m matrix obtained from by taking the transpose and then taking the complex conjugate of each entry.

If the matrix A is Hermitian and positive semi-definite, then it still has a decomposition of the form A = LL* if the diagonal entries of L are allowed to be zero. [3]

When A has only real entries, L has only real entries as well, and the factorization may be written A = LLT. [4]

The Cholesky decomposition is unique when A is positive definite; there is only one lower triangular matrix L with strictly positive diagonal entries such that A = LL*. However, the decomposition need not be unique when A is positive semidefinite.

The converse holds trivially: if A can be written as LL* for some invertible L, lower triangular or otherwise, then A is Hermitian and positive definite.

## LDL decomposition

A closely related variant of the classical Cholesky decomposition is the LDL decomposition,

${\displaystyle \mathbf {A} =\mathbf {LDL} ^{*},}$

where L is a lower unit triangular (unitriangular) matrix, and D is a diagonal matrix.

This decomposition is related to the classical Cholesky decomposition of the form LL* as follows:

${\displaystyle \mathbf {A} =\mathbf {LDL} ^{*}=\mathbf {L} \mathbf {D} ^{1/2}(\mathbf {D} ^{1/2})^{*}\mathbf {L} ^{*}=\mathbf {L} \mathbf {D} ^{1/2}(\mathbf {L} \mathbf {D} ^{1/2})^{*}.}$

Or, given the classical Cholesky decomposition ${\displaystyle \mathbf {L} ^{\text{Cholesky}}}$, the ${\displaystyle \mathbf {L} \mathbf {D} \mathbf {L} ^{*}}$ form can be found by using the property that the diagonal of L must be 1 and that both the Cholesky and the ${\displaystyle \mathbf {L} \mathbf {D} \mathbf {L} ^{\mathrm {T} }}$ form are lower triangles, [5] if S is a diagonal matrix that contains the main diagonal of ${\displaystyle \mathbf {L} ^{\text{Cholesky}}}$, then

${\displaystyle \mathbf {D} =\mathbf {S} ^{2},}$
${\displaystyle \mathbf {L} =\mathbf {L} ^{\text{Cholesky}}\mathbf {S} ^{-1}.}$

The LDL variant, if efficiently implemented, requires the same space and computational complexity to construct and use but avoids extracting square roots. [6] Some indefinite matrices for which no Cholesky decomposition exists have an LDL decomposition with negative entries in D. For these reasons, the LDL decomposition may be preferred. For real matrices, the factorization has the form A = LDLT and is often referred to as LDLT decomposition (or LDLT decomposition, or LDL′). It is closely related to the eigendecomposition of real symmetric matrices, A = QΛQT.

## Example

Here is the Cholesky decomposition of a symmetric real matrix:

{\displaystyle {\begin{aligned}\left({\begin{array}{*{3}{r}}4&12&-16\\12&37&-43\\-16&-43&98\\\end{array}}\right)=\left({\begin{array}{*{3}{r}}2&0&0\\6&1&0\\-8&5&3\\\end{array}}\right)\left({\begin{array}{*{3}{r}}2&6&-8\\0&1&5\\0&0&3\\\end{array}}\right).\end{aligned}}}

And here is its LDLT decomposition:

{\displaystyle {\begin{aligned}\left({\begin{array}{*{3}{r}}4&12&-16\\12&37&-43\\-16&-43&98\\\end{array}}\right)&=\left({\begin{array}{*{3}{r}}1&0&0\\3&1&0\\-4&5&1\\\end{array}}\right)\left({\begin{array}{*{3}{r}}4&0&0\\0&1&0\\0&0&9\\\end{array}}\right)\left({\begin{array}{*{3}{r}}1&3&-4\\0&1&5\\0&0&1\\\end{array}}\right).\end{aligned}}}

## Applications

The Cholesky decomposition is mainly used for the numerical solution of linear equations ${\displaystyle \mathbf {Ax} =\mathbf {b} }$. If A is symmetric and positive definite, then we can solve ${\displaystyle \mathbf {Ax} =\mathbf {b} }$ by first computing the Cholesky decomposition ${\displaystyle \mathbf {A} =\mathbf {LL} ^{\mathrm {*} }}$, then solving ${\displaystyle \mathbf {Ly} =\mathbf {b} }$ for y by forward substitution, and finally solving ${\displaystyle \mathbf {L^{*}x} =\mathbf {y} }$ for x by back substitution.

An alternative way to eliminate taking square roots in the ${\displaystyle \mathbf {LL} ^{\mathrm {*} }}$ decomposition is to compute the Cholesky decomposition ${\displaystyle \mathbf {A} =\mathbf {LDL} ^{\mathrm {*} }}$, then solving ${\displaystyle \mathbf {Ly} =\mathbf {b} }$ for y, and finally solving ${\displaystyle \mathbf {DL} ^{\mathrm {*} }\mathbf {x} =\mathbf {y} }$.

For linear systems that can be put into symmetric form, the Cholesky decomposition (or its LDL variant) is the method of choice, for superior efficiency and numerical stability. Compared to the LU decomposition, it is roughly twice as efficient. [1]

### Linear least squares

Systems of the form Ax = b with A symmetric and positive definite arise quite often in applications. For instance, the normal equations in linear least squares problems are of this form. It may also happen that matrix A comes from an energy functional, which must be positive from physical considerations; this happens frequently in the numerical solution of partial differential equations.

### Non-linear optimization

Non-linear multi-variate functions may be minimized over their parameters using variants of Newton's method called quasi-Newton methods. At iteration k, the search steps in a direction ${\displaystyle p_{k}}$ defined by solving ${\displaystyle B_{k}p_{k}}$ = ${\displaystyle -g_{k}}$ for ${\displaystyle p_{k}}$, where ${\displaystyle p_{k}}$ is the step direction, ${\displaystyle g_{k}}$ is the gradient, and ${\displaystyle B_{k}}$ is an approximation to the Hessian matrix formed by repeating rank-1 updates at each iteration. Two well-known update formulas are called Davidon–Fletcher–Powell (DFP) and Broyden–Fletcher–Goldfarb–Shanno (BFGS). Loss of the positive-definite condition through round-off error is avoided if rather than updating an approximation to the inverse of the Hessian, one updates the Cholesky decomposition of an approximation of the Hessian matrix itself.[ citation needed ]

### Monte Carlo simulation

The Cholesky decomposition is commonly used in the Monte Carlo method for simulating systems with multiple correlated variables. The covariance matrix is decomposed to give the lower-triangular L. Applying this to a vector of uncorrelated samples u produces a sample vector Lu with the covariance properties of the system being modeled. [7]

The following simplified example shows the economy one gets from the Cholesky decomposition: suppose the goal is to generate two correlated normal variables ${\displaystyle x_{1}}$ and ${\displaystyle x_{2}}$ with given correlation coefficient ${\displaystyle \rho }$. To accomplish that, it is necessary to first generate two uncorrelated Gaussian random variables ${\displaystyle z_{1}}$ and ${\displaystyle z_{2}}$, which can be done using a Box–Muller transform. Given the required correlation coefficient ${\displaystyle \rho }$, the correlated normal variables can be obtained via the transformations ${\displaystyle x_{1}=z_{1}}$ and ${\displaystyle x_{2}=\rho z_{1}+{\sqrt {1-\rho ^{2}}}z_{2}}$.

### Kalman filters

Unscented Kalman filters commonly use the Cholesky decomposition to choose a set of so-called sigma points. The Kalman filter tracks the average state of a system as a vector x of length N and covariance as an N × N matrix P. The matrix P is always positive semi-definite and can be decomposed into LLT. The columns of L can be added and subtracted from the mean x to form a set of 2N vectors called sigma points. These sigma points completely capture the mean and covariance of the system state.

### Matrix inversion

The explicit inverse of a Hermitian matrix can be computed by Cholesky decomposition, in a manner similar to solving linear systems, using ${\displaystyle n^{3}}$ operations (${\displaystyle {\tfrac {1}{2}}n^{3}}$ multiplications). [6] The entire inversion can even be efficiently performed in-place.

A non-Hermitian matrix B can also be inverted using the following identity, where BB* will always be Hermitian:

${\displaystyle \mathbf {B} ^{-1}=\mathbf {B} ^{*}(\mathbf {BB} ^{*})^{-1}.}$

## Computation

There are various methods for calculating the Cholesky decomposition. The computational complexity of commonly used algorithms is O(n3) in general.[ citation needed ] The algorithms described below all involve about n3/3 FLOPs (n3/6 multiplications and the same number of additions), where n is the size of the matrix A. Hence, they have half the cost of the LU decomposition, which uses 2n3/3 FLOPs (see Trefethen and Bau 1997).

Which of the algorithms below is faster depends on the details of the implementation. Generally, the first algorithm will be slightly slower because it accesses the data in a less regular manner.

### The Cholesky algorithm

The Cholesky algorithm, used to calculate the decomposition matrix L, is a modified version of Gaussian elimination.

The recursive algorithm starts with i := 1 and

A(1) := A.

At step i, the matrix A(i) has the following form:

${\displaystyle \mathbf {A} ^{(i)}={\begin{pmatrix}\mathbf {I} _{i-1}&0&0\\0&a_{i,i}&\mathbf {b} _{i}^{*}\\0&\mathbf {b} _{i}&\mathbf {B} ^{(i)}\end{pmatrix}},}$

where Ii−1 denotes the identity matrix of dimension i − 1.

If we now define the matrix Li by

${\displaystyle \mathbf {L} _{i}:={\begin{pmatrix}\mathbf {I} _{i-1}&0&0\\0&{\sqrt {a_{i,i}}}&0\\0&{\frac {1}{\sqrt {a_{i,i}}}}\mathbf {b} _{i}&\mathbf {I} _{n-i}\end{pmatrix}},}$

then we can write A(i) as

${\displaystyle \mathbf {A} ^{(i)}=\mathbf {L} _{i}\mathbf {A} ^{(i+1)}\mathbf {L} _{i}^{*}}$

where

${\displaystyle \mathbf {A} ^{(i+1)}={\begin{pmatrix}\mathbf {I} _{i-1}&0&0\\0&1&0\\0&0&\mathbf {B} ^{(i)}-{\frac {1}{a_{i,i}}}\mathbf {b} _{i}\mathbf {b} _{i}^{*}\end{pmatrix}}.}$

Note that bib*i is an outer product, therefore this algorithm is called the outer-product version in (Golub & Van Loan).

We repeat this for i from 1 to n. After n steps, we get A(n+1) = I. Hence, the lower triangular matrix L we are looking for is calculated as

${\displaystyle \mathbf {L} :=\mathbf {L} _{1}\mathbf {L} _{2}\dots \mathbf {L} _{n}.}$

### The Cholesky–Banachiewicz and Cholesky–Crout algorithms

If we write out the equation

{\displaystyle {\begin{aligned}\mathbf {A} =\mathbf {LL} ^{T}&={\begin{pmatrix}L_{11}&0&0\\L_{21}&L_{22}&0\\L_{31}&L_{32}&L_{33}\\\end{pmatrix}}{\begin{pmatrix}L_{11}&L_{21}&L_{31}\\0&L_{22}&L_{32}\\0&0&L_{33}\end{pmatrix}}\\&={\begin{pmatrix}L_{11}^{2}&&({\text{symmetric}})\\L_{21}L_{11}&L_{21}^{2}+L_{22}^{2}&\\L_{31}L_{11}&L_{31}L_{21}+L_{32}L_{22}&L_{31}^{2}+L_{32}^{2}+L_{33}^{2}\end{pmatrix}},\end{aligned}}}

we obtain the following:

{\displaystyle {\begin{aligned}\mathbf {L} ={\begin{pmatrix}{\sqrt {A_{11}}}&0&0\\A_{21}/L_{11}&{\sqrt {A_{22}-L_{21}^{2}}}&0\\A_{31}/L_{11}&\left(A_{32}-L_{31}L_{21}\right)/L_{22}&{\sqrt {A_{33}-L_{31}^{2}-L_{32}^{2}}}\end{pmatrix}}\end{aligned}}}

and therefore the following formulas for the entries of L:

${\displaystyle L_{j,j}={\sqrt {A_{j,j}-\sum _{k=1}^{j-1}L_{j,k}^{2}}},}$
${\displaystyle L_{i,j}={\frac {1}{L_{j,j}}}\left(A_{i,j}-\sum _{k=1}^{j-1}L_{i,k}L_{j,k}\right)\quad {\text{for }}i>j.}$

The expression under the square root is always positive if A is real and positive-definite.

For complex Hermitian matrix, the following formula applies:

${\displaystyle L_{j,j}={\sqrt {A_{j,j}-\sum _{k=1}^{j-1}L_{j,k}L_{j,k}^{*}}},}$
${\displaystyle L_{i,j}={\frac {1}{L_{j,j}}}\left(A_{i,j}-\sum _{k=1}^{j-1}L_{i,k}L_{j,k}^{*}\right)\quad {\text{for }}i>j.}$

So we can compute the (i, j) entry if we know the entries to the left and above. The computation is usually arranged in either of the following orders:

• The Cholesky–Banachiewicz algorithm starts from the upper left corner of the matrix L and proceeds to calculate the matrix row by row.
• The Cholesky–Crout algorithm starts from the upper left corner of the matrix L and proceeds to calculate the matrix column by column.

Either pattern of access allows the entire computation to be performed in-place if desired.

### Stability of the computation

Suppose that we want to solve a well-conditioned system of linear equations. If the LU decomposition is used, then the algorithm is unstable unless we use some sort of pivoting strategy. In the latter case, the error depends on the so-called growth factor of the matrix, which is usually (but not always) small.

Now, suppose that the Cholesky decomposition is applicable. As mentioned above, the algorithm will be twice as fast. Furthermore, no pivoting is necessary, and the error will always be small. Specifically, if we want to solve Ax = b, and y denotes the computed solution, then y solves the perturbed system (A + E)y = b, where

${\displaystyle \|\mathbf {E} \|_{2}\leq c_{n}\varepsilon \|\mathbf {A} \|_{2}.}$

Here ||·||2 is the matrix 2-norm, cn is a small constant depending on n, and ε denotes the unit round-off.

One concern with the Cholesky decomposition to be aware of is the use of square roots. If the matrix being factorized is positive definite as required, the numbers under the square roots are always positive in exact arithmetic. Unfortunately, the numbers can become negative because of round-off errors, in which case the algorithm cannot continue. However, this can only happen if the matrix is very ill-conditioned. One way to address this is to add a diagonal correction matrix to the matrix being decomposed in an attempt to promote the positive-definiteness. [8] While this might lessen the accuracy of the decomposition, it can be very favorable for other reasons; for example, when performing Newton's method in optimization, adding a diagonal matrix can improve stability when far from the optimum.

### LDL decomposition

An alternative form, eliminating the need to take square roots, is the symmetric indefinite factorization [9]

{\displaystyle {\begin{aligned}\mathbf {A} =\mathbf {LDL} ^{\mathrm {T} }&={\begin{pmatrix}1&0&0\\L_{21}&1&0\\L_{31}&L_{32}&1\\\end{pmatrix}}{\begin{pmatrix}D_{1}&0&0\\0&D_{2}&0\\0&0&D_{3}\\\end{pmatrix}}{\begin{pmatrix}1&L_{21}&L_{31}\\0&1&L_{32}\\0&0&1\\\end{pmatrix}}\\&={\begin{pmatrix}D_{1}&&(\mathrm {symmetric} )\\L_{21}D_{1}&L_{21}^{2}D_{1}+D_{2}&\\L_{31}D_{1}&L_{31}L_{21}D_{1}+L_{32}D_{2}&L_{31}^{2}D_{1}+L_{32}^{2}D_{2}+D_{3}.\end{pmatrix}}.\end{aligned}}}

If A is real, the following recursive relations apply for the entries of D and L:

${\displaystyle D_{j}=A_{jj}-\sum _{k=1}^{j-1}L_{jk}^{2}D_{k},}$
${\displaystyle L_{ij}={\frac {1}{D_{j}}}\left(A_{ij}-\sum _{k=1}^{j-1}L_{ik}L_{jk}D_{k}\right)\quad {\text{for }}i>j.}$

For complex Hermitian matrix A, the following formula applies:

${\displaystyle D_{j}=A_{jj}-\sum _{k=1}^{j-1}L_{jk}L_{jk}^{*}D_{k},}$
${\displaystyle L_{ij}={\frac {1}{D_{j}}}\left(A_{ij}-\sum _{k=1}^{j-1}L_{ik}L_{jk}^{*}D_{k}\right)\quad {\text{for }}i>j.}$

Again, the pattern of access allows the entire computation to be performed in-place if desired.

### Block variant

When used on indefinite matrices, the LDL* factorization is known to be unstable without careful pivoting; [10] specifically, the elements of the factorization can grow arbitrarily. A possible improvement is to perform the factorization on block sub-matrices, commonly 2 × 2: [11]

{\displaystyle {\begin{aligned}\mathbf {A} =\mathbf {LDL} ^{\mathrm {T} }&={\begin{pmatrix}\mathbf {I} &0&0\\\mathbf {L} _{21}&\mathbf {I} &0\\\mathbf {L} _{31}&\mathbf {L} _{32}&\mathbf {I} \\\end{pmatrix}}{\begin{pmatrix}\mathbf {D} _{1}&0&0\\0&\mathbf {D} _{2}&0\\0&0&\mathbf {D} _{3}\\\end{pmatrix}}{\begin{pmatrix}\mathbf {I} &\mathbf {L} _{21}^{\mathrm {T} }&\mathbf {L} _{31}^{\mathrm {T} }\\0&\mathbf {I} &\mathbf {L} _{32}^{\mathrm {T} }\\0&0&\mathbf {I} \\\end{pmatrix}}\\&={\begin{pmatrix}\mathbf {D} _{1}&&(\mathrm {symmetric} )\\\mathbf {L} _{21}\mathbf {D} _{1}&\mathbf {L} _{21}\mathbf {D} _{1}\mathbf {L} _{21}^{\mathrm {T} }+\mathbf {D} _{2}&\\\mathbf {L} _{31}\mathbf {D} _{1}&\mathbf {L} _{31}\mathbf {D} _{1}\mathbf {L} _{21}^{\mathrm {T} }+\mathbf {L} _{32}\mathbf {D} _{2}&\mathbf {L} _{31}\mathbf {D} _{1}\mathbf {L} _{31}^{\mathrm {T} }+\mathbf {L} _{32}\mathbf {D} _{2}\mathbf {L} _{32}^{\mathrm {T} }+\mathbf {D} _{3}\end{pmatrix}},\end{aligned}}}

where every element in the matrices above is a square submatrix. From this, these analogous recursive relations follow:

${\displaystyle \mathbf {D} _{j}=\mathbf {A} _{jj}-\sum _{k=1}^{j-1}\mathbf {L} _{jk}\mathbf {D} _{k}\mathbf {L} _{jk}^{\mathrm {T} },}$
${\displaystyle \mathbf {L} _{ij}=\left(\mathbf {A} _{ij}-\sum _{k=1}^{j-1}\mathbf {L} _{ik}\mathbf {D} _{k}\mathbf {L} _{jk}^{\mathrm {T} }\right)\mathbf {D} _{j}^{-1}.}$

This involves matrix products and explicit inversion, thus limiting the practical block size.

### Updating the decomposition

A task that often arises in practice is that one needs to update a Cholesky decomposition. In more details, one has already computed the Cholesky decomposition ${\displaystyle \mathbf {A} =\mathbf {L} \mathbf {L} ^{*}}$ of some matrix ${\displaystyle \mathbf {A} }$, then one changes the matrix ${\displaystyle \mathbf {A} }$ in some way into another matrix, say ${\displaystyle {\tilde {\mathbf {A} }}}$, and one wants to compute the Cholesky decomposition of the updated matrix: ${\displaystyle {\tilde {\mathbf {A} }}={\tilde {\mathbf {L} }}{\tilde {\mathbf {L} }}^{*}}$. The question is now whether one can use the Cholesky decomposition of ${\displaystyle \mathbf {A} }$ that was computed before to compute the Cholesky decomposition of ${\displaystyle {\tilde {\mathbf {A} }}}$.

#### Rank-one update

The specific case, where the updated matrix ${\displaystyle {\tilde {\mathbf {A} }}}$ is related to the matrix ${\displaystyle \mathbf {A} }$ by ${\displaystyle {\tilde {\mathbf {A} }}=\mathbf {A} +\mathbf {x} \mathbf {x} ^{*}}$, is known as a rank-one update.

Here is a little function [12] written in Matlab syntax that realizes a rank-one update:

function[L] =cholupdate(L, x)n=length(x);fork=1:nr=sqrt(L(k,k)^2+x(k)^2);c=r/L(k,k);s=x(k)/L(k,k);L(k,k)=r;ifk<nL((k+1):n,k)=(L((k+1):n,k)+s*x((k+1):n))/c;x((k+1):n)=c*x((k+1):n)-s*L((k+1):n,k);endendend

#### Rank-one downdate

A rank-one downdate is similar to a rank-one update, except that the addition is replaced by subtraction: ${\displaystyle {\tilde {\mathbf {A} }}=\mathbf {A} -\mathbf {x} \mathbf {x} ^{*}}$. This only works if the new matrix ${\displaystyle {\tilde {\mathbf {A} }}}$ is still positive definite.

The code for the rank-one update shown above can easily be adapted to do a rank-one downdate: one merely needs to replace the two additions in the assignment to  r  and  L((k+1):n, k)  by subtractions.

#### Adding and removing rows and columns

If we have a symmetric and positive definite matrix ${\displaystyle \mathbf {A} }$ represented in block form as

${\displaystyle \mathbf {A} ={\begin{pmatrix}\mathbf {A} _{11}&\mathbf {A} _{13}\\\mathbf {A} _{13}^{\mathrm {T} }&\mathbf {A} _{33}\\\end{pmatrix}}}$

and its upper Cholesky factor

${\displaystyle \mathbf {L} ={\begin{pmatrix}\mathbf {L} _{11}&\mathbf {L} _{13}\\0&\mathbf {L} _{33}\\\end{pmatrix}},}$

then for a new matrix ${\displaystyle {\tilde {\mathbf {A} }}}$, which is the same as ${\displaystyle \mathbf {A} }$ but with the insertion of new rows and columns,

{\displaystyle {\begin{aligned}{\tilde {\mathbf {A} }}&={\begin{pmatrix}\mathbf {A} _{11}&\mathbf {A} _{12}&\mathbf {A} _{13}\\\mathbf {A} _{12}^{\mathrm {T} }&\mathbf {A} _{22}&\mathbf {A} _{23}\\\mathbf {A} _{13}^{\mathrm {T} }&\mathbf {A} _{23}^{\mathrm {T} }&\mathbf {A} _{33}\\\end{pmatrix}}\end{aligned}}}

we are interested in finding the Cholesky factorisation of ${\displaystyle {\tilde {\mathbf {A} }}}$, which we call ${\displaystyle {\tilde {\mathbf {S} }}}$, without directly computing the entire decomposition.

{\displaystyle {\begin{aligned}{\tilde {\mathbf {S} }}&={\begin{pmatrix}\mathbf {S} _{11}&\mathbf {S} _{12}&\mathbf {S} _{13}\\0&\mathbf {S} _{22}&\mathbf {S} _{23}\\0&0&\mathbf {S} _{33}\\\end{pmatrix}}.\end{aligned}}}

Writing ${\displaystyle \mathbf {A} \setminus \mathbf {b} }$ for the solution of ${\displaystyle \mathbf {A} \mathbf {x} =\mathbf {b} }$, which can be found easily for triangular matrices, and ${\displaystyle {\text{chol}}(\mathbf {M} )}$ for the Cholesky decomposition of ${\displaystyle \mathbf {M} }$, the following relations can be found:

{\displaystyle {\begin{aligned}\mathbf {S} _{11}&=\mathbf {L} _{11},\\\mathbf {S} _{12}&=\mathbf {L} _{11}^{\mathrm {T} }\setminus \mathbf {A} _{12},\\\mathbf {S} _{13}&=\mathbf {L} _{13},\\\mathbf {S} _{22}&={\text{chol}}(\mathbf {A} _{22}-\mathbf {S} _{12}^{\mathrm {T} }\mathbf {S} _{12}),\\\mathbf {S} _{23}&=\mathbf {S} _{22}^{\mathrm {T} }\setminus (\mathbf {A} _{23}-\mathbf {S} _{12}^{\mathrm {T} }\mathbf {S} _{13}),\\\mathbf {S} _{33}&={\text{chol}}(\mathbf {L} _{33}^{\mathrm {T} }\mathbf {L} _{33}-\mathbf {S} _{23}^{\mathrm {T} }\mathbf {S} _{23}).\\\end{aligned}}}

These formulas may be used to determine the Cholesky factor after the insertion of rows or columns in any position, if we set the row and column dimensions appropriately (including to zero). The inverse problem, when we have

{\displaystyle {\begin{aligned}{\tilde {\mathbf {A} }}&={\begin{pmatrix}\mathbf {A} _{11}&\mathbf {A} _{12}&\mathbf {A} _{13}\\\mathbf {A} _{12}^{\mathrm {T} }&\mathbf {A} _{22}&\mathbf {A} _{23}\\\mathbf {A} _{13}^{\mathrm {T} }&\mathbf {A} _{23}^{\mathrm {T} }&\mathbf {A} _{33}\\\end{pmatrix}}\end{aligned}}}

with known Cholesky decomposition

{\displaystyle {\begin{aligned}{\tilde {\mathbf {S} }}&={\begin{pmatrix}\mathbf {S} _{11}&\mathbf {S} _{12}&\mathbf {S} _{13}\\0&\mathbf {S} _{22}&\mathbf {S} _{23}\\0&0&\mathbf {S} _{33}\\\end{pmatrix}}\end{aligned}}}

and wish to determine the Cholesky factor

{\displaystyle {\begin{aligned}\mathbf {L} &={\begin{pmatrix}\mathbf {L} _{11}&\mathbf {L} _{13}\\0&\mathbf {L} _{33}\\\end{pmatrix}}\end{aligned}}}

of the matrix ${\displaystyle \mathbf {A} }$ with rows and columns removed,

{\displaystyle {\begin{aligned}\mathbf {A} &={\begin{pmatrix}\mathbf {A} _{11}&\mathbf {A} _{13}\\\mathbf {A} _{13}^{\mathrm {T} }&\mathbf {A} _{33}\\\end{pmatrix}},\end{aligned}}}

yields the following rules:

{\displaystyle {\begin{aligned}\mathbf {L} _{11}&=\mathbf {S} _{11},\\\mathbf {L} _{13}&=\mathbf {S} _{13},\\\mathbf {L} _{33}&={\text{chol}}(\mathbf {S} _{33}^{\mathrm {T} }\mathbf {S} _{33}+\mathbf {S} _{23}^{\mathrm {T} }\mathbf {S} _{23}).\end{aligned}}}

Notice that the equations above that involve finding the Cholesky decomposition of a new matrix are all of the form ${\displaystyle {\tilde {\mathbf {A} }}=\mathbf {A} \pm \mathbf {x} \mathbf {x} ^{*}}$, which allows them to be efficiently calculated using the update and downdate procedures detailed in the previous section. [13]

## Proof for positive semi-definite matrices

### Proof by limiting argument

The above algorithms show that every positive definite matrix ${\displaystyle \mathbf {A} }$ has a Cholesky decomposition. This result can be extended to the positive semi-definite case by a limiting argument. The argument is not fully constructive, i.e., it gives no explicit numerical algorithms for computing Cholesky factors.

If ${\displaystyle \mathbf {A} }$ is an ${\displaystyle n\times n}$ positive semi-definite matrix, then the sequence ${\displaystyle \left(\mathbf {A} _{k}\right)_{k}:=\left(\mathbf {A} +{\frac {1}{k}}\mathbf {I} _{n}\right)_{k}}$ consists of positive definite matrices. (This is an immediate consequence of, for example, the spectral mapping theorem for the polynomial functional calculus.) Also,

${\displaystyle \mathbf {A} _{k}\rightarrow \mathbf {A} \quad {\text{for}}\quad k\rightarrow \infty }$

in operator norm. From the positive definite case, each ${\displaystyle \mathbf {A} _{k}}$ has Cholesky decomposition ${\displaystyle \mathbf {A} _{k}=\mathbf {L} _{k}\mathbf {L} _{k}^{*}}$. By property of the operator norm,

${\displaystyle \|\mathbf {L} _{k}\|^{2}\geq \|\mathbf {L} _{k}\mathbf {L} _{k}^{*}\|=\|\mathbf {A} _{k}\|\,.}$

So ${\displaystyle \left(\mathbf {L} _{k}\right)_{k}}$ is a bounded set in the Banach space of operators, therefore relatively compact (because the underlying vector space is finite-dimensional). Consequently, it has a convergent subsequence, also denoted by ${\displaystyle \left(\mathbf {L} _{k}\right)_{k}}$, with limit ${\displaystyle \mathbf {L} }$. It can be easily checked that this ${\displaystyle \mathbf {L} }$ has the desired properties, i.e. ${\displaystyle \mathbf {A} =\mathbf {L} \mathbf {L} ^{*}}$, and ${\displaystyle \mathbf {L} }$ is lower triangular with non-negative diagonal entries: for all ${\displaystyle x}$ and ${\displaystyle y}$,

${\displaystyle \langle \mathbf {A} x,y\rangle =\left\langle \lim \mathbf {A} _{k}x,y\right\rangle =\langle \lim \mathbf {L} _{k}\mathbf {L} _{k}^{*}x,y\rangle =\langle \mathbf {L} \mathbf {L} ^{*}x,y\rangle \,.}$

Therefore, ${\displaystyle \mathbf {A} =\mathbf {L} \mathbf {L} ^{*}}$. Because the underlying vector space is finite-dimensional, all topologies on the space of operators are equivalent. So ${\displaystyle \left(\mathbf {L} _{k}\right)_{k}}$ tends to ${\displaystyle \mathbf {L} }$ in norm means ${\displaystyle \left(\mathbf {L} _{k}\right)_{k}}$ tends to ${\displaystyle \mathbf {L} }$ entrywise. This in turn implies that, since each ${\displaystyle \mathbf {L} _{k}}$ is lower triangular with non-negative diagonal entries, ${\displaystyle \mathbf {L} }$ is also.

### Proof by QR decomposition

Let ${\displaystyle \mathbf {A} }$ be a positive semi-definite matrix Hermitian matrix. Then it can be written as a product of its square root matrix, ${\displaystyle \mathbf {A} =\mathbf {B} \mathbf {B} ^{*}}$. Now QR decomposition can be applied to ${\displaystyle \mathbf {B} ^{*}}$, resulting in ${\displaystyle \mathbf {B} ^{*}=\mathbf {Q} \mathbf {R} }$ , where ${\displaystyle \mathbf {Q} }$ is unitary and ${\displaystyle \mathbf {R} }$ is upper triangular. Inserting the decomposition into the original equality yields ${\displaystyle A=\mathbf {B} \mathbf {B} ^{*}=(\mathbf {QR} )^{*}\mathbf {QR} =\mathbf {R} ^{*}\mathbf {Q} ^{*}\mathbf {QR} =\mathbf {R} ^{*}\mathbf {R} }$. Setting ${\displaystyle \mathbf {L} =\mathbf {R} ^{*}}$ completes the proof.

## Generalization

The Cholesky factorization can be generalized [ citation needed ] to (not necessarily finite) matrices with operator entries. Let ${\displaystyle \{{\mathcal {H}}_{n}\}}$ be a sequence of Hilbert spaces. Consider the operator matrix

${\displaystyle \mathbf {A} ={\begin{bmatrix}\mathbf {A} _{11}&\mathbf {A} _{12}&\mathbf {A} _{13}&\;\\\mathbf {A} _{12}^{*}&\mathbf {A} _{22}&\mathbf {A} _{23}&\;\\\mathbf {A} _{13}^{*}&\mathbf {A} _{23}^{*}&\mathbf {A} _{33}&\;\\\;&\;&\;&\ddots \end{bmatrix}}}$

acting on the direct sum

${\displaystyle {\mathcal {H}}=\oplus _{n}{\mathcal {H}}_{n},}$

where each

${\displaystyle \mathbf {A} _{ij}:{\mathcal {H}}_{j}\rightarrow {\mathcal {H}}_{i}}$

is a bounded operator. If A is positive (semidefinite) in the sense that for all finite k and for any

${\displaystyle h\in \oplus _{n=1}^{k}{\mathcal {H}}_{k},}$

we have ${\displaystyle \langle h,\mathbf {A} h\rangle \geq 0}$, then there exists a lower triangular operator matrix L such that A = LL*. One can also take the diagonal entries of L to be positive.

## Implementations in programming libraries

• C programming language: the GNU Scientific Library provides several implementations of Cholesky decomposition.
• Maxima computer algebra system: function cholesky computes Cholesky decomposition.
• GNU Octave numerical computations system provides several functions to calculate, update, and apply a Cholesky decomposition.
• The LAPACK library provides a high performance implementation of the Cholesky decomposition that can be accessed from Fortran, C and most languages.
• In Python, the function "cholesky" from the numpy.linalg module performs Cholesky decomposition.
• In Matlab and R, the "chol" function gives the Cholesky decomposition..
• In Julia, the "cholesky" function from the LinearAlgebra package gives the Cholesky decomposition.
• In Mathematica, the function "CholeskyDecomposition" can be applied to a matrix.
• In C++, the command "chol" from the armadillo library performs Cholesky decomposition. The Eigen library supplies Cholesky factorizations for both sparse and dense matrices.
• In the ROOT package, the TDecompChol class is available.
• In Analytica, the function Decompose gives the Cholesky decomposition.
• The Apache Commons Math library has an implementation which can be used in Java, Scala and any other JVM language.

## Notes

1. Press, William H.; Saul A. Teukolsky; William T. Vetterling; Brian P. Flannery (1992). Numerical Recipes in C: The Art of Scientific Computing (second ed.). Cambridge University England EPress. p. 994. ISBN   0-521-43108-5.
2. Golub & Van Loan (1996 , p. 143), Horn & Johnson (1985 , p. 407), Trefethen & Bau (1997 , p. 174).
3. Golub & Van Loan (1996 , p. 147).
4. Horn & Johnson (1985 , p. 407).
5. LDLT decomposition from Cholesky decomposition – Cross Validated. Stats.stackexchange.com (2016-04-21). Retrieved on 2016-11-02.
6. Krishnamoorthy, Aravindh; Menon, Deepak (2011). "Matrix Inversion Using Cholesky Decomposition". 1111: 4144. arXiv:. Bibcode:2011arXiv1111.4144K.
7. Matlab randn documentation. mathworks.com.
8. Fang, Haw-ren; O'Leary, Dianne P. (8 August 2006). "Modified Cholesky Algorithms: A Catalog with New Approaches" (PDF).
9. Watkins, D. (1991). Fundamentals of Matrix Computations. New York: Wiley. p. 84. ISBN   0-471-61414-9.
10. Nocedal, Jorge (2000). Numerical Optimization. Springer.
11. Fang, Haw-ren (24 August 2007). "Analysis of Block LDLT Factorizations for Symmetric Indefinite Matrices".
12. Based on: Stewart, G. W. (1998). Basic decompositions. Philadelphia: Soc. for Industrial and Applied Mathematics. ISBN   0-89871-414-1.
13. Osborne, M. (2010), Appendix B.

## Related Research Articles

In linear algebra, the determinant is a scalar value that can be computed from the elements of a square matrix and encodes certain properties of the linear transformation described by the matrix. The determinant of a matrix A is denoted det(A), det A, or |A|. Geometrically, it can be viewed as the volume scaling factor of the linear transformation described by the matrix. This is also the signed volume of the n-dimensional parallelepiped spanned by the column or row vectors of the matrix. The determinant is positive or negative according to whether the linear mapping preserves or reverses the orientation of n-space.

In linear algebra, a symmetric real matrix is said to be positive definite if the scalar is strictly positive for every non-zero column vector of real numbers. Here denotes the transpose of . When interpreting as the output of an operator, , that is acting on an input, , the property of positive definiteness implies that the output always has a positive inner product with the input, as often observed in physical processes.

In probability theory and statistics, the multivariate normal distribution, multivariate Gaussian distribution, or joint normal distribution is a generalization of the one-dimensional (univariate) normal distribution to higher dimensions. One definition is that a random vector is said to be k-variate normally distributed if every linear combination of its k components has a univariate normal distribution. Its importance derives mainly from the multivariate central limit theorem. The multivariate normal distribution is often used to describe, at least approximately, any set of (possibly) correlated real-valued random variables each of which clusters around a mean value.

In mathematics, particularly linear algebra and numerical analysis, the Gram–Schmidt process is a method for orthonormalising a set of vectors in an inner product space, most commonly the Euclidean space Rn equipped with the standard inner product. The Gram–Schmidt process takes a finite, linearly independent set S = {v1, ..., vk} for kn and generates an orthogonal set S′ = {u1, ..., uk} that spans the same k-dimensional subspace of Rn as S.

In mathematics, matrix multiplication or matrix product is a binary operation that produces a matrix from two matrices with entries in a field, or, more generally, in a ring or even a semiring. The matrix product is designed for representing the composition of linear maps that are represented by matrices. Matrix multiplication is thus a basic tool of linear algebra, and as such has numerous applications in many areas of mathematics, as well as in applied mathematics, statistics, physics, economics, and engineering. In more detail, if A is an n × m matrix and B is an m × p matrix, their matrix product AB is an n × p matrix, in which the m entries across a row of A are multiplied with the m entries down a column of B and summed to produce an entry of AB. When two linear maps are represented by matrices, then the matrix product represents the composition of the two maps.

In linear algebra, a symmetric matrix is a square matrix that is equal to its transpose. Formally,

In linear algebra, the singular value decomposition (SVD) is a factorization of a real or complex matrix. It is the generalization of the eigendecomposition of a positive semidefinite normal matrix to any matrix via an extension of the polar decomposition. It has many useful applications in signal processing and statistics.

In mechanics and geometry, the 3D rotation group, often denoted SO(3), is the group of all rotations about the origin of three-dimensional Euclidean space R3 under the operation of composition. By definition, a rotation about the origin is a transformation that preserves the origin, Euclidean distance, and orientation. Every non-trivial rotation is determined by its axis of rotation and its angle of rotation. Composing two rotations results in another rotation; every rotation has a unique inverse rotation; and the identity map satisfies the definition of a rotation. Owing to the above properties, the set of all rotations is a group under composition. Rotations are not commutative, making it a nonabelian group. Moreover, the rotation group has a natural structure as a manifold for which the group operations are smoothly differentiable; so it is in fact a Lie group. It is compact and has dimension 3.

In linear algebra, an n-by-n square matrix A is called invertible if there exists an n-by-n square matrix B such that

In linear algebra, a QR decomposition, also known as a QR factorization, is a decomposition of a matrix A into a product A = QR of an orthogonal matrix Q and an upper triangular matrix R. QR decomposition is often used to solve the linear least squares problem and is the basis for a particular eigenvalue algorithm, the QR algorithm.

In mathematics, and in particular linear algebra, a pseudoinverseA+ of a matrix A is a generalization of the inverse matrix. The most widely known type of matrix pseudoinverse is the Moore–Penrose inverse, which was independently described by E. H. Moore in 1920, Arne Bjerhammar in 1951, and Roger Penrose in 1955. Earlier, Erik Ivar Fredholm had introduced the concept of a pseudoinverse of integral operators in 1903. When referring to a matrix, the term pseudoinverse, without further specification, is often used to indicate the Moore–Penrose inverse. The term generalized inverse is sometimes used as a synonym for pseudoinverse.

In the mathematical subfield of numerical analysis the symbolic Cholesky decomposition is an algorithm used to determine the non-zero pattern for the factors of a symmetric sparse matrix when applying the Cholesky decomposition or variants.

In mathematics, the square root of a matrix extends the notion of square root from numbers to matrices. A matrix B is said to be a square root of A if the matrix product BB is equal to A.

In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix. The product sometimes includes a permutation matrix as well. LU decomposition can be viewed as the matrix form of Gaussian elimination. Computers usually solve square systems of linear equations using LU decomposition, and it is also a key step when inverting a matrix or computing the determinant of a matrix. LU decomposition was introduced by mathematician Tadeusz Banachiewicz in 1938.

In linear algebra, eigendecomposition or sometimes spectral decomposition is the factorization of a matrix into a canonical form, whereby the matrix is represented in terms of its eigenvalues and eigenvectors. Only diagonalizable matrices can be factorized in this way.

In mathematics, specifically multilinear algebra, a dyadic or dyadic tensor is a second order tensor, written in a notation that fits in with vector algebra.

In theoretical physics, the Udwadia–Kalaba equation is a method for deriving the equations of motion of a constrained mechanical system. The equation was first described by Firdaus E. Udwadia and Robert E. Kalaba in 1992. The approach is based on Gauss's principle of least constraint. The Udwadia–Kalaba equation applies to a wide class of constraints, both holonomic constraints and nonholonomic ones, as long as they are linear with respect to the accelerations. The equation generalizes to constraint forces that do not obey D'Alembert's principle.

In probability theory, the family of complex normal distributions characterizes complex random variables whose real and imaginary parts are jointly normal. The complex normal family has three parameters: location parameter μ, covariance matrix , and the relation matrix . The standard complex normal is the univariate distribution with , , and .

In the mathematical discipline of numerical linear algebra, a matrix splitting is an expression which represents a given matrix as a sum or difference of matrices. Many iterative methods depend upon the direct solution of matrix equations involving matrices more general than tridiagonal matrices. These matrix equations can often be solved directly and efficiently when written as a matrix splitting. The technique was devised by Richard S. Varga in 1960.

In pure and applied mathematics, particularly quantum mechanics and computer graphics and their applications, a spherical basis is the basis used to express spherical tensors. The spherical basis closely relates to the description of angular momentum in quantum mechanics and spherical harmonic functions.

## References

### History of science

• Sur la résolution numérique des systèmes d'équations linéaires, Cholesky's 1910 manuscript, online and analyzed on BibNum (in French)(in English)[for English, click 'A télécharger']