91 Verification that [L][U] = [A].
LU ans =
10.0000 2.0000 -1.0000 -3.0000 -6.0000 2.0000
1.0000 1.0000 5.0000 Check using the lu function,
[L,U]=luA L =
1.0000 0 0 -0.3000 1.0000 0
0.1000 -0.1481 1.0000 U =
10.0000 2.0000 -1.0000 0 -5.4000 1.7000
0 0 5.3519
9.7 The result of Example 9.4 can be substituted into Eq. 9.14 to give
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
= =
110101 .
6 9165
. 20
1833 .
4 45366
. 22
123724 .
6 44949
. 2
110101 .
6 9165
. 20
45366 .
22 1833
. 4
123724 .
6 44949
. 2
] [
] [
] [
U U
A
T
The multiplication can be implemented as in 000001
. 6
44949 .
2
2 11
= =
a
15 44949
. 2
123724 .
6
12
= ×
= a
00002 .
55 44949
. 2
45366 .
22
13
= ×
= a
15 123724
. 6
44949 .
2
21
= ×
= a
99999 .
54 1833
. 4
123724 .
6
2 2
22
= +
= a
225 1833
. 4
9165 .
20 123724
. 6
45366 .
22
2 22
= ×
+ ×
= a
00002 .
55 45366
. 22
44949 .
2
31
= ×
= a
225 9165
. 20
1833 .
4 45366
. 22
123724 .
6
32
= ×
+ ×
= a
0002 .
979 110101
. 6
9165 .
20 45366
. 22
2 2
2 33
= +
+ =
a
92
9.8 a For the first row i = 1, Eq. 9.15 is employed to compute
828427 .
2 8
11 11
= =
= a u
Then, Eq. 9.16 can be used to determine
071068 .
7 828427
. 2
20
11 12
12
= =
= u
a u
303301 .
5 828427
. 2
15
11 13
13
= =
= u
a u
For the second row i = 2, 477226
. 5
071068 .
7 80
2 2
12 22
22
= −
= −
= u
a u
282177 .
2 477226
. 5
303301 .
5 071068
. 7
50
22 13
12 23
23
= −
= −
= u
u u
a u
For the third row i = 3,
163978 .
5 282177
. 2
303301 .
5 60
2 2
2 23
2 13
33 33
= −
− =
− −
= u
u a
u Thus, the Cholesky decomposition yields
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
= 163978
. 5
282177 .
2 477226
. 5
303301 .
5 071068
. 7
828427 .
2 ]
[U The validity of this decomposition can be verified by substituting it and its transpose into
Eq. 9.14 to see if their product yields the original matrix [A]. This is left for an exercise. b
A = [8 20 15;20 80 50;15 50 60]; U = cholA
U = 2.8284 7.0711 5.3033
0 5.4772 2.2822 0 0 5.1640
c
The solution can be obtained by hand or by MATLAB. Using MATLAB: b = [50;250;100];
d=U\b d =
93 17.6777
22.8218 -8.8756
x=U\d x =
-2.7344 4.8828
-1.7187
9.9 Here is an M-file to generate the Cholesky decomposition without pivoting
function U = choleskyA choleskyA:
cholesky decomposition without pivoting. input:
A = coefficient matrix output:
U = upper triangular matrix [m,n] = sizeA;
if m~=n, errorMatrix A must be square; end for i = 1:n
s = 0; for k = 1:i-1
s = s + Uk, i 2; end
Ui, i = sqrtAi, i - s; for j = i + 1:n
s = 0; for k = 1:i-1
s = s + Uk, i Uk, j; end
Ui, j = Ai, j - s Ui, i; end
end Test with Prob. 9.8
A = [8 20 15;20 80 50;15 50 60]; choleskyA
ans = 2.8284 7.0711 5.3033
0 5.4772 2.2822 0 0 5.1640
Check with the chol function U = cholA
U = 2.8284 7.0711 5.3033
0 5.4772 2.2822 0 0 5.1640
94
CHAPTER 10
10.1
First, compute the LU decomposition The matrix to be evaluated is
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
− 5
1 1
2 6
3 1
2 10
Multiply the first row by f
21
= –310 = –0.3 and subtract the result from the second row to eliminate the a
21
term. Then, multiply the first row by f
31
= 110 = 0.1 and subtract the result from the third row to eliminate the a
31
term. The result is
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
1 .
5 8
. 7
. 1
4 .
5 1
2 10
Multiply the second row by f
32
= 0.8–5.4 = –0.148148 and subtract the result from the third row to eliminate the a
32
term.
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
351852 .
5 7
. 1
4 .
5 1
2 10
Therefore, the LU decomposition is
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
= 351852
. 5
7 .
1 4
. 5
1 2
10 1
148148 .
1 .
1 3
. 1
] ]{
[ U
L The first column of the matrix inverse can be determined by performing the forward-
substitution solution procedure with a unit vector with 1 in the first row as the right-hand- side vector. Thus, the lower-triangular system, can be set up as,
⎪⎭ ⎪
⎬ ⎫
⎪⎩ ⎪
⎨ ⎧
= ⎪⎭
⎪ ⎬
⎫ ⎪⎩
⎪ ⎨
⎧ ⎥
⎥ ⎦
⎤ ⎢
⎢ ⎣
⎡ −
− 1
1 148148
. 1
. 1
3 .
1
3 2
1
d d
d
and solved with forward substitution for {d}
T
=
⎣ ⎦
055556 .
3 .
1 −
. This vector can then be used as the right-hand side of the upper triangular system,
⎪⎭ ⎪
⎬ ⎫
⎪⎩ ⎪
⎨ ⎧
− =
⎪⎭ ⎪
⎬ ⎫
⎪⎩ ⎪
⎨ ⎧
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
055556 .
3 .
1 351852
. 5
7 .
1 4
. 5
1 2
10
3 2
1
x x
x
which can be solved by back substitution for the first column of the matrix inverse,
95 ⎥
⎥ ⎦
⎤ ⎢
⎢ ⎣
⎡ −
− =
−
010381 .
058824 .
0.110727 ]
[
1
A To determine the second column, Eq. 9.8 is formulated as
⎪⎭ ⎪
⎬ ⎫
⎪⎩ ⎪
⎨ ⎧
= ⎪⎭
⎪ ⎬
⎫ ⎪⎩
⎪ ⎨
⎧ ⎥
⎥ ⎦
⎤ ⎢
⎢ ⎣
⎡ −
− 1
1 148148
. 1
. 1
3 .
1
3 2
1
d d
d
This can be solved with forward substitution for {d}
T
=
⎣ ⎦
148148 .
1 , and the results
are used with [U] to determine {x} by back substitution to generate the second column of the matrix inverse,
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
− =
−
027682 .
010381 .
176471 .
058824 .
038062 .
0.110727 ]
[
1
A Finally, the same procedures can be implemented with {b}
T
=
⎣ ⎦
1 to solve for {d}
T
=
⎣ ⎦
1
, and the results are used with [U] to determine {x} by back substitution to generate the third column of the matrix inverse,
⎥ ⎥
⎦ ⎤
⎢ ⎢
⎣ ⎡
− −
− =
−
186851 .
027682 .
010381 .
058824 .
176471 .
058824 .
00692 .
038062 .
0.110727 ]
[
1
A This result can be checked by multiplying it times the original matrix to give the identity
matrix. The following MATLAB session can be used to implement this check, A = [10 2 -1;-3 -6 2;1 1 5];
AI = [0.110727 0.038062 0.00692; -0.058824 -0.176471 0.058824;
-0.010381 0.027682 0.186851]; AAI
ans = 1.0000 -0.0000 -0.0000
0.0000 1.0000 -0.0000 -0.0000 0.0000 1.0000
10.2 The system can be written in matrix form as