Tutorials › Linear Algebra › Small Residuals With Large Solution Errors

LU Factorization and Numerical Considerations · Tutorial 926 of 1000

Small Residuals With Large Solution Errors

Learn to distinguish residual size from solution accuracy and use a condition number to understand when a small residual can conceal a large error.

Intermediate 9 min read

What You'll Learn

  • Define residuals, absolute forward error and relative forward error for a linear system.
  • Derive the exact relationship between the residual and the solution error.
  • Use an induced matrix norm to bound relative forward error by condition number times relative residual.
  • Compute a nearly singular system where a tiny relative residual accompanies a large relative solution error.
  • Contrast ill-conditioned and well-conditioned examples, and correct a common residual-based misjudgment.

Why a Small Residual Can Be Misleading

When an approximate solution nearly satisfies a linear system, its residual is small. That is useful information about how closely the approximate vector satisfies the equations, but it is not automatically a measure of how close that vector is to the true solution. The distinction matters most when the coefficient matrix is ill-conditioned: a small change in the equations can then produce a large change in the solution.

We work over \(\mathbb{R}\) with a finite-dimensional system \(\mathbf{A}\mathbf{x}=\mathbf{b}\), where \(\mathbf{A}\in\mathbb{R}^{n\times n}\) is invertible. Thus the system has a unique solution \(\mathbf{x}\). For measuring size, use the vector infinity norm \(\|\mathbf{v}\|_{\infty}=\max_i |v_i|\) and its induced matrix norm \(\|\mathbf{A}\|_{\infty}=\max_i\sum_j|a_{ij}|\). This matrix norm satisfies \(\|\mathbf{A}\mathbf{v}\|_{\infty}\leq\|\mathbf{A}\|_{\infty}\|\mathbf{v}\|_{\infty}\).

Definition: For an approximate solution \(\widehat{\mathbf{x}}\), its residual is \(\mathbf{r}=\mathbf{b}-\mathbf{A}\widehat{\mathbf{x}}\). Its forward error is \(\mathbf{x}-\widehat{\mathbf{x}}\); the absolute forward error is \(\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}\), and, when \(\mathbf{x}\ne\mathbf{0}\), the relative forward error is \(\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}/\|\mathbf{x}\|_{\infty}\). When \(\mathbf{b}\ne\mathbf{0}\), the relative residual is \(\|\mathbf{r}\|_{\infty}/\|\mathbf{b}\|_{\infty}\). The condition number in this norm is \(\kappa_{\infty}(\mathbf{A})=\|\mathbf{A}\|_{\infty}\|\mathbf{A}^{-1}\|_{\infty}\).

These quantities answer different questions. The residual asks how well \(\widehat{\mathbf{x}}\) satisfies the given equations. The forward error asks how far \(\widehat{\mathbf{x}}\) is from the exact solution. The condition number describes how strongly the matrix can amplify changes. A small residual is evidence of accuracy only when the matrix’s amplification is also taken into account.

The Exact Link Between Residual and Error

Theorem: If \(\mathbf{A}\) is invertible, \(\mathbf{x}\) solves \(\mathbf{A}\mathbf{x}=\mathbf{b}\), and \(\mathbf{r}=\mathbf{b}-\mathbf{A}\widehat{\mathbf{x}}\), then \(\mathbf{x}-\widehat{\mathbf{x}}=\mathbf{A}^{-1}\mathbf{r}\).

Proof. By the definitions of the exact solution and residual, \(\mathbf{A}\mathbf{x}=\mathbf{b}\) and \(\mathbf{A}\widehat{\mathbf{x}}=\mathbf{b}-\mathbf{r}\). Subtract the second equation from the first to obtain \(\mathbf{A}(\mathbf{x}-\widehat{\mathbf{x}})=\mathbf{r}\). Since \(\mathbf{A}\) is invertible, multiply by \(\mathbf{A}^{-1}\) to get \(\mathbf{x}-\widehat{\mathbf{x}}=\mathbf{A}^{-1}\mathbf{r}\). \(\square\)

