%The question we are asking here: Are "errors" in solving Ax=b % a matter of the method we are using, or is it a property of the % matrix itself? %Below is a matrix A, and a vector b. Also given, another % vector estb obtained by rounding off b. A=[93.477 10.202 -28.832;1.963 32.816 62.414; 26.821 36.816 57.234]; b=[34.7177; 70.9241; 82.9271]; estb=[34.7;70.9; 82.9];

```
%Method 1: Compute $A^{-1}b and compare to A^{-1}estb
x1=inv(A)*b
x2=inv(A)*estb
```

x1 = 0.5000 0.8000 0.7000 x2 = -1.6829 8.9228 -3.5025

```
%Relative errors:
db=norm(b-estb)/norm(b)
dx=norm(x1-x2)/norm(x1)
```

db = 3.5241e-04 dx = 8.0039

%Is the large change in x associated with errors in computing A^{-1}? %Matlab's backslash operator uses a different technique: xx1=A\b xx2=A\estb

xx1 = 0.5000 0.8000 0.7000 xx2 = -1.6829 8.9228 -3.5025

%But we get the same answer as before- The large change in x % is NOT due to numerical errors, but is a property of the matrix % itself. % % Is it because A could be "close to singular"? Check the determinant: det(A)

ans = -1.9170

%Nope- the determinant looks good. Now check the condition number: kappa=cond(A) %That is the problem. Using our rule of thumb, we should have expected to %lose 5 significant digits (and those were all the digits we had!)

kappa = 5.2164e+05