Вы находитесь на странице: 1из 9

BITS Pilani

Hyderabad Campus

Lecture -11:
SYSTEM of LINEAR ALGEBRAIC EQUATIONS
Direct Methods: LU Decomposition
LU Decomposition

Solve A . x = b (system of linear equations)

Decompose A = L . U

0
* 0

L : Lower Triangular Matrix U : Upper Triangular Matrix

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-2
LU Decomposition

To solve [A]{x}={b}

[L][U]=[A]  [L][U]{x}={b}

Consider [U]{x}={d}
[L]{d}={b}

1. Solve [L]{d}={b} using forward substitution to get {d}

2. Use back substitution to solve [U]{x}={d} to get {x}

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-3
LU Decomposition

Ax  b LU x  b


 a11 a12 a13   1 0 0 u11 u12 u13 
A  a21 a22 a23   l
 21 1 0  0 u
 22 u 
23 
a31 a32 a33  l31 l32 1  0 0 u33 

[L] [U]

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-4
LU Decomposition

Ax  b LU x  b


 a11 a12 a13   x1  b1 
a     
 21 a22 a23   x2   b2 
a31 a32 a33   x3  b3 
a11 a12 a13   x1  b1 
Gauss Elimination    0 a22 '    '

'
a23   x2   b2 
 0 0 a33   x3  b3'' 
''

1 0 0

L  l 21 1 0
[U]
 l31 l32 1 Coefficients used during the elimination step

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-5
LU Decomposition

 a11 a12 a13   1 0 0 a11 a12 a13 


A  a21 a22 a23   l 21 1 0  0 a22
' ' 
a23 
a31 a32 a33  l31 l32 1  0 0 a33 
''

a21
l21 
a11
[ L.U ]
a31
l31 
a11

l32  ?
CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-6
Example
  1 2.5 5  1 0 0  1 2.5 5
 2 9 11  2 1 0  0 4 1  .
     A = L U
 4  22  20  4  3 1  0 0 3
Gauss Elimination
Coefficients
  1 2.5 5   1 2.5 5
l21 = -2/-1= 2  2 9 11    0 4 1
 
l31 = 4/-1= -4  4  22  20  0  12 0

 1 2.5 5  1 2.5 5
0 4 1   
   0 4 1 
[L] l32 = -12/4= -3  0  12 0  0 0 3

 1 0 0 1 0 0

L   2 1 0  L   2 1 0 [U]
 4 ?? 1  4  3 1

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-7
Example:
Gauss Elimination with pivoting
  1 2.5 5   4  22  20

 2 9 11    pivoting   2 9 11  A = L U
 
 4  22  20    1 2.5 5 

Coefficients
 4  22  20 4  22  20 4  22  20
l21 = -2/4= -.5  2 9 11   0  2 1   pivoting  0  3 0 
     
l31 = -1/4= -.25   1 2.5 5  0  3 0  0  2 1 

4  22  20 4  22  20
Coefficients 0  3 0   0  3 0 
   
l32 = -2/-3 0  2 1  0 0 1 

 1 0 0  1 0 0  1 0
L    0 .5 1 0   0.25 1 0   0.25
0
1 0
[U]
 0.25 ?? 1   0 .5 ?? 1   0 .5 0 .6 6 1

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-8
• Gauss Elimination can be used to decompose [A] into [L] and [U].
Therefore, it requires the same total FLOPs as for Gauss elimination:
In the order of (proportional to) N3 where N is the # of unknowns.

• lij values (the factors generated during the elimination step) can be
stored in the lower part of the matrix to save storage. This can be
done because these are converted to zeros anyway and unnecessary
for the future operations.

• Saves computing time by separating time-consuming elimination step


from the manipulations of the right hand side.

• Provides efficient means to compute the matrix inverse

CHE F242 Numerical Methods for Chemical Engineers, BITS, Pilani-Hyderabad Campus P-9

Вам также может понравиться