The identity says exactly how a residual becomes a solution error: the matrix \(\mathbf{A}^{-1}\) acts on the residual. A small residual in a direction that \(\mathbf{A}^{-1}\) amplifies strongly can therefore produce a much larger error. This is why comparing the size of the residual directly with the size of the error is not enough.

Theorem (Relative error bound): Suppose \(\mathbf{A}\in\mathbb{R}^{n\times n}\) is invertible, \(\mathbf{x}\ne\mathbf{0}\), and \(\mathbf{b}=\mathbf{A}\mathbf{x}\). For any approximate solution \(\widehat{\mathbf{x}}\), with residual \(\mathbf{r}=\mathbf{b}-\mathbf{A}\widehat{\mathbf{x}}\), \[ \frac{\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}}{\|\mathbf{x}\|_{\infty}} \leq \kappa_{\infty}(\mathbf{A})\, \frac{\|\mathbf{r}\|_{\infty}}{\|\mathbf{b}\|_{\infty}}. \]

Proof. Since \(\mathbf{A}\) is invertible and \(\mathbf{x}\ne\mathbf{0}\), \(\mathbf{b}=\mathbf{A}\mathbf{x}\ne\mathbf{0}\), so both relative quantities are defined. The identity just proved and the induced norm inequality give \(\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}=\|\mathbf{A}^{-1}\mathbf{r}\|_{\infty}\leq\|\mathbf{A}^{-1}\|_{\infty}\|\mathbf{r}\|_{\infty}\). Also, \(\|\mathbf{b}\|_{\infty}=\|\mathbf{A}\mathbf{x}\|_{\infty}\leq\|\mathbf{A}\|_{\infty}\|\mathbf{x}\|_{\infty}\), so \(\|\mathbf{x}\|_{\infty}\geq\|\mathbf{b}\|_{\infty}/\|\mathbf{A}\|_{\infty}\). Dividing the first inequality by \(\|\mathbf{x}\|_{\infty}\) and using this lower bound yields \[ \frac{\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}}{\|\mathbf{x}\|_{\infty}} \leq \|\mathbf{A}^{-1}\|_{\infty}\|\mathbf{A}\|_{\infty} \frac{\|\mathbf{r}\|_{\infty}}{\|\mathbf{b}\|_{\infty}} = \kappa_{\infty}(\mathbf{A}) \frac{\|\mathbf{r}\|_{\infty}}{\|\mathbf{b}\|_{\infty}}. \] \(\square\)

This is an upper bound, not a promise that the error equals the bound or that every small residual causes a large error. It does show why the product of the condition number and relative residual matters. If the condition number is large, the bound may allow a substantial forward error even when the relative residual is tiny.

A Tiny Residual and a Large Forward Error

Worked Example: A Nearly Dependent Two-Equation System

Take \(\delta=1/1{,}000{,}000\) and consider the system with exact solution \(\mathbf{x}=(1,1)^{\top}\):

$$ \mathbf{A}= \begin{bmatrix} 1&1\\ 1&1+\delta \end{bmatrix}, \qquad \mathbf{b}= \begin{bmatrix} 2\\ 2+\delta \end{bmatrix}. $$

Indeed, multiplying gives \(\mathbf{A}\mathbf{x}=(2,2+\delta)^{\top}=\mathbf{b}\). Now use \(\widehat{\mathbf{x}}=(0,2)^{\top}\) as an approximation. Multiplication gives

$$ \mathbf{A}\widehat{\mathbf{x}}= \begin{bmatrix} 2\\ 2+2\delta \end{bmatrix}, \qquad \mathbf{r}=\mathbf{b}-\mathbf{A}\widehat{\mathbf{x}}= \begin{bmatrix} 0\\ -\delta \end{bmatrix}. $$

