Example of LU Decomposition

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Example of LU Decomposition

10 x1 2 x2 x3

27

3x1 6 x2 2 x3 61.5
x1 x2 5 x3 21.5
In the matrix form,

2 1
10
3 6 2

1
1 5

x1 27

x2 61.5
x 21.5

[A} . {x} = {b}


Factoring [A] into two triangular matrices [L].[U]
Start with
2 1 R1
1 0 0 10
0 1 0. 3 6 2 R2

0 0 1 1
1 5 R3
Use gauss elimination to eliminate the term a21, a31 and a32 of matrix [A]
f21= -3/10 , f31=1/10
R2= f21*R1-R2

R3=f31*R1-R3

1 0 0 10 2 1
f 1 0 . 0 5.4 1.7
21

f 31 0 1 0 0.8 5.1

1
0 0 10 2 1

3
1 0. 0
5.4 1.7
10

1
0 0.8 5.1
10 0 1
f32=-0.8/5.4 = - 4/27
R3=f32*R2-R3

1
0

3
1
10
1 4
10
27

0 10 2 1
0 . 0 5.4 1.7

0
0
5.35
1

[L]
[L] . {d} = {b}

[U]

1 0 0 10 2

f 21 1 0 . 0 5.4
1
f

31 f 32 1 0 0

1
1.7
5.35

1
0
0 d1 27

3
1
0 .d 2 61.5
10

1
d 3 21.5
4
1

27
10
d1=27

d2= -53.4

solve d1, d2 and d3 using forward substitution

d3=-32.11

[U] . {x} = {d}


10 2 1 x1 27
0 5.4 1.7 . x 53.4

0
0
5.35 x3 32.11
4.82X3 = -17.73
X3 = -6.0
5.4X2 - 1.7(-6) = -53.4
X2 = 8.0
10X1+ 2(8) -1(-6) = 27
X1 = 0.5

solve X1, X2 and X3 using backward substitution

You might also like