In some systems, problems occur even without rounding. Consider the following augmented matrices:
\begin{equation*}
\left(\begin{array}{cc|c}1 & 1/2 & 3/2 \\ 1/2 & 1/3 & 1 \\\end{array}\right) \quad \text{and}\quad \left(\begin{array}{cc|c}1 & 1/2 & 3/2 \\ 1/2 & 1/3 & 5/6\\\end{array}\right)\text{.}
\end{equation*}
Here we have the same \(A\text{,}\) but two different input vectors:
\begin{equation*}
\bb_{1} = (3/2,1)' \quad \textrm{and}\quad \bb_{2} = (3/2,5/6)'
\end{equation*}
which are pretty close to one another. You would expect then that the solutions \(\xb_{1}\) and \(\xb_{2}\) would also be close. Notice that this matrix does not need pivoting. Eliminating exactly we get
\begin{equation*}
\left(\begin{array}{cc|c}1 & 1/2 & 3/2 \\ 0 & 1/12 & 1/4 \\\end{array}\right) \quad \text{and}\quad \left(\begin{array}{cc|c}1 & 1/2 & 3/2 \\ 0 & 1/12 & 1/12\\\end{array}\right)\text{.}
\end{equation*}
Now solving we find
\begin{equation*}
\xb_{1} = (0,3)' \quad \textrm{and}\quad \xb_{2} = (1,1)'
\end{equation*}
which are not close at all despite the fact that we did the calculations exactly. This poses a new problem: some matrices are very sensitive to small changes in input data. The extent of this sensitivity is measured by the condition number. The definition of condition number is: consider all small changes \(\delta A\) and \(\delta \bb\) in \(A\) and \(\bb\) and the resulting change, \(\delta \xb\text{,}\) in the solution \(\xb\text{.}\) Then
\begin{equation*}
\textrm{cond}(A) \equiv \max \left( \frac{ \|\delta \xb\|/\|\xb\|}{ \frac{\|\delta A\|}{\|A\|} + \frac{\|\delta \bb\|}{\|\bb\|} }\right) = \max \left( \frac{\text{Relative error of output}}{\text{Relative error of inputs}}\right)\text{.}
\end{equation*}
Put another way, changes in the input data get multiplied by the condition number to produce changes in the outputs. Thus a high condition number is bad. It implies that small errors in the input can cause large errors in the output.It is not obvious from our definition above, but one can prove that the condition number of a matrix is at least 1.
In MATLAB enter
which should result in the matrix above. MATLAB produces the condition number of a matrix with the command
Thus for this matrix small errors in the input can get magnified by 19 in the output. Next try the matrix
>> A = [ 1.2969 0.8648 ; .2161 .1441]
>> cond(A)
For this matrix small errors in the input can get magnified by
\(2.5 \times 10^{8}\) in the output! (We will see this happen in the exercise.) This is obviously not very good for engineering where all measurements, constants and inputs are approximate.
Is there a solution to the problem of bad condition numbers? Usually, bad condition numbers in engineering contexts result from poor design. So, the engineering solution to bad conditioning is
redesign.
Finally, find the determinant of the matrix
\(A\) above:
which will be small. If
\(\det(A) = 0\) then the matrix is singular, which is bad because it implies there will not be a unique solution. The case here,
\(\det(A) \approx 0\text{,}\) is also bad, because it means the matrix is almost singular. Although
\(\det(A) \approx 0\) generally indicates that the condition number will be large, they are actually independent things. To see this, find the determinant and condition number of the matrix
[1e-10,0;0,1e-10] and the matrix
[1e+10,0;0,1e-10].