# Cholesky Factorization using MATLAB | MATLAB Tutorial

A symmetric matrix is one where *a _{i j} *=

*a*for all

_{ji}*i*and

*j*. In other words, [

*A*] = [

*A*]

*T*. Such systems occur commonly in both mathematical and engineering/science problem contexts.

Special solution techniques are available for such systems. They offer computational advantages because only half the storage is needed and only half the computation time is required for their solution.

One of the most popular approaches involves *Cholesky factorization *(also called Cholesky decomposition). This algorithm is based on the fact that a symmetric matrix can be decomposed, as in

*A*] = [

*U*]

*[*

^{T}*U*]

That is, the resulting triangular factors are the transpose of each other.

The terms of above eq. can be multiplied out and set equal to each other. The factorization can be generated efficiently by recurrence relations. For the *i*th row:

** Problem 1: **Compute the Cholesky factorization for the symmetric matrix

For the first row (*i *= 1),

For the second row (*i *= 2),

For the third row (*i *= 3),

Thus, the Cholesky factorization yields

After obtaining the factorization, it can be used to determine a solution for a right-hand- side vector {*b*} in a manner similar to *LU *factorization. First, an intermediate vector {*d*} is created by solving

*U*]

*{*

^{T}*d*} = {

*b*}

Then, the final solution can be obtained by solving

[*U*]{

*x*} = {

*d*}

**Matlab m-file:**

function x = Cholesky(A) % input: % A = coefficient matrix % output: % x = solution vector [m,n]=size(A); if m~=n, error('Matrix A must be square'); end % Right-hand-side vector is the sum of % the rows of [A] can be generated as b = [sum(A(1,:)); sum(A(2,:)); sum(A(3,:))]; U = chol(A); % Cholesky factorization disp('U = ');disp(U) d = U'\b; x = U\d; % solution disp('x = ');disp(x)

The M-file can be used to solve the problem 1.

*>> A = [6 15 55; 15 55 225; 55 225 979];*

*>> Cholesky(A);*

*U =*

*2.4495 6.1237 22.4537*

*0 4.1833 20.9165*

*0 0 6.1101*

*x =*

*1.0000*

*1.0000*

*1.0000*

### Leave a Comment

### Recommended Posts

##### Fun Examples with GUI | MATLAB Tutorial

20 Oct 2017 - GUI Building, Tutorial