Thus \(\|\mathbf{r}\|_{\infty}=\delta=1/1{,}000{,}000\), while \(\|\mathbf{b}\|_{\infty}=2+\delta\). The relative residual is \(\delta/(2+\delta)\), which is less than \(1/2{,}000{,}000\). But the forward error is

$$ \mathbf{x}-\widehat{\mathbf{x}}= \begin{bmatrix}1\\-1\end{bmatrix}, \qquad \frac{\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}}{\|\mathbf{x}\|_{\infty}} =\frac{1}{1}=1. $$

The relative forward error is \(1\), even though the relative residual is less than \(1/2{,}000{,}000\). The exact residual-error identity verifies how this happens: \(\det\mathbf{A}=\delta\), and direct multiplication shows \(\mathbf{A}^{-1}=\frac{1}{\delta}\begin{bmatrix}1+\delta&-1\\-1&1\end{bmatrix}\). Therefore \(\mathbf{A}^{-1}\mathbf{r}=(1,-1)^{\top}=\mathbf{x}-\widehat{\mathbf{x}}\).

We can also calculate the condition number. The maximum absolute row sum of \(\mathbf{A}\) is \(2+\delta\). The row sums of absolute values of \(\mathbf{A}^{-1}\) are \((2+\delta)/\delta\) and \(2/\delta\), so \(\|\mathbf{A}^{-1}\|_{\infty}=(2+\delta)/\delta\). Consequently \(\kappa_{\infty}(\mathbf{A})=(2+\delta)^2/\delta\). The relative-error bound has right-hand side \((2+\delta)^2/\delta\cdot\delta/(2+\delta)=2+\delta\). It permits an error as large as \(2+\delta\), so it does not rule out the actual relative error of \(1\).

How Ill-Conditioning Makes the Example Possible

The two rows of the matrix in the example are nearly identical. If they were identical, the matrix would not be invertible; with a small positive \(\delta\), the system is invertible but very sensitive. The inverse contains the factor \(1/\delta\), which makes some small residuals produce much larger solution errors.

Worked Example: The Same Effect for a Family of Systems

Let \(0<\delta<1\), let \(\mathbf{A}_{\delta}=\begin{bmatrix}1&1\\1&1+\delta\end{bmatrix}\), and take \(\mathbf{x}=(2,-1)^{\top}\). The right-hand side is found by multiplication:

$$ \mathbf{b}=\mathbf{A}_{\delta}\mathbf{x} = \begin{bmatrix} 2-1\\ 2-(1+\delta) \end{bmatrix} = \begin{bmatrix} 1\\ 1-\delta \end{bmatrix}. $$

Choose \(\widehat{\mathbf{x}}=(1,0)^{\top}\). Then \(\mathbf{A}_{\delta}\widehat{\mathbf{x}}=(1,1)^{\top}\), so \(\mathbf{r}=(0,-\delta)^{\top}\) and \(\|\mathbf{r}\|_{\infty}/\|\mathbf{b}\|_{\infty}=\delta\). The error is \(\mathbf{x}-\widehat{\mathbf{x}}=(1,-1)^{\top}\), giving relative forward error \(1/2\), since \(\|\mathbf{x}\|_{\infty}=2\). Thus, as \(\delta\) gets smaller, the relative residual can be made arbitrarily small while the relative forward error stays \(1/2\).

For every \(\delta>0\), the determinant is \(\delta\), so the matrix is invertible. Its inverse is \(\frac{1}{\delta}\begin{bmatrix}1+\delta&-1\\-1&1\end{bmatrix}\); multiplying this by \((0,-\delta)^{\top}\) gives \((1,-1)^{\top}\), exactly the forward error. The residual is small because it lies in a direction that the inverse amplifies.

The examples demonstrate a possibility, not a rule that every approximate solution to an ill-conditioned system is inaccurate. They show that residual size alone cannot certify accuracy. The condition number indicates how much relative error may be consistent with a given relative residual; the actual error also depends on the direction of the residual.

