What the condition number measures

Claude prompt

This page was generated by Claude Code from the following prompt (with additional prompting):

I want to add a demo about condition number. let's use a 2x2 matrix so that we can illustrate the solution graphically with the intersection of two lines on a plot. Have one slider (maybe log-scaled) that adjusts elements of the matrix so that it gradually gets close to singular. cond(<the matrix>) = <the condition number>, then show an x_1, x_2 plot where the solution is the intersection of the two lines given by Ax = b. Choose b based on the matrix to keep the solution within the plot area.

Definition: the condition number of an invertible matrix is \(\text{cond}(A) = \|A\| \, \|A^{-1}\|\). It bounds how much a relative error in \(A\) can be amplified in the solution: \[ \frac{\|\Delta x\|}{\|x\|} \;\le\; \text{cond}(A)\,\frac{\|\Delta A\|}{\|A\|} \]

Consider the matrix \[ A = \begin{bmatrix} 1 & 1 \\ 1 & 1 + \varepsilon \end{bmatrix}, \qquad b = \begin{bmatrix} 2 \\ 2 + \varepsilon \end{bmatrix}, \] where \(b\) is chosen so that the solution of \(Ax = b\) is always \(x = (1, 1)\), whatever the value of \(\varepsilon\). As \(\varepsilon \to 0\) the second row becomes a copy of the first and \(A\) becomes singular.

x1
x2
=

Now perturb the bottom-right entry of \(A\) by a small amount \(\Delta\), keeping \(b\) the same: \[ A + \Delta A = \begin{bmatrix} 1 & 1 \\ 1 & 1 + \varepsilon + \Delta \end{bmatrix}, \qquad \Delta A = \begin{bmatrix} 0 & 0 \\ 0 & \Delta \end{bmatrix}. \] The solution moves to \(x + \Delta x\), the intersection of row 1 with the perturbed row 2 on the plot.

\(x_1\)\(x_2\)
\(x\)11
\(x + \Delta x\) 11


Back to top

ASEN 3502, CU Boulder. Last built Sep 23, 2026 at 9:00 AM MDT.