## Cholesky's Matrix Decomposition

Back to Programming

### Description

This method is a modified version of LU factorization method to solve linear equations. This method is known as the square root method.

DERIVATION Since this is a positive definite hence, Now, according to Cholesky, there exists a lower triangular matrix L such that Then  Hence     The above method can be written where A can be decomposed into upper triangular matrix as:     ### Algorithm

Input:

A matrix

OUTPUT:

Lower triangular matrix and its transpose

PROCESS:

``````Step 1: [taking inputs from user]
Read n [the order of the matrix]
for i = 0 to n - 1 repeat
for j = 0 to n - 1 repeat
[End of ‘for’ loop]
[End of ‘for’ loop]

Step 2: [Cholesky method]
for i = 0 to n - 1 repeat
for j = 0 to n - 1 repeat
Set l[i][j] ← 0
[End of ‘for’ loop]
[End of ‘for’ loop]
for i = 0 to n - 1 repeat
for j = 0 to i repeat
Set s ← 0
if j = I then
for k = 0 to j - 1 repeat
Set s ← s + (l[j][k] × l[j][k])
[End of ‘for’ loop]
Set l[j][j] ← square root of(arr[j][j] - s)
else
for k = 0 to j - 1 repeat
Set s ← s + (l[i][k] × l[j][k])
[End of ‘for’ loop]
Set l[i][j] ← (arr[i][j] - s) / l[j][j]
[End of ‘if’]
[End of ‘for’ loop]
[End of ‘for’ loop]
for i = 0 to n - 1 repeat
for j = 0 to n - 1 repeat
print l[i][j])
[End of ‘for’ loop]
Move to next line
[End of ‘for’ loop]
for i = 0 to n - 1 repeat
for j = 0 to n - 1 repeat
print l[j][i])
[End of ‘for’ loop]
Move to next line
[End of ‘for’ loop]
[End of Cholesky method]``````

### Code

1. It solves the equations faster than the LU decomposition method of solving linear equations.

2. It is very useful to solve linear equations with symmetric positive and definite matrices.