You are on page 1of 12

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Numerical Methods for Chemical Engineers


Chapter 4: System of Linear Algebraic Equation (Decomposition Method)

Saharudin Haron
Page 4 - 1

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

LU Decomposition
[A ]{X } = {C } Decomposition [U ] [L ] [L ]{ D } = {C } {D } [U ] { X } = { D } {X }
Page 4 - 2

Back substitution

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Doolittle LU Decomposition
1) For matrices operation, [A ]{X } = {C }, [A] is decomposed into [L][U]: through nave gauss elimination on matrix A : factors to eliminate element a21, a31 and a32 is used to form matrix [L]
f 21 = a21 a11 f31 = a31 a11 = f32 a32 a22

a11 [U] = 0 0

a12 a22 0

a13 a23 a33

So,

1 [L] = f 21 f 31

0 1 f 32

0 0 1
Page 4 - 3

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Doolittle LU Decomposition
2) Intermediate vector {D} is generated,
1 f 21 f 31 0 1 f 32 [L] 0 d1 c1 0 d 2 = c2 1 c3 d3 {D} {C}

d1 = c1

f21d1 + d2 = c2 d2 = c2 - f21d1

f31d1 + f32d2 + d3 = c3 d3 = c3 - f31d1 f32d2

Page 4 - 4

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Doolittle LU Decomposition
3) Unknown elements, xn can be solved by back substitution on equation [U]{X} = {D},

a11 a12 0 a 22 0 0 [U]


x3 = d 3 a33 x3 = d3 a33

a13 x1 d1 x2 = d 2 a23 a33 x3 d 3 {X } {D}


a11 x1 + a12 x2 + a13 x3 = d1 x1 = d1 a12 x2 a13 x3 a11
Page 4 - 5

x2 + a23 x3 = d 2 a22 x3 d 2 a23 x2 = a22

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Crout LU Decomposition
An alternative approach for the formation of matrices [L] and [U]. i.e. : n = 3, l11 0 [L] = l l 21 22 l31 l 32 0 0 l33 1 u12 [U] = 0 1 0 0 u13 u23 1

Matrices [L] and [U] are generated by sweeping through the matrix by columns and rows : a) Elements of column 1 matrix [L] : li,1 = ai,1 Elements of row 1 matrix [U] : u1,j = a1,j / l1,1 for i = 1, 2, .., n for j = 2, 3, .., n
Page 4 - 6

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Crout LU Decomposition
b) Elements of column 2 to n-1matrix [L] :
lij = aij
k = j 1 k =1

lik ukj

for i = j, j+1, .., n

Elements of row 2 to n-1matrix [U] :


u jk = a jk l ji uik
i =1 i = j 1

for j = 2, 3, .., n-1

for k = j+1, j+2, .., n

l jj

Page 4 - 7

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

c) Element of column n matrix [L] :


lnn = ann lnk ukn
k =1 k = n 1

i.e. : n = 3 l33 = a33 [l31u13 + l32u23]

l11 0 [L] = l l 21 22 l31 l 32

0 0 l33

d) Intermediate vector {D} is generated, [L ]{ D } = {C } e) Unknown elements, xn can be solved by back substitution on equation [U]{X} = {D}.
Page 4 - 8

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

LU Decomposition
(assignment in class)

Use the Doolittle and Crout decomposition method to solve the following equations. 2x1 - 5x2 + x3 = 12 -x1 + 3x2 - x3 = -8 3x1 - 4x2 + 2x3 = 16
Page 4 - 9

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Cholesky Decomposition
A method use to decompose a symmetric matrix (aij = aji) The resulting matrices are the transpose of each other

i.e.

a11 a12 [A] = a21 a22 a31 a32

a13 4 2 1 a23 = 2 9 2 a33 2 8 1

Thus, matrix [A] can be decomposed to [A] = [L][L]T


Page 4 - 10

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Cholesky Decomposition
Therefore,

a11 a12 [A] = a21 a22 a31 a32

a13 4 2 1 a23 = 2 9 2 a33 2 8 1 0 l11 l12 0 = 0 l22 l33 0 0


[L]T

4 2 1 l11 0 2 9 2 = l l 21 22 2 8 l31 l32 1


[A] where [L]

l13 l23 l33

l12 = l21, l13 = l31 and l23 = l32


Page 4 - 11

Chemical Engineering Numerical Method copyright PCS- FKKKSA, UTM

Cholesky Decomposition
Steps to decompose matrix [A],
j =i 1 j =1

Example for 3 x 3 matrix,

l21 =
for i = 1, 2, .., k-1

lki =

aki lij lkj lii

a21 l11 a31 l11 a32 l21l31 l22

l31 = l32 =

Elements on the diagonal:

lkk = akk l
j =1

j =k 1

l11 = a11
kj
2 l22 = a11 l21

2 2 l33 = a33 l31 l32

Page 4 - 12