Skip to content
Tactiverge

School/✦ Research Engineer/Week 5

Conditioning: when small errors become big ones

Your solver is perfect, your sensors are 0.1% accurate, and your answer is 50% wrong. Who is to blame?

About 45 min · 3 goals · Checked by automated tests

1.Why should I care?

Calibration matrices, least-squares fits with similar inputs, and robot poses near singularities can all be ill-conditioned. Knowing κ tells you how many digits of your answer you can trust, regardless of how good the code is.

  • ◇ Define the condition number κ(A) = σmax/σmin and estimate it for 2×2 matrices.
  • ◇ Use the bound ‖δx‖/‖x‖ ≤ κ(A)·‖δb‖/‖b‖ to predict error amplification.
  • ◇ Distinguish an ill-conditioned problem from an unstable algorithm.

2.Discover

Set ε = 1 and nudge b₂. Then slide ε down to 10⁻⁴. For each, record κ, the relative change in b and the relative change in x. Does the amplification ever exceed κ?

Loading the interactive…

Can't use the interactive? Read a description instead

The condition explorer draws two lines whose intersection is the solution, plus a dashed nudged line and the new intersection. Sliders set ε and the nudge. Text reports κ, both solutions and the relative changes in b and x.

3.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

What is κ of the diagonal matrix diag(10, 0.1) in the 2-norm?

4.Predict

Two equations describe nearly parallel lines. You nudge one line very slightly. What happens to their intersection?

Guess first. Being wrong here is how the surprise works.

5.Understand

A property of the problem

κ(A) ≥ 1 measures how sensitive the solution of Ax = b is to changes in b (and in A). κ ≈ 1 is perfect (rotations, orthogonal matrices); κ = 10⁶ means relative data errors may be magnified up to a million times. It is a property of the problem itself, so no algorithm can beat it.

Determinant is not the test

det(0.01·I) in 10 dimensions is 10⁻²⁰, yet κ = 1: it is perfectly conditioned, just scaled. [[1, 1], [1, 1.0001]] has det 10⁻⁴ and κ ≈ 4×10⁴. Use κ, not det, to judge closeness to singularity.

Problem versus algorithm

Conditioning is about the problem; stability is about the algorithm. Elimination without pivoting on the tiny-pivot example is an unstable algorithm on a well-conditioned problem (κ ≈ 2.6). Pivoting fixes the algorithm. For an ill-conditioned problem, the fix is to change the problem: better sensor placement, rescaling, or more independent measurements.

Explain it another way

Locating a point from two compass bearings works well when the bearings cross at a right angle, badly when they are nearly parallel. κ measures how shallow the crossing is.

Derivation: The error-amplification bound
  1. Exact: Ax = b. Perturbed data: A(x + δx) = b + δb. Subtract: A·δx = δb, so δx = A⁻¹δb.

  2. Take norms: ‖δx‖ ≤ ‖A⁻¹‖·‖δb‖. Also ‖b‖ = ‖Ax‖ ≤ ‖A‖·‖x‖, so 1/‖x‖ ≤ ‖A‖/‖b‖.

  3. Multiply: ‖δx‖/‖x‖ ≤ ‖A‖·‖A⁻¹‖·‖δb‖/‖b‖.

  4. Define κ(A) = ‖A‖·‖A⁻¹‖. In the 2-norm this is σmax/σmin, the ratio of the largest to smallest singular value.

  5. Rule of thumb: you can lose about log₁₀ κ significant digits. With double precision (about 16 digits) and κ = 10¹⁰, expect about 6 good digits.

Worked example 1

κ(A) = 10⁴ and the measurements in b have 0.01% relative error. What is the worst-case relative error in x?

‖δx‖/‖x‖ ≤ 10⁴ × 10⁻⁴ = 1, i.e. up to 100%. The answer may have no correct digits.

Common mix-ups

  • A tiny determinant means ill-conditioned.
    ✓ Use the condition number; determinants change with scaling.
  • Better code always fixes inaccurate answers.
    ✓ Only if the algorithm was unstable. An ill-conditioned problem is sensitive whatever the code.

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

κ = 500, relative error in b is 0.002 (0.2%). What is the worst-case relative error in x?

Practice 3

Which matrix is closest to singular in the sense that matters numerically?

Practice 4

Working with about 16 significant digits and κ = 10⁹, roughly how many digits of x can you trust?

Practice 5

A calibration matrix has κ = 10⁷. What actually helps?

7.Apply it

Two strain gauges are mounted at angles α and β to a beam's axis to measure two strain components. Write the 2×2 measurement matrix, plot κ against β − α in the Code Lab, and recommend a mounting angle.

8.Reflect

Concepts: Numerical linear algebra: conditioning, LU and power iteration