# Linear Algebra/Topic: Accuracy of Computations/Solutions

## Solutions

Problem 1

Using two decimal places, add ${\displaystyle 253}$  and ${\displaystyle 2/3}$ .

Sceintific notation is convienent to express the two-place restriction. We have ${\displaystyle .25\times 10^{2}+.67\times 10^{0}=.25\times 10^{2}}$ . The ${\displaystyle 2/3}$  has no apparent effect.

Problem 2

This intersect-the-lines problem contrasts with the example discussed above.

${\displaystyle \displaystyle {\begin{array}{*{2}{rc}r}x&+&2y&=&3\\3x&-&2y&=&1\end{array}}}$

Illustrate that in this system some small change in the numbers will produce only a small change in the solution by changing the constant in the bottom equation to ${\displaystyle 1.008}$  and solving. Compare it to the solution of the unchanged system.

The reduction

${\displaystyle {\xrightarrow[{}]{-3\rho _{1}+\rho _{2}}}{\begin{array}{*{2}{rc}r}x&+&2y&=&3\\&&-8&=&-7.992\end{array}}}$

gives a solution of ${\displaystyle (x,y)=(1.002,0.999)}$ .

Problem 3

Solve this system by hand (Rice 1993).

${\displaystyle {\begin{array}{*{2}{rc}r}0.000\,3x&+&1.556y&=&1.569\\0.345\,4x&-&2.346y&=&1.018\end{array}}}$
1. Solve it accurately, by hand.
2. Solve it by rounding at each step to four significant digits.
1. The fully accurate solution is that ${\displaystyle x=10}$  and ${\displaystyle y=0}$ .
2. The four-digit conclusion is quite different.
${\displaystyle {\xrightarrow[{}]{-(.3454/.0003)\rho _{1}+\rho _{2}}}\left({\begin{array}{*{2}{c}|c}.0003&1.556&1.569\\0&1789&-1805\end{array}}\right)\Longrightarrow x=10460,\,y=-1.009}$
Problem 4

Rounding inside the computer often has an effect on the result. Assume that your machine has eight significant digits.

1. Show that the machine will compute ${\displaystyle (2/3)+((2/3)-(1/3))}$  as unequal to ${\displaystyle ((2/3)+(2/3))-(1/3)}$ . Thus, computer arithmetic is not associative.
2. Compare the computer's version of ${\displaystyle (1/3)x+y=0}$  and ${\displaystyle (2/3)x+2y=0}$ . Is twice the first equation the same as the second?
1. For the first one, first, ${\displaystyle (2/3)-(1/3)}$  is ${\displaystyle .666\,666\,67-.333\,333\,33=.333\,333\,34}$  and so ${\displaystyle (2/3)+((2/3)-(1/3))=.666\,666\,67+.333\,333\,34=1.000\,000\,0}$ . For the other one, first ${\displaystyle ((2/3)+(2/3))=.666\,666\,67+.666\,666\,67=1.333\,333\,3}$  and so ${\displaystyle ((2/3)+(2/3))-(1/3)=1.333\,333\,3-.333\,333\,33=.999\,999\,97}$ .
2. The first equation is ${\displaystyle .333\,333\,33\cdot x+1.000\,000\,0\cdot y=0}$  while the second is ${\displaystyle .666\,666\,67\cdot x+2.000\,000\,0\cdot y=0}$ .
Problem 5

Ill-conditioning is not only dependent on the matrix of coefficients. This example (Hamming 1971) shows that it can arise from an interaction between the left and right sides of the system. Let ${\displaystyle \varepsilon }$  be a small real.

${\displaystyle {\begin{array}{*{3}{rc}r}3x&+&2y&+&z&=&6\\2x&+&2\varepsilon y&+&2\varepsilon z&=&2+4\varepsilon \\x&+&2\varepsilon y&-&\varepsilon z&=&1+\varepsilon \end{array}}}$
1. Solve the system by hand. Notice that the ${\displaystyle \varepsilon }$ 's divide out only because there is an exact cancelation of the integer parts on the right side as well as on the left.
2. Solve the system by hand, rounding to two decimal places, and with ${\displaystyle \varepsilon =0.001}$ .
${\displaystyle {\begin{array}{rcl}&{\xrightarrow[{-(1/3)\rho _{1}+\rho _{3}}]{-(2/3)\rho _{1}+\rho _{2}}}\;&\left({\begin{array}{*{3}{c}|c}3&2&1&6\\0&-(4/3)+2\varepsilon &-(2/3)+2\varepsilon &-2+4\varepsilon \\0&-(2/3)+2\varepsilon &-(1/3)-\varepsilon &-1+\varepsilon \end{array}}\right)\\&{\xrightarrow[{}]{-(1/2)\rho _{2}+\rho _{3}}}\;&\left({\begin{array}{*{3}{c}|c}3&2&1&6\\0&-(4/3)+2\varepsilon &-(2/3)+2\varepsilon &-2+4\varepsilon \\0&\varepsilon &-2\varepsilon &-\varepsilon \end{array}}\right)\end{array}}}$
gives a third equation of ${\displaystyle y-2z=-1}$ . Substituting into the second equation gives ${\displaystyle ((-10/3)+6\varepsilon )\cdot z=(-10/3)+6\varepsilon }$  so ${\displaystyle z=1}$  and thus ${\displaystyle y=1}$ . With those, the first equation says that ${\displaystyle x=1}$ .
${\displaystyle \left({\begin{array}{*{3}{c}|c}.30\times 10^{1}&.20\times 10^{1}&.10\times 10^{1}&.60\times 10^{1}\\.10\times 10^{1}&.20\times 10^{-3}&.20\times 10^{-3}&.20\times 10^{1}\\.30\times 10^{1}&.20\times 10^{-3}&-.10\times 10^{-3}&.10\times 10^{1}\end{array}}\right)}$
{\displaystyle {\begin{aligned}&{\xrightarrow[{-(1/3)\rho _{1}+\rho _{3}}]{-(2/3)\rho _{1}+\rho _{2}}}\;\left({\begin{array}{*{3}{c}|c}.30\times 10^{1}&.20\times 10^{1}&.10\times 10^{1}&.60\times 10^{1}\\0&-.13\times 10^{1}&-.67\times 10^{0}&-.20\times 10^{1}\\0&-.67\times 10^{0}&-.33\times 10^{0}&-.10\times 10^{1}\end{array}}\right)\\&{\xrightarrow[{}]{-(.67/1.3)\rho _{2}+\rho _{3}}}\;\left({\begin{array}{*{3}{c}|c}.30\times 10^{1}&.20\times 10^{1}&.10\times 10^{1}&.60\times 10^{1}\\0&-.13\times 10^{1}&-.67\times 10^{0}&-.20\times 10^{1}\\0&0&.15\times 10^{-2}&.31\times 10^{-2}\end{array}}\right)\end{aligned}}}
comes out to be ${\displaystyle z=2.1}$ , ${\displaystyle y=2.6}$ , and ${\displaystyle x=-.43}$ .