0% found this document useful (0 votes)
130 views4 pages

LU Decomposition With Gauss Elimination

This document discusses two methods for solving systems of linear equations: LU decomposition with Gaussian elimination and Cholesky decomposition. LU decomposition involves decomposing the coefficient matrix A into lower triangular matrix L and upper triangular matrix U. Cholesky decomposition involves decomposing a symmetric positive-definite matrix A into the product of a lower triangular matrix L and its transpose. Both methods are demonstrated with examples using MATLAB.

Uploaded by

Jigar Sheth
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views4 pages

LU Decomposition With Gauss Elimination

This document discusses two methods for solving systems of linear equations: LU decomposition with Gaussian elimination and Cholesky decomposition. LU decomposition involves decomposing the coefficient matrix A into lower triangular matrix L and upper triangular matrix U. Cholesky decomposition involves decomposing a symmetric positive-definite matrix A into the product of a lower triangular matrix L and its transpose. Both methods are demonstrated with examples using MATLAB.

Uploaded by

Jigar Sheth
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

LU Decomposition with Gauss Elimination:

This procedure is done in 2 steps which are as follows:

1) LU Decomposition: [A] is decomposed into lower [L] and upper [U] triangular matrics

[A] = [3 -0.1 -0.2; 0.1 7 -0.3; 0.3 -0.2 10];

[L,U] = lu(A)

Forward Elimination step is performed to reduce the original co efficient matrix A. This produces the
following result :

[U]= [3 -0.1 -0.2; 0 7.00333 -0.293333; 0 0 10.0120]

[L] = [1 0 0; 0.0333 1 0; 0.1 -0.0271 1]

This result can be verified by multiplying this two matrices and comparing them with original matrix. If
the multiplication matrix is same as original matrix than the upper and lower matrices have correct
value.

2) Substitution Step: [L] and [U] are used to find the solution.

[L][D]=[B] , using this equation we can find the value of D.

D=[L]/[B]= 7.85
-19.5617
70.0843

This result is substituted into following equation :

[U]{X}-{D}=0

X= U/D

X = 3.0000
-2.5000
7.0000
MATLAB Code:

% LU Factorization
clc
clear all
a = [3 -0.1 -0.2; -0.1 7 -0.3; -0.3 -0.2 10];
b = [7.85; -19.3; 71.4];

[l,u]= lu(a)

ans = l*u % to verify correct value of l and u

d=l\b

x=u\d

Results:

% LU Factorization
clc
clear all
a = [3 -0.1 -0.2; -0.1 7 -0.3; -0.3 -0.2 10];
b = [7.85; -19.3; 71.4];

[l,u]= lu(a)

ans = l*u % to verify correct value of l and u

d=l\b

x=u\d

l =
1.0000 0 0
-0.0333 1.0000 0
-0.1000 -0.0300 1.0000

u =
3.0000 -0.1000 -0.2000
0 6.9967 -0.3067
0 0 9.9708

ans =
3.0000 -0.1000 -0.2000
-0.1000 7.0000 -0.3000
-0.3000 -0.2000 10.0000

d =
7.8500
-19.0383
71.6136

x =
3.0153
-2.4063
7.1823
Cholesky Decomposition:

This method is used to find solution of symmetric matrix. This method takes almost half time to find
solution in comparison to find using LU factorization. It also takes almost half storage.

Symmetric matrix can be decomposed as, [A]=[L][L] T

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

L= chol(A)

This produces cholesky factorization.

L= [2.4495 6.1237 22.4537; 0 4.1833; 20.9165; 0 0 6.1101]

The factorization can be tested using following method:

[L]*[L]T = original solution

If both the results are same than the generated factorization is correct.

To generate solution,

D= LT/b

D= 31.0269
25.0998
6.1101

X=A/Y

X= 1.0000
1.0000
1.0000
MATLAB Code:
clc
clear all
A=[6 15 55; 15 55 225; 55 225 979];

b= [sum(A(1,:)); sum(A(2,:)); sum(A(3,:))]


L= [2.4495 0 0; 6.1237 4.1833 0; 22.4537 20.9165 6.1101];
L_trans=L'

d=L\b

Results:
clc
clear all
A=[6 15 55; 15 55 225; 55 225 979];

b= [sum(A(1,:)); sum(A(2,:)); sum(A(3,:))]


L= [2.4495 0 0; 6.1237 4.1833 0; 22.4537 20.9165 6.1101];
L_trans=L'

d=L\b

b =
76
295
1259

L_trans =
2.4495 6.1237 22.4537
0 4.1833 20.9165
0 0 6.1101

d =
31.0267
25.1002
6.1091

You might also like