24.03.2013 Views

Chapter 3 Solution of Linear Systems - Math/CS

Chapter 3 Solution of Linear Systems - Math/CS

Chapter 3 Solution of Linear Systems - Math/CS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

52 CHAPTER 3. SOLUTION OF LINEAR SYSTEMS<br />

Row-Oriented Column-Oriented<br />

for i = 3 downto 1 do for j = 3 downto 1 do<br />

for j = i + 1 to 3 xj := bj/aj,j<br />

bi := bi − ai,jxj<br />

for i = 1 to j − 1<br />

next j bi := bi − ai,jxj<br />

xi := bi/ai,i<br />

next i<br />

next i next j<br />

Figure 3.6: Pseudocode Row- and Column-Oriented Backward Substitution<br />

Observe that the right hand sides <strong>of</strong> these equations can again be divided naturally into rows and<br />

columns. Row–oriented backward substitution evaluates the right hand side one row at a time,<br />

while column–oriented backward substitution evaluates the right hand side one column at a time.<br />

Pseudocodes implementing row– and column–oriented backward substitution for systems <strong>of</strong> size<br />

n = 3 are presented in Fig. 3.6.<br />

Problem 3.1.19. Why is a diagonal linear system also an upper triangular linear system?<br />

Problem 3.1.20. Modify the row– and column–oriented pseudocodes in Fig. 3.6 for backward substitution<br />

so they apply to upper triangular linear systems <strong>of</strong> order n for any n.<br />

Problem 3.1.21. Consider a general upper triangular linear system <strong>of</strong> order n. What are the<br />

conditions on the entries <strong>of</strong> the coefficient matrix so that its solution can be determined by each <strong>of</strong><br />

the backward substitution pseudocodes?<br />

Problem 3.1.22. Illustrate the operation <strong>of</strong> column–oriented backward substitution when used to<br />

solve the upper triangular linear system in Fig. 3.1(c). Hint: Show the value <strong>of</strong> b each time it has<br />

been modified by the for-loop and the value <strong>of</strong> each entry <strong>of</strong> x as it is computed.<br />

Problem 3.1.23. Use the row–oriented version <strong>of</strong> backward substitution to solve the following linear<br />

system <strong>of</strong> order 4.<br />

2x1 + 2x2 + 3x3 + 4x4 = 20<br />

0x1 + 5x2 + 6x3 + 7x4 = 34<br />

0x1 + 0x2 + 8x3 + 9x4 = 25<br />

0x1 + 0x2 + 0x3 + 10x4 = 10<br />

Problem 3.1.24. Repeat the previous problem but this time using the column–oriented version <strong>of</strong><br />

backward substitution.<br />

Problem 3.1.25. Modify the row– and column–oriented pseudocodes for backward substitution so<br />

that the solution x is written over b.<br />

Problem 3.1.26. Consider a general upper triangular linear system <strong>of</strong> order n. Show that row–<br />

n(n − 1)<br />

n(n − 1)<br />

oriented backward substitution costs multiplications, subtractions, and n divi-<br />

2<br />

2<br />

sions. Hint: Draw a picture <strong>of</strong> A and place on the entry ai,j the symbol ⊗ every time that entry is<br />

involved in a multiply, the symbol ⊖ every time that entry is involved in a subtract, and the symbol<br />

⊘ every time that entry is involved in a divide. How many symbols are attached to each entry <strong>of</strong> A?<br />

Hint: A more general approach observes that there are (n − i) multiplies and subtracts in the inner<br />

loop and that this loop is executed for each value <strong>of</strong> i = n, (n − 1), · · · , 1. So, the total cost is<br />

multiplies and subtracts.<br />

0 + 1 + · · · + (n − 1) =<br />

n<br />

n−1 n−1 <br />

(i − 1) = i = i<br />

i=1<br />

i=0<br />

i=1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!