Comparison with a Well-Conditioned System

Worked Example: A Small Residual with a Comparably Small Error

Consider \(\mathbf{A}=\begin{bmatrix}1&0\\0&2\end{bmatrix}\), the exact solution \(\mathbf{x}=(1,1)^{\top}\), and \(\mathbf{b}=\mathbf{A}\mathbf{x}=(1,2)^{\top}\). Let \(\widehat{\mathbf{x}}=(1,1001/1000)^{\top}\). Then

$$ \mathbf{A}\widehat{\mathbf{x}}= \begin{bmatrix}1\\1001/500\end{bmatrix}, \qquad \mathbf{r}=\mathbf{b}-\mathbf{A}\widehat{\mathbf{x}} = \begin{bmatrix}0\\-1/500\end{bmatrix}. $$

Here \(\|\mathbf{b}\|_{\infty}=2\), so the relative residual is \((1/500)/2=1/1000\). The error is \(\mathbf{x}-\widehat{\mathbf{x}}=(0,-1/1000)^{\top}\), so the relative forward error is also \(1/1000\). The matrix norm is \(2\), and its inverse is \(\begin{bmatrix}1&0\\0&1/2\end{bmatrix}\), whose infinity norm is \(1\). Hence \(\kappa_{\infty}(\mathbf{A})=2\), and the bound gives \(1/1000\leq2/1000\), as required.

This example does not imply that the relative residual and forward error are always equal for a well-conditioned matrix. It illustrates that, here, a small relative residual accompanies a small relative error, while the ill-conditioned examples allow a much larger gap.

Common Mistake: Treating Residual Size as Error Size

A tempting but incorrect conclusion is: “The residual has norm \(1/1{,}000{,}000\), so the solution error is at most \(1/1{,}000{,}000\).” In the first example the actual absolute forward error is \(\|(1,-1)^{\top}\|_{\infty}=1\), not at most \(1/1{,}000{,}000\). The incorrect calculation has silently treated multiplication by \(\mathbf{A}^{-1}\) as if it could not increase the residual.

The correction is to use the exact identity and the norm bound: \(\|\mathbf{x}-\widehat{\mathbf{x}}\|_{\infty}=\|\mathbf{A}^{-1}\mathbf{r}\|_{\infty}\leq\|\mathbf{A}^{-1}\|_{\infty}\|\mathbf{r}\|_{\infty}\). For the first example, \(\|\mathbf{A}^{-1}\|_{\infty}=(2+\delta)/\delta=2{,}000{,}001\). The resulting upper bound is \(2{,}000{,}001/1{,}000{,}000=2+\delta\), which does not incorrectly claim that the error is tiny.

When interpreting a computed solution, keep the quantities separate:

  • A small absolute residual means the approximate vector nearly satisfies the equations in absolute terms.
  • A small relative residual measures that discrepancy against the size of the right-hand side.
  • A small forward error means the approximate vector is close to the true solution.
  • A condition number helps assess whether a small relative residual can still accompany a substantial relative forward error.

The condition-number bound is useful as a warning and an estimate, not as a complete description of a particular error. A large bound says that accuracy is not guaranteed by the residual alone; it does not say the actual error must be large. A small bound, on the other hand, does certify a small relative forward error when its hypotheses hold.

Check Your Understanding

Use the definitions and the residual-error identity to justify each answer.

  1. For an invertible matrix, write the exact relationship between the residual and the forward error.
  2. Why can a small relative residual fail to guarantee a small relative forward error when the condition number is large?
  3. For \(\mathbf{A}_{\delta}=\begin{bmatrix}1&1\\1&1+\delta\end{bmatrix}\), what feature of \(\mathbf{A}_{\delta}^{-1}\) explains the amplification in the examples?
  4. For the well-conditioned example, calculate the absolute residual norm and the absolute forward error norm.
  5. What extra factor must appear in a valid norm bound relating the residual to the absolute forward error?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon