# Solving Linear Equation with Floating point Arithmetic

Given the matrix A = $\begin{pmatrix} 0.005 & 1 \\ 1 & 1 \\ \end{pmatrix}$ and the vector b = $\begin{pmatrix} 0.5 \\1 \end{pmatrix}$ we have to solve for x in Ax = b in three different ways:

1. Gaussian Elimination
2. Without "pivotisation", i.e. withouth interchanging rows and columns and in the floating point arithmetic $\mathbb F(10,3,-10,10)$
3. With "pivotisation" in $\mathbb F(10,3,-10,10)$

$\mathbb F(\beta,t,e_{min},e_{max})$ is defined as follows: $\beta \in \mathbb N, b \geq 2$ is the basis, $t \in \mathbb N$ is the length of the mantissa and $e_{min}$ and $e_{max}$ with $e_{min} < 0 < e_{max}$ are the bounds of the exponent. Then $\mathbb F$ is defined as follows:

$\mathbb F := \{ \pm \beta^{e}(\frac{d_1}{\beta} + ...+ \frac{d_t}{\beta^t}); d_1,...,d_t \in \{0,...,\beta-1\}, d_1 \neq 0, e \in \mathbb Z, e_{min} \leq e \leq e_{max}$ } or {0}

My solutions:

1. With gaussian elimination I simply get x_1 = 100/199 and x_2 = 99/199.

2. and 3. I don't really understand, since even for Gaussian elimination it is not really necessary to interchange any rows and coluns. Regarding the floting point arithmetic then, I wonder if the solutions would be simply x_1 = 0.503 and x_2 = 0.497?

-

By Gaussian Elimination without any precision limitation, I would see $$\begin {pmatrix} 0.005&1&0.5\\1&1&1 \end {pmatrix}\to \begin {pmatrix} 0.005&1&0.5\\0&-199&-99 \end {pmatrix}\to \begin {pmatrix} 1&200&100\\0&1&\frac{99}{199} \end {pmatrix} \to\begin {pmatrix} 1&0&100-200\cdot \frac {99}{199}\\0&1&\frac{99}{199} \end {pmatrix}=\begin {pmatrix} 1&0&\frac {100}{199}\\0&1&\frac{99}{199} \end {pmatrix}$$
agreeing with your answer. With the restricted precision, we cannot represent $\frac {99}{199}$ and will round it to $0.497$. Then the first coordinate of the solution becomes $100-99.4=0.6$. If you interchange the rows, I believe the cancellation will be much smaller because the $0.005$ is no longer on the diagonal and the answer will be much closer to the truth.
@GuestGuest: Yes, it will round as I now show (though it is close to rounding to $0.498$) The subtraction still perturbs the solution substantially. –  Ross Millikan Mar 4 '13 at 19:04