Lesson 7 of 15

Cholesky Decomposition

Cholesky Decomposition

For a symmetric positive definite (SPD) matrix AA, the Cholesky decomposition gives:

A=LLTA = L L^T

where LL is lower triangular with positive diagonal entries.

Why Cholesky?

  • Twice as fast as LU (exploits symmetry)
  • Numerically more stable
  • The positive diagonal entries confirm AA is truly SPD

Algorithm

Lij=Aijk<jLikLjkLjj(i>j, off-diagonal)L_{ij} = \frac{A_{ij} - \sum_{k < j} L_{ik}\, L_{jk}}{L_{jj}} \quad (i > j, \text{ off-diagonal})

Ljj=Ajjk<jLjk2(diagonal)L_{jj} = \sqrt{A_{jj} - \sum_{k < j} L_{jk}^2} \quad (\text{diagonal})

Example

A=(422253236),L=(200120112)A = \begin{pmatrix} 4 & 2 & 2 \\ 2 & 5 & 3 \\ 2 & 3 & 6 \end{pmatrix}, \quad L = \begin{pmatrix} 2 & 0 & 0 \\ 1 & 2 & 0 \\ 1 & 1 & 2 \end{pmatrix}

Check: LLT=AL L^T = A.

Your Task

Implement cholesky(A) returning the lower triangular factor L.

Python runtime loading...
Loading...
Click "Run" to execute your code.