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.

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

By transferring the terms involving the <strong>of</strong>f-diagonal entries <strong>of</strong> A to the right hand side we obtain<br />

a1,1x1<br />

= b1<br />

a2,2x2 = b2 − a2,1x1<br />

a3,3x3 = b3 − a3,1x1 − a3,2x2<br />

Observe that the right hand sides can be divided naturally into rows and columns. Row—oriented<br />

forward substitution evaluates the right hand side one row at a time, while column–oriented forward<br />

substitution evaluates the right hand side one column at a time. Pseudocodes implementing rowand<br />

column–oriented forward substitution are presented in Fig. 3.4. Note that:<br />

• The “equations” in the algorithms are not intended to make mathematical sense. The symbol<br />

“:=” means assign the value <strong>of</strong> the right hand side to the variable on the left hand side.<br />

• The “for” loops step in ones. So, “for i = 1 to 3 means execute the loop for each value i = 1,<br />

i = 2 and i = 3, in turn. (Later, in Figures 3.6 and 3.9 we use “downto” when we want a loop<br />

to count backwards.) When a loop counting forward has the form “for j = 1 to i − 1” and<br />

for a given value <strong>of</strong> i we have i − 1 < 1 then the loop is considered to be empty and does not<br />

execute for any value <strong>of</strong> j. A similar convention applies for empty loops counting backwards.<br />

• The algorithm destroys the original entries <strong>of</strong> b. If these entries are needed for later calculations,<br />

then they must be saved elsewhere. In some implementations, the entries <strong>of</strong> x are written over<br />

the corresponding entries <strong>of</strong> b.<br />

The corresponding algorithm for a general lower triangular system <strong>of</strong> order n is given in Figure 3.5<br />

Problem 3.1.8. Why is a diagonal linear system also a lower triangular linear system?<br />

Problem 3.1.9. Consider a general lower triangular linear system <strong>of</strong> equations <strong>of</strong> order n. What<br />

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

each <strong>of</strong> the forward substitution pseudocodes?<br />

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

solve the lower triangular linear system in Fig. 3.1(b). 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.11. Use the row–oriented version <strong>of</strong> forward substitution to solve the following linear<br />

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

3x1 + 0x2 + 0x3 + 0x4 = 6<br />

2x1 + (−3)x2 + 0x3 + 0x4 = 7<br />

1x1 + 0x2 + 5x3 + 0x4 = −8<br />

0x1 + 2x2 + 4x3 + (−3)x4 = −3<br />

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

forward substitution.<br />

Problem 3.1.13. Modify the row– and the column–oriented pseudocodes in Fig. 3.5 for forward<br />

substitution so that the solution x is written over the right hand side b.<br />

Row-Oriented Column-Oriented<br />

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

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

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

for i = j + 1 to n<br />

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

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

next i<br />

next i next j<br />

Figure 3.5: Pseudocode Row- and Column-Oriented Forward Substitution, general n.

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

Saved successfully!

Ooh no, something went wrong!