Upload
ah-tiang
View
48
Download
10
Embed Size (px)
DESCRIPTION
BA201 Engineering Mathematic
Citation preview
B3001/UNIT 9/1
NUMERICAL METHODS
General Objective : Application of numerical methods to solve linear equation.
Specific Objectives : On completion of this unit, you should be able to:-
solve simultaneous linear equation using LU
Method (Doolittle Method)
solve simultaneous linear equation using LU
Method (Crout Method)
UNIT 9
OBJECTIVES
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 2
INPUT
9.0 INTRODUCTION
With Gaussian elimination and Gauss Jordan elimination, a linear system is
solved by operating systematically on the augmented matrix. In this section we shall
discuss a different approach, one based on factoring the coefficient matrix into a product
of lower and upper triangular matrices.
9.1 Solving linear systems by factorization (Doolittle Method)
If an n x n matrix A can be factored into a product of n x n matrices as A = LU
where L is lower triangular and U is upper triangular, then the linear system Ax = b can
be solved as follows
For matrix A, 3 x 3, LU can be shown as:
33
2322
131211
333231
2221
11
333231
232221
131211
00
00
00
u
uu
uuu
lll
ll
l
aaa
aaa
aaa
and A = L U
For 3 system of linear equations.
a11x1 + a12x2 + a13x3 = b1
a21x1 + a22x2 + a23x3 = b2
a31x1 + a32x2 + a33x3 = b3
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 3
Write in a matrix form:
333231
232221
131211
aaa
aaa
aaa
3
2
1
x
x
x
=
3
2
1
b
b
b
A =
333231
232221
131211
aaa
aaa
aaa
x =
3
2
1
x
x
x
and b =
3
2
1
b
b
b
If A is written as LU, then:
33
2322
131211
333231
2221
11
333231
232221
131211
00
00
00
u
uu
uuu
lll
ll
l
aaa
aaa
aaa
With Doolittle method, the diagonal L is given a value 1 as below
33
2322
131211
3231
21
333231
232221
131211
00
0
1
01
001
u
uu
uuu
ll
l
aaa
aaa
aaa
Thus, matrices L and U can be derived
333231
232221
131211
aaa
aaa
aaa
=
3323321331223212311131
2313212212211121
131211
uululululul
uuluulul
uuu
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 4
Compare with matrix A:
1111 ua 1111 au
1212 ua 1212 au
1313 ua 1313 au
112121 ula 11
21
21u
al
22122122 uula 12212222 ulau
23132123 uula 13212323 ulau
113131 ula 11
31
31u
al
2232123132 ulula 22
123132
32u
ulal
332332133133 uulula 233213313333 ululau
To find lij and uij ;
11
1
1u
al i
i for i ≥ 2
jj
ijjijijiij
iju
ulululal
,11,2211 for 2 ≤ j ≤ i
jj au 11 first row of u
jiiijijiijij ulululau ,11,2211 for 2 ≤ i ≤ j
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 5
From Ax = b:
333231
232221
131211
aaa
aaa
aaa
3
2
1
x
x
x
=
3
2
1
b
b
b
then,
00
0
1
01
001
33
2322
131211
3231
21
u
uu
uuu
ll
l
3
2
1
x
x
x
=
3
2
1
b
b
b
with substitution;
33
2322
131211
00
0
u
uu
uuu
3
2
1
x
x
x
=
3
2
1
y
y
y
For Ax = b then;
1
01
001
3231
21
ll
l
3
2
1
y
y
y
=
3
2
1
b
b
b
And the product will be:
3232131
2121
1
yylyl
yyl
y
=
3
2
1
b
b
b
From the matrix, you will find the values of y1, y2 and y3 from the equations
11 by
22121 byyl 12122 ylby
33232131 byylyl 23213133 ylylby
From matrix y, you will find the values of x
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 6
33
2322
131211
00
0
u
uu
uuu
3
2
1
x
x
x
=
3
2
1
y
y
y
thus
333
323222
313212111
xu
xuxu
xuxuxu
=
3
2
1
y
y
y
then, xn ,
3333 yxu 33
3
3u
yx
2323222 yxuxu 22
3232
2u
xuyx
1313212111 yxuxuxu 11
3132121
1u
xuxuyx
Example 9.1:
Solve the following system of linear equation:
x1 + 3x2 + 3x3 = 4
2x1 –3x2 – 2x3 = 2
3x1 + x2 + 2x3 = 5
Solution:
Writing in an LU format,
213
232
331
3
2
1
x
x
x
=
5
2
4
for A =
213
232
331
x =
3
2
1
x
x
x
and b =
5
2
4
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 7
If A = LU, then,
33
2322
131211
333231
2221
11
00
00
00
213
232
331
u
uu
uuu
lll
ll
l
By Doolittle method, the diagonal for matrix L is given a value of 1
33
2322
131211
3231
21
00
0
1
01
001
213
232
331
u
uu
uuu
ll
l
By multiplying the two matrices on the right
213
232
331
=
3323321331223212311131
2313212212211121
131211
uululululul
uuluulul
uuu
You will find the values of un
111 u 111 u
123 u 312 u
133 u 313 u
11212 ul 21
22
11
21 u
l
2212213 uul 9)3(233 122122 ulu
2313212 uul 8)3(222 132123 ulu
11313 ul 31
33
11
31 u
l
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 8
223212311 ulul 889.09
)3)(3(11
22
1231
32
u
ull
33233213312 uulul 2332133133 2 ululu
111.0)8)(889.0()3)(3(2
Then matrix L =
1889.03
012
001
and U =
111.000
890
331
You will then find the values of yn.
1
01
001
3231
21
ll
l
3
2
1
y
y
y
=
5
2
4
1889.03
012
001
3
2
1
y
y
y
=
5
2
4
321
21
1
889.03
2
yyy
yy
y
=
5
2
4
Therefore,
41 y
22 21 yy 6)4)(2(22 y
5889.03 321 yyy 667.1)6)(889.0()4)(3(53 y
Next, you find the values of x:
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 9
33
2322
131211
00
0
u
uu
uuu
3
2
1
x
x
x
=
3
2
1
y
y
y
111.000
890
331
3
2
1
x
x
x
=
667.1
6
4
3
32
321
111.0
89
33
x
xx
xxx
=
667.1
6
4
The values of x can be calculated through back substitution.
667.1111.0 3 x 15111.0
667.13
x
689 32 xx 149
)15)(8(62
x
433 321 xxx 7)15(3)14(341 x
Then , x1 = 7, x2 = 14 and x3 = -15.
Example 9.2:
Solve the linear equation below:
6x1 + 3x2 + x3 = 4
4x1 – 2x2 – 3x3 = 2
3x1 – 7x2 + 3x3 = 5
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 10
Solution:
As e.g. 9.1, you write the equation in a matrix form:
373
324
136
3
2
1
x
x
x
=
27
28
13
where A =
373
324
136
and b =
27
28
13
Next, you have to find matrices for L, U, y and x.
For L and U, using A = LU, then
333231
232221
131211
33
2322
131211
3231
21
00
0
1
01
001
aaa
aaa
aaa
u
uu
uuu
ll
l
3323321331223212311131
2313212212211121
131211
uululululul
uuluulul
uuu
=
373
324
136
611 u 312 u 113 u
667.06
44
4
11
21
1121
ul
ul
4)3)(667.0(32
2
122122
221221
ulu
uul
667.3)1)(667.0(33
3
132123
231321
ulu
uul
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 11
5.06
33
3
11
31
1131
ul
ul
292.10)667.3)(125.2()1)(5.0(33
3
2332133133
3323321331
ululu
uulul
Then, L =
1125.25.0
01667.0
001
and U =
292.1000
667.340
136
Calculating for y, from Ly = b
1125.25.0
01667.0
001
3
2
1
y
y
y
=
27
28
13
321
21
1
125.25.0
667.0
yyy
yy
y
=
27
28
13
131 y
333.19)13(667.028
28667.0
2
21
y
yy
125.24
)3)(5.0(77
7
22
123132
22321231
u
ull
ulul
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 12
583.20)333.19(125.2)13(5.027
27125.25.0
3
321
y
yyy
If y =
583.20
333.19
13
, x can be find by using Ux = y, :
292.1000
667.340
136
3
2
1
x
x
x
=
583.20
333.19
13
3
32
321
292.10
667.34
36
x
xx
xxx
=
583.20
333.19
13
Using back substitution
2
292.10
583.20
583.20292.10
3
3
x
x
3
4
)2(667.3333.19
333.19667.34
2
32
x
xx
4)2()3(313
1336
1
321
x
xxx
Then x1 = 4, x2 = -3 and x3 = -2.
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 13
Example 9.3:
Solve the linear equation below:
2x1 x2 4x3 = 8
x1 – 5x2 – 9x3 = -9
7x1 – 2x2 + 3x3 = 3
Solution:
As example 9.2, write in the form of augmented matrices, and simplified
calculation
For l and u :
21111 au
11212 au
41313 au
5.02
1
11
2121
u
al
5.4)1)(5.0(512212222 ulau
7)4)(5.0(913212323 ulau
5.32
7
11
31
31 u
al
333.05.4
)1)(5.3(2
22
123132
32
u
ulal
667.14)7)(333.0()4)(5.3(3233213313333 ululau
Formulae for y;
811 by
13)8)(5.0(912122 ylby
333.29)13)(333.0()8)(5.3(323213133 ylylby
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 14
Then x:
2667.14
333.29
33
3
3
u
yx
65.4
)2)(7(13
22
3232
2
u
xuyx
32
)2)(4()6)(1(8
11
3132121
1
u
xuxuyx
“This method is well suited for digital computers and is the basis for many practical
computer programs.”
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 15
ACTIVITY 9a
1. Using Doolittle method, find matrices for L and U .
a)
385
522
451
b)
291
405
152
2. Solve the system below by using Doolittle method and LU-decomposition:
a) 3x1 – 2x2 + 3x3 = 23
x1 + 4x2 + x3 = 17
2x1 + x2 + 3x3 = 25
b) 7x + 4y + 3z = 26
6x + 11y = 60
4x + 6y +12z = 68
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 16
FEEDBACK 9a
1. a) L =
075.25
012
001
U =
75.1200
13120
451
b) L =
052.05.0
015.2
001
U =
72.100
5.15.120
152
2. a) x1 = 4 x2 = 2 x3 = 5
b) x = -1 y = 6 z = 3
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 17
INPUT
9.2 CROUT METHOD
Like Doolittle, Crout method is another method of LU decomposition using
numerical analysis. Using Ax = b as the augmented matrices, you decompose L
and U for A.
Therefore,
LU = A
333231
232221
131211
33
2322
131211
333231
2221
11
00
00
00
aaa
aaa
aaa
u
uu
uuu
lll
ll
l
Using Crout’s Method, main diagonal of matrix U is given a value of 1, where
333231
232221
131211
23
1312
333231
2221
11
100
10
1
0
00
aaa
aaa
aaa
u
uu
lll
ll
l
By multiplying L and U,
332332133132123131
2322132122122121
1311121111
lulullull
ulullull
ulull
=
333231
232221
131211
aaa
aaa
aaa
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 18
You can find the values for l and u by comparing the corresponding entries.
11
13
13131311
11
1212121211
1111
l
auaul
l
auaul
al
1221222222221221
2121
ulalalul
al
233213313333333323321331
1231323232321231
3131
22
132123
232323221321
ululalalulul
ulalalul
al
l
ulauaulul
Using corresponding step, then:
11 ii al for i = 1,2,…,n
11
1
1l
au
j
j for j = 2,3,…,n
ijjijijiijij ulululal ,11,2211 for 2 ≤ j ≤ n-1
jj
njiiijijiij
ijl
ulululau
,11,2211 for 2 ≤ j ≤ n
After solving for matrices L and U, use Ly = b to find matrix y
Ly = b
3
2
1
3
2
1
333231
2221
11
0
00
b
b
b
y
y
y
lll
ll
l
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 19
333232131
222121
111
ylylyl
ylyl
yl
3
2
1
b
b
b
Where,
33
2321313
33333232131
22
121222222121
11
111111
l
ylylbybylylyl
l
ylbybylyl
l
bybyl
From Ux = y, you will find the variables of x.
Ux = y
3
2
1
23
1312
100
10
1
x
x
x
u
uu
3
2
1
y
y
y
3
3232
3132121
x
xux
xuxux
3
2
1
y
y
y
Through back substitution and comparing the entries, find the values of x
3132121113132121
3232223232
33
xuxuyxyxuxux
xuyxyxux
yx
Like Doolittle, your main task is to find matrices of L and U.
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 20
Example 9.4:
Solve the system of linear equation below:
x1 – 3x2 + 2x3 = 8
4x1 – x2 – x3 = 9
3x1 + 2x2 + x3 = 21
Solution:
Write in the form of Ax = b
123
114
231
3
2
1
x
x
x
=
21
9
8
Find L and U,
LU = A
123
114
231
100
10
1
0
00
23
1312
333231
2221
11
u
uu
lll
ll
l
332332133132123131
2322132122122121
1311121111
lulullull
ulullull
ulull
123
114
231
111 l
31
33
3
11
12
1211
lu
ul
22
2
2
11
13
1311
lu
ul
421 l
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 21
113411
1
122122
221221
ull
lul
818.0
11
2411
1
22
1321
23
23221321
l
ulu
ulul
331 l
113322
2
123132
321231
ull
lul
4818.0112311
1
2332133133
3323321331
ulull
lulul
Therefore,
L =
4113
0114
001
and U =
100
818.010
231
By using Ly = b, find the matrix of y
Ly = b
4113
0114
001
21
9
8
3
2
1
y
y
y
321
21
1
4113
114
yyy
yy
y
21
9
8
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 22
81 y
09.2
11
849
9
2
222121
y
ylyl
5
4
)09.2(118321
21
3
333232131
y
ylylyl
Therefore, y =
5
09.2
8
You can find matrix x from Ux = y
Ux = y
100
818.010
231
3
2
1
x
x
x
5
09.2
8
3
32
321
818.0
23
x
xx
xxx
5
09.2
8
Using back substitution and comparing entries you will find the values of x ;
53 x
2)5(818.009.2
09.2818.0
2
32
x
xx
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 23
4)5)(2()2)(3(8
823
1
321
x
xxx
Therefore,
x1 = 4, x2 = 2 and x3 = 5.
Example 9.5:
Solve the system of linear equation below:
2x1 + x2 + 6x3 = 4
5x1 – 2x2 – 8x3 = 6
6x1 – 7x2 + 3x3 = 2
Solution:
Using numerical analysis, solve for lij, uij, y iand xi.
From example 9.2, find l and u,
21111 al
5.02
1
11
1212
l
au
32
6
11
13
13 l
au
52121 al
5.4)5.0)(5()2(12212222 ulal
556.15.4
)3)(5(8
22
132123
23
l
ulau
63131 al
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 24
10)5.0)(6()7(12313232 ulal
556.0)556.1)(10()3)(6(3233213313333 ululal
Then find yi and xi:
22
4
11
11
l
by
89.05.4
)2)(5(6
22
12122
l
ylby
2556.0
)89.0)(10()2)(6(2
33
2321313
3
l
ylylby
233 yx
4)2)(556.1(89.032322 xuyx
6)2)(3()4)(5.0(231321211 xuxuyx
Therefore,
x1 = 6, x2 = 4 and x3 = -2.
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 25
ACTIVITY 9b
1. Using Crout method, find the decomposition of L and U for.
a)
211
412
122
b)
423
681
714
2. Using Crout’s Method, solve for system of linear equations below.
a) 4x1 – x2 + 3x3 = 38
3x1 + 4x2 + 6x3 = 35
x1 – 5x2 + 3x3 = 21
b) 2x + 9y – 3z = 5
4y – 2z = 0
4z – x –5y = 11
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 26
FEEDBACK 9b
1. a) L =
5.201
032
002
U =
100
110
5.011
b) L =
667.1075.23
025.81
004
U =
100
515.010
75.125.01
2. a) x1 = 7 x2 = -1 x3 = 3
b) x = -2 y = 3 z = 6
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 27
SELF ASSESSMENT
1 Using Doolittle and Crout’s Method, find matrices of L, U, y and x for system of
linear equations below:.
2
a. 2s – 5t + u = 12
3s – t – u = -8
3s – 4t + 2u = 16
b. 0.6v + 1.2I + 2.8R = 9816
3.2v – 0.4I + 3.0R = 11770
1.5v – 0.5I + 0.3R = 1200
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 28
FEEDBACK
1. a) Doolittle Method
a- L =
1538.05.1
015.1
001
U =
846.100
5.25.60
152
y =
12
26
12
x =
5.6
5.1
1
b- L =
1515.05.2
0133.5
001
U =
608.000
933.118.60
8.22.16.0
y =
059.2097
41272
9816
x =
3450
15
230
b) Crout Method
i - L =
846.15.33
05.63
002
U =
100
385.010
5.05.21
y =
5.6
4
6
x =
5.6
5.1
1
B3001/UNIT 9/5
Prepared by : Siti Sharmila Osmin/Nithya A/P Periasamy Page 29
ii- L =
608.05.35.1
08.62.3
006.0
U =
100
755.110
667.421
y =
3450
412.6069
16360
x =
3450
15
230