Documente Academic
Documente Profesional
Documente Cultură
CHAPTER 10
10.1 The flop counts for LU decomposition can be determined in a similar fashion as was done for Gauss
elimination. The major difference is that the elimination is only implemented for the left-hand side
coefficients. Thus, for every iteration of the inner loop, there are n multiplications/divisions and n 1
addition/subtractions. The computations can be summarized as
Outer Loop
k
1
2
.
.
.
k
.
.
.
n1
Inner Loop
i
2, n
3, n
.
.
.
k + 1, n
.
.
.
n, n
Addition/Subtraction
flops
(n 1)(n 1)
(n 2)(n 2)
Multiplication/Division
flops
(n 1)n
(n 2)(n 1)
(n k)(n k)
(n k)(n + 1 k)
(1)(1)
(1)(2)
n 1
k 1
k 1
(n k )(n k ) n2 2nk k 2
Applying some of the relationships from Eq. (8.14) yields
n 1
n3 n 2 n
2
2
n
nk
k
3 2 6
k 1
(n k )(n 1 k )
k 1
n3 n
3 3
3
1
n
n3 O(n 2 ) n3 O(n) n3 O(n 2 ) O(n 2 )
3
3
For forward substitution, the numbers of multiplications and subtractions are the same and equal to
n 1
i
i 1
(n 1)n n 2 n
2
2 2
Back substitution is the same as for Gauss elimination: n2/2 n/2 subtractions and n2/2 + n/2
multiplications/divisions. The entire number of flops can be summarized as
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
2
Mult/Div
Add/Subtr
Total
n3 n
3 3
n3 n 2 n
3 2 6
2n 3 n 2 n
3
2 6
n2 n
2 2
n2 n
2 2
n2 n
2 2
n2 n
2 2
n 3 n 2 5n
3
2
6
n2 n
Forward elimination
Forward substitution
Back substitution
Total
n3
n
n2
3
3
n2
2n3 3n 2 7n
3
2
6
The total number of flops is identical to that obtained with standard Gauss elimination.
10.2 Equation (10.6) is
[ L][U ]{x} {d } [ A]{x} {b}
(10.6)
(10.7)
(10.8)
10.3 (a) The coefficient a21 is eliminated by multiplying row 1 by f21 = 2/7 and subtracting the result from
row 2. a31 is eliminated by multiplying row 1 by f31 = 1/7 and subtracting the result from row 3. The factors
f21 and f31 can be stored in a21 and a31.
7
2
3
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
3
1
0
0
[ L] 0.285714
1
0
0.142857 0.29032 1
2
3
7
[U ] 0 4.428571 2.14286
0
6.19355
0
These two matrices can be multiplied to yield the original system. For example, using MATLAB to
perform the multiplication gives
>> L=[1 0 0;0.285714 1 0;0.142857 -0.29032 1];
>> U=[7 2 -3;0 4.428571 -2.14286;0 0 -6.19355];
>> L*U
ans =
7.0000
2.0000
-3.0000
2.0000
5.0000
-3.0000
1.0000
-1.0000
-6.0000
1
0 d 2 20
0.285714
0.142857 0.29032 1 d3 26
1
0 d 2 18
0.285714
0.142857 0.29032 1 d3 6
x3
3.48387
0.5625
6.19355
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
4
14.57143 ( 2.14286)(0.5625)
3.5625
4.428571
12 (3)(0.5625) 2(3.5625)
x1
0.9375
7
x2
38
{b} 34
20
1 0 0
[ P] 0 1 0
0 0 1
Partial pivot:
8 1 2
[ A] 3 1 7
2 6 1
0 0 1
[ P ] 0 1 0
1 0 0
Compute factors:
f21 = 3/(8) = 0.375
Pivot again
1
2
8
[ LU ] 0.25 5.75 1.5
0.375 1.375 7.75
0 0 1
[ P ] 1 0 0
0 1 0
Compute factors:
f32 = 1.375/(5.75) = 0.23913
Forward eliminate and store factor in zero:
1
2
8
1.5
[ LU ] 0.25 5.75
0.375 0.23913 7.108696
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
5
0
0 8
1
2
1
1.5
[ L]{U ] 0.25
1
0 0 5.75
0
7.108696
0.375 0.23913 1 0
Forward substitution. First multiply right-hand side vector {b} by [P] to give
0 0 1 38 40
[ P ]{b} 1 0 0 34 38
0 1 0 40 34
Therefore,
0
0
1
40
0.25
1
0 {d } 38
34
0.375 0.23913 1
d1 40
d 2 38 (0.25)(40) 48
d3 34 0.375( 40) 0.23913( 48) 7.52174
Back substitution:
1
2 x1 40
8
0 5.75
1.5 x2 48
0
0
7.108696 x3 7.52174
7.52174
1.0581
7.108696
48 (1.5)(1.0581)
x2
8.623853
5.75
40 1(8.623853) (2)(1.0581)
x1
6.342508
8
x3
6
for i = k+1:n
L(i,k) = U(i,k)/U(k,k);
U(i,k) = 0;
U(i,k+1:n) = U(i,k+1:n)-L(i,k)*U(k,k+1:n);
end
end
2.0000
5.0000
-1.0000
-3.0000
-3.0000
-6.0000
0
0
1.0000
-3.0000
-2.1429
-6.1935
10.7 The result of Example 10.5 can be substituted into Eq. (10.14) to give
2.44949
2.44949 6.123724 22.45366
[ A] [U ]T [U ] 6.123724 4.1833
4.1833
20.9165
7
a32 6.123724 22.45366 4.1833 20.9165 225
a33 22.453662 20.91652 6.1101012 979.0002
10.8 (a) For the first row (i = 1), Eq. (10.15) is employed to compute
u11 a11 8 2.828427
a12
20
7.071068
u11 2.828427
u13
a13
16
5.656854
u11 2.828427
1.825742
u22
5.477226
4.966555
The validity of this decomposition can be verified by substituting it and its transpose into Eq. (10.14) to see
if their product yields the original matrix [A].
>> U = [2.828427 7.071068 5.656854; 0 5.477226 1.825742; 0 0 4.966555];
>> U*U
ans =
8.0000
20.0000
16.0000
20.0000
80.0000
50.0000
16.0000
50.0000
60.0000
(b)
>> A = [8 20 16;20 80 50;16 50 60];
>> U = chol(A)
U =
2.8284
7.0711
5.6569
0
5.4772
1.8257
0
0
4.9666
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
8
>> b = [100;250;100];
>> d=U'\b
d =
35.3553
0.0000
-20.1347
>> x=U\d
x =
17.2297
1.3514
-4.0541
7.0711
5.4772
0
5.6569
1.8257
4.9666
7.0711
5.4772
0
5.6569
1.8257
4.9666
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
9
3 2 1
[ A] 2 6 4
8 2 5
10
{b} 44
26
1 0 0
[ P] 0 1 0
0 0 1
Partial pivot:
8 2 5
[ A] 2 6 4
3 2 1
0 0 1
[ P ] 0 1 0
1 0 0
Compute factors:
f21 = 2/(8) = 0.25
Pivot again
2
5
8
0 0 1
[ P ] 1 0 0
0 1 0
Compute factors:
f32 = 5.5/(2.75) = 2
Forward eliminate and store factor in zero:
2
5
8
Forward substitution. First multiply right-hand side vector {b} by [P] to give
0 0 1 10 26
[ P ]{b} 1 0 0 44 10
0 1 0 26 44
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
10
Therefore,
0 0
1
26
0.375 1 0 {d } 10
44
0.25 2 1
d1 26
d 2 10 (0.375)(26) 19.75
d3 44 (0.25)(26) (2)(19.75) 2
Back substitution:
5 x1 26
2
8
0 2.75 2.875 x 19.75
2
0
0
3 x3 2
2
0.66667
3
19.75 2.875(0.66667)
x2
6.484848
2.75
26 5(0.666667) 2(6.484848)
x1
1.212121
8
x3
10.11 (a) Multiply first row by f21 = 3/8 = 0.375 and subtract the result from the second row to give
5
1
8
0 5.125 3.625
2
3
9
Multiply first row by f31 = 2/8 = 0.25 and subtract the result from the third row to give
5
1
8
0 5.125 3.625
0 1.75 8.75
Multiply second row by f32 = 1.75/5.125 = 0.341463 and subtract the result from the third row to give
5
1
8
[U ] 0 5.125
3.625
0
0
7.512195
As indicated, this is the U matrix. The L matrix is simply constructed from the fs as
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
11
0
0
1
[ L] 0.375
1
0
0.25 0.341463 1
0.25 0.341463 1 0
0
7.512195 2 3 9
(b) The determinant is equal to the product of the diagonal elements of [U]:
D 8 5.125 7.51295 308
10.12 (a) The determinant is equal to the product of the diagonal elements of [U]:
D 3 7.3333 3.6364 80
Back substitution:
>> x=U\d
x =
1.6000
6.1998
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.
12
-2.4004
-0.7071
1.2247
0
0
-0.8165
1.1547
-1.0000
2.0000
-1.0000
0
-1.0000
2.0000
Thus, the factorization of this diagonal matrix consists of another diagonal matrix where the elements are
the square root of the original. This is consistent with Eqs. (10.15) and (10.16), which for a diagonal matrix
reduce to
uii aii
uij 0 for i j
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual
may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their
individual course preparation. If you are a student using this Manual, you are using it without permission.