Command Palette

Search for a command to run...

Linear Methods of AI

Cholesky Decomposition

LU Decomposition for Positive Definite Matrices

For positive definite matrices, there is a special property that makes decomposition much simpler. LU decomposition can be performed without using a permutation matrix PP because Gaussian elimination can proceed without row swapping, and all pivot elements generated are guaranteed to be positive.

This means we obtain factorization in the form A=LUA = L \cdot U, where the diagonal elements of UU are positive pivot elements for all diagonal indices.

Since A=ATA = A^T, we also have:

A=AT=(LU)T=(LDU~)T=U~TDLTA = A^T = (L \cdot U)^T = (L \cdot D \cdot \tilde{U})^T = \tilde{U}^T \cdot D \cdot L^T

where U~\tilde{U} is a matrix whose main diagonal is normalized to 1, and DD is a diagonal matrix:

U~=(1u12/u11u1n/u111un1,n/un1,n101)\tilde{U} = \begin{pmatrix} 1 & u_{12}/u_{11} & \cdots & u_{1n}/u_{11} \\ & \ddots & \ddots & \vdots \\ & & 1 & u_{n-1,n}/u_{n-1,n-1} \\ 0 & & & 1 \end{pmatrix}
D=(u1100unn)D = \begin{pmatrix} u_{11} & & 0 \\ & \ddots & \\ 0 & & u_{nn} \end{pmatrix}

Since LU decomposition without PP is unique, then:

A=LU=U~T(DLT)A = L \cdot U = \tilde{U}^T \cdot (D \cdot L^T)
L=U~TandU=DLTL = \tilde{U}^T \quad \text{and} \quad U = D \cdot L^T

If we define:

D12=(u1100unn)D^{\frac{1}{2}} = \begin{pmatrix} \sqrt{u_{11}} & & 0 \\ & \ddots & \\ 0 & & \sqrt{u_{nn}} \end{pmatrix}

then D12D12=DD^{\frac{1}{2}} \cdot D^{\frac{1}{2}} = D.

Cholesky Decomposition

Positive definite matrices ARn×nA \in \mathbb{R}^{n \times n} allow for Cholesky decomposition:

A=LDLT=L~L~TA = L \cdot D \cdot L^T = \tilde{L} \cdot \tilde{L}^T

where L~=LD12\tilde{L} = L \cdot D^{\frac{1}{2}} is a regular lower triangular matrix. This matrix can be computed using the Cholesky algorithm.

The computation of matrix L~\tilde{L} is performed with:

L~=(l~110l~n1l~nn)\tilde{L} = \begin{pmatrix} \tilde{l}_{11} & 0 \\ \vdots & \ddots \\ \tilde{l}_{n1} & \cdots & \tilde{l}_{nn} \end{pmatrix}

based on the relationship L~L~T=A\tilde{L} \cdot \tilde{L}^T = A. The following algorithm produces the Cholesky factor.

Cholesky Algorithm

Given a positive definite matrix ARn×nA \in \mathbb{R}^{n \times n}.

l~11:=a11\tilde{l}_{11} := \sqrt{a_{11}}
l~j1:=aj1l~11,j=2,,n\tilde{l}_{j1} := \frac{a_{j1}}{\tilde{l}_{11}}, \quad j = 2, \ldots, n

For i=2,,ni = 2, \ldots, n:

l~ii:=aiil~i12l~i22l~i,i12\tilde{l}_{ii} := \sqrt{a_{ii} - \tilde{l}_{i1}^2 - \tilde{l}_{i2}^2 - \ldots - \tilde{l}_{i,i-1}^2}
l~ji:=l~ii1(ajil~j1l~i1l~j2l~i2l~j,i1l~i,i1)\tilde{l}_{ji} := \tilde{l}_{ii}^{-1} \cdot \left( a_{ji} - \tilde{l}_{j1}\tilde{l}_{i1} - \tilde{l}_{j2}\tilde{l}_{i2} - \ldots - \tilde{l}_{j,i-1}\tilde{l}_{i,i-1} \right)

for j=i+1,,nj = i + 1, \ldots, n.

After running this algorithm, we will obtain the Cholesky factor which is a lower triangular matrix:

L~=(l~110l~n1l~nn)\tilde{L} = \begin{pmatrix} \tilde{l}_{11} & 0 \\ \vdots & \ddots \\ \tilde{l}_{n1} & \cdots & \tilde{l}_{nn} \end{pmatrix}

Cholesky Algorithm Complexity

The Cholesky algorithm for computing the Cholesky factor L~\tilde{L} from ARn×nA \in \mathbb{R}^{n \times n} requires:

16n3+O(n2)\frac{1}{6}n^3 + O(n^2)

arithmetic operations.

This is half the number of operations required to compute LU decomposition, because the use of symmetry allows us to perform computations without row swapping in a different order.