Statistical Methods
Audit a linear-system result with its residual
Define the task
Write a linear system as A times x equals b and confirm the equation and variable order. Solving the system directly is usually the intended operation when only x is needed. Preserve the original matrix and right-hand side so the reported solution can be checked independently after export or rounding.
Carry out the check
Multiply A by the returned x and subtract b. Report the residual norm together with a scale for A, x and b. A small residual confirms that the returned vector nearly solves the supplied equations. Assess conditioning separately because a sensitive problem can produce a small residual with a substantial difference from the solution for slightly different inputs.
Worked hypothetical example
For a hypothetical system with rows (2,1) and (1,3), and right-hand side (5,5), the solution is (2,1). Both residual components are zero. If an exported table rounds or changes the solution to (2,0.9), the reconstructed right-hand side becomes (4.9,4.7), giving residuals −0.1 and −0.3. This check locates a reproducibility problem without establishing why the inputs or exported values changed.
Method checked 12 November 2026 against R documentation: Solve a System of Equations.