Professional Documents
Culture Documents
Axi = i xi ,
i and n -
i = 1,2,, n .
says,
xi =
det ( A i )
,
det ( A )
i = 1, 2, , n ,
where A i is the matrix formed by replacing the i the column of A by the column vector
b.
Solving the least squares problem by normal equations: If the m n matrix A has
full rank, and m n , the the least squares problem has a unique solution and this
solution is theoretically given by the solution of the linear system
AT Ax = AT b .
This is called the normal equation. This procedure has severe numerical limitations. First,
in finite arithmetic, in the formation of AT A , some vital information might be lost.
Second, the normal equation is more sensitive to perturbations compared to the linear
system Ax = b , and this sensitivity may corrupt the solution.
Example 2.1:
The following are five-digit decimal (base 10) floating-point numbers
0.53216 104
0.81724 1021
0.00112 108
0.11200 106
Note that the numbers 0.00112 108 and 0.11200 106 are equal. Thus the floating-point
representation of a number need not be unique. Floating-point numbers that are written with no
leading zeros are said to be normalized.
Example 2.2 (MATLAB examples):
i) Investigating the size of t
ii) Investigating the range for k
Most real numbers have to be rounded off in order to be representation as t -digit floating-point
numbers. The difference between the floating-point number x and the original number is called
the roundoff error.
When we do further operation on the number (add, substract, multiply etc.), more roundoff error
will occur.
Because of these reasons, we cannot expect to get exact solution to the original problem.
For example, suppose we want to solve
Ax = b .
When entries of A and b are read into the computer, roundoff errors will generally occur.
Thus, the program will actually be attempting to compute the solution to
b (perturbed problem)
( A + E) x =
Definition 2.2: Let x ' denote an approximation to x , then there are two ways in measuring error:
Absolute Error= x ' x ,
Relative Error =
x ' x
x
x0.
The relative error makes more sense than the absolute error. The following example explains this.
Example 2.3:
=
x1 1.31,
=
x '1 1.30 ,
=
x2 0.12,
=
x '2 0.11 .
The absolute errors in both cases are the same: x '1 x1 = x '2 x2 = 0.01 .
On the other hand, relative errors are,
x '1 x1 0.01
= = 0.0076335 ,
x1
1.31
x '2 x2 0.01
= = 0.0833333 .
x2
0.12
Thus, the relative error shows that x '1 is closer to x1 than x '2 to x2 , whereas the absolute error
gives no indication of this at all. This example is able to tell us that, although the errors affecting
x1 and x2 are of the same size, but the effects on x2 is more profound.
Example 2.4:
Consider the following matrices,
1 2
1 1
=
A =
, B
.
3 4
0.9 1
Suppose the entry in the ( 2,1) position of both matrices is affected by an error of 0.1. Thus the
approximation of the matrices are
1 2
1 1
=
A ' =
, B'
.
3.1 4
1 1
Check the determinants of the matrices and their corresponding approximations to discover the
affects of the error on the properties of the matrices.
62,133
0.12658
47.213
Four-digit decimal
floating-point
number x '
0.6213 105
0.1266 100
0.4721102
0.3142 101
Absolute error,
x ' x
Relative error,
x ' x x
4.8 105
1.6 104
6.4 105
1.3 104
2 105
3.0 103
3.142 4 104
=
a + b 0.263466 104 .
However, the floating-point representation of this sum is 0.263 104 . This then should be
the computed sum. We will denote the floating-point sum by fl ( a + b ) .
The absolute error in the sum is
fl ( a + b ) ( a + b ) =
4.66 ,
0.18 102 .
Example 2.6:
Floating point operation for addition of matrices,
fl ( a '12 + b '12 )
.
fl ( a '22 + b '22 )
EXERCISES:
1. Find the three-digit decimal floating-point representation of each of the following
numbers.
a) 2312
b) 32.56
c) 0.01277
d)82.431
2. Find the absolute error and the relative error when each of the real numbers in
Exercise 1 is approximated by a three-digit decimal floating-point number.
3. Do each of the following using four-digit decimal floating-point arithmetic and
calculate the absolute and relative errors in your answers.
a) 10, 420 + 0.0018
c) 0.12347 0.12342
4. Let x1 = 94, 210 , x2 = 8631 , x3 = 1440 , x4 = 133 and x5 = 34 . Calculate each of the
following using four-digit decimal floating-point arithmetic.
a)
((( x + x ) + x ) + x ) + x
1
b) x1 + ( ( x2 + x3 ) + ( x4 + x5 ) )
c)
((( x
+ x4 ) + x3 ) + x2 + x1 .