Fundamentals / Numerical mathematics / Numerical linear algebra

Measurements and elimination

Use explicit perturbations, row exchanges and reusable factors to diagnose errors in small linear balances.

Two scales in a force measurement

A sensor system has \(A=\operatorname{diag}(2,0.02)\) and reports \(b=(2,0.02)^T\). Find the exact unknowns and \(\kappa_2(A)\). Compare two additive disturbances of magnitude 0.002, one entirely in the first measurement and one entirely in the second. Finally, explain which sensor needs the tighter absolute calibration.

Worked solution

Division by each diagonal entry gives

\[x=(1,1)^T.\]

The singular values are 2 and 0.02, so \(\kappa_2=100\). The first disturbance changes the solution by \((0.001,0)^T\), whereas the second gives \((0,0.1)^T\). The second direction therefore produces a hundred times more absolute force error for the same measurement error.

For equal admissible absolute errors in the two forces, the second measurement needs a hundred times smaller absolute uncertainty. Rescaling its output by a factor of 100 makes the two matrix rows comparable but also rescales its uncertainty by 100. It cannot turn the original sensor into a more precise one.

Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Compare a componentwise and a global test

Take \(A=\operatorname{diag}(1000,1)\), \(b=(1000,1)^T\) and \(\hat x=(1,0.98)^T\). Compute the infinity-norm relative residual and the componentwise relative residual in each equation. If the instrumentation specification allows 0.5% relative error separately in each reading, does the approximation meet it?

Worked solution

The predicted measurements are \((1000,0.98)^T\), giving residual \((0,0.02)^T\). The global infinity-norm ratio is

\[0.02/1000=2\times10^{-5}.\]

In the separate equations the ratios are zero and \(0.02/1=0.02\).

The second equation misses its 0.5% specification by a factor of four. Global normalisation uses the much larger first equation to set the denominator. One remedy is to divide each equation by its nonzero measurement uncertainty and judge the largest resulting scaled residual.

Explore the related calculation with adjustable inputs. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Pivot and reuse

Factor \(A=\left(\begin{smallmatrix}0&2\\3&1\end{smallmatrix}\right)\) with a row permutation. Solve for \(b=(4,5)^T\) and for \(c=(2,1)^T\) using that factorisation. Why does the zero leading entry indicate neither singularity nor lack of a unique solution?

Worked solution

Exchange rows with \(P=\left(\begin{smallmatrix}0&1\\1&0\end{smallmatrix}\right)\). The permuted matrix is already upper triangular, so \(L=I\) and \(U=\left(\begin{smallmatrix}3&1\\0&2\end{smallmatrix}\right)\). For \(Pb=(5,4)^T\), back substitution gives \(x_2=2\), \(x_1=1\). For \(Pc=(1,2)^T\), it gives \(x_2=1\), \(x_1=0\).

The determinant is \(-6\), so the matrix is nonsingular. A zero at one candidate pivot location merely prevents that ordering of elimination. Applying the row permutation to both the matrix and every new load preserves the original problem.

Try this calculation. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Reuse chain factors after a load change

A three-node chain has diagonal \((4,3,2)\), both off-diagonals equal to \(-1\), and load \((2,4,0)^T\). Compute its pivots and solution. Without refactoring, determine the extra response to a unit load on the last node. Explain which step fails for a nonsingular chain with first row \((0,1)\) and second row \((1,2)\).

Worked solution

The pivots are

\[4,\ 3-1/4=11/4,\ 2-4/11=18/11.\]

The reduced loads are

\[2,\ 4+2/4=9/2,\ (4/11)(9/2)=18/11.\]

Back substitution gives

\[x_3=1,\ x_2=(9/2+1)/(11/4)=2,\ x_1=(2+2)/4=1.\]

The incremental load transforms to \((0,0,1)\). Back substitution through the same factors gives increments \(11/18,\ 2/9,\ 1/18\) in reverse node order. They are positive throughout the connected chain. In the final matrix the first pivot is zero, although its determinant is −1. A row exchange can solve it. The unpivoted recurrence cannot divide by its first pivot.

Try this calculation. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Revisit chapter 2 · Eliminate a chain in two linear-time sweeps.

Predict a dot product in a tiny floating-point system

Use four significant binary bits, normalized numbers, round-to-nearest ties-to-even and a sufficiently wide exponent range. Form the dot product \((1,1,1)\cdot(8,0.5,0.5)\) by adding terms from left to right and then by adding the two smallest terms first. Compute the spacing just above 8. Would accumulating all terms exactly and rounding only the final answer change either result?

Worked solution

Above \(8=2^3\) the spacing is

\[2^{3+1-4}=1.\]

Both 8 and 9 are representable. The intermediate 8.5 is halfway between them and rounds to the even significand of \(8=(1.000)_2\,2^3\). Left-to-right accumulation therefore returns 8 after both additions.

The sum of the two half-units is exactly one. Grouping them gives 8+1 = 9, equal to the exact dot product. A single final rounding also gives 9. The products with one are exact here. All of the discrepancy enters through the intermediate additions. A componentwise explanation can identify the two lost half-units even when the input vector is perfectly well conditioned for this sum.

Try this calculation. Change the parameters in the corresponding calculation and compare its independently recomputed values with the equation derived in this solution.

Revisit chapter 1 · Determine which perturbations a machine can represent.

Notebook practice · How large can the last column grow?