Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.When a tiny nudge causes a huge change
Two roads cross at a sharp angle, like an X. If you shift one road a little, the crossing point moves a little. But if the roads are almost parallel, a tiny shift makes the crossing point slide far away.
Problems like that are called ill-conditioned. The number that measures how badly small errors get blown up is the condition number. Try it: make the lines nearly parallel, and watch the cloud of possible answers spread out.
How big is a machine?
A machine that stretches things by at most 4× has “size” 4. That’s a matrix norm: the biggest stretch it can produce.
A robot measures positions with tiny sensor errors. If the maths it uses to compute its next move is ill-conditioned, those tiny errors can turn into wild, dangerous motions. The condition number warns you before that happens.
- 1. Two nearly parallel roads. A small nudge moves their crossing point…
- 2. A machine stretches one direction 4× and another 1×. Its biggest stretch?
- 3. A 1% measurement error becomes a 100% answer error. The amplification factor is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.Common matrix norms
| Norm | Formula | Meaning |
|---|---|---|
| Frobenius | treat the matrix as one long vector | |
| Spectral | largest stretch of a unit vector | |
| 1-norm | largest absolute column sum | largest stretch in the sense |
| ∞-norm | largest absolute row sum | largest stretch in the sense |
| Nuclear | convex proxy for rank |
Example. : the column sums are 4 and 6, so . The row sums are 3 and 7, so .
The condition number
- : perfect.
- .
- A singular matrix has .
- 1. ‖diag(3, −5)‖₂ = ?
- 2. κ(diag(10, 0.1)) = ?
- 3. Frobenius norm of [[3, 4]]?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Induced (operator) norms
Given a vector norm, the induced matrix norm is the biggest stretch:
This gives and the very useful . The 2-norm induces , the 1-norm the max column sum, and the ∞-norm the max row sum. (The Frobenius norm isn’t induced, but it satisfies the same product rule.)
What the condition number promises
For , if has a small relative error:
Rule of thumb: with float64 (about 16 digits), expect to lose about digits. With , roughly 10 digits are left. With , none are.
Where conditioning bites
| Situation | Conditioning issue |
|---|---|
| Polynomial regression, Vandermonde matrices | grows exponentially with the degree. Use orthogonal polynomials or QR |
| Normal equations | (A2.3-4) |
| Features on very different scales | inflated . Standardize your data (D0) |
| Gradient descent | iterations needed grow like of the Hessian (A6) |
| Robot near a singular pose | : joint speeds blow up (A2.3-7) |
- 1. ‖A‖₁ for [[1, −2], [3, 4]]?
- 2. κ = 10⁶ in float64 leaves roughly how many correct digits?
- 3. Why standardize features before regression?
Level 3: Advanced
★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.Proof of the error bound
If and , then .
Proof. , so . Also , so . Multiply the two inequalities. ∎ The bound is tight: it’s reached when lies along the top singular direction and along the bottom one (Practice Code 3 gets within 0.02% of it).
Distance to singularity
, so the relative distance to the nearest singular matrix is .
This follows from Eckart–Young (A2.3-6) with . A huge condition number means the matrix is almost singular. The determinant does not measure this (A2.2-2).
Norm relationships
For with rank :
Orthogonal matrices don’t change the 2-, Frobenius or nuclear norms (they are unitarily invariant), and they have . That’s why orthogonal transformations are numerically safe.
Exercise 3.1: Show κ(AᵀA) = κ(A)² in the 2-norm
The singular values of are , so .
- 1. ‖A‖₂ = 3 and ‖B‖₂ = 4. The bound on ‖AB‖₂?
- 2. Distance (2-norm) from diag(5, 0.2) to the nearest singular matrix?
- 3. κ(A) = 100. κ(AᵀA) = ?
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.A stable algorithm can’t fix an ill-conditioned problem
Solving with the notoriously ill-conditioned Hilbert matrix shows the difference between an unstable algorithm and an ill-conditioned problem. LAPACK’s solver is backward stable (A2.2-4), yet the error grows in proportion to . By , and essentially no digits survive. The fix must come from the modelling: better bases, regularization, or more precise data.
Norms and conditioning in modern ML
- Optimization speed. Gradient descent on a quadratic converges at a rate set by of the Hessian: the number of iterations grows like , or with momentum (A6). Preconditioners (Adam, Shampoo, K-FAC) are attempts to reduce the effective . Normalization layers help partly by improving conditioning (E5).
- Robustness and Lipschitz bounds. A network with 1-Lipschitz activations satisfies . Controlling spectral norms (spectral normalization, Miyato et al., 2018; Parseval networks, Cissé et al., 2017) gives certified bounds on how much an adversarial perturbation can change the output (M1). For robot policies, this caps how much sensor noise can change the commanded action. Practice Code 5 shows the bound is valid but often loose.
- Generalization theory. Norm-based bounds (Bartlett, Foster and Telgarsky, 2017) use products of spectral norms instead of parameter counts to explain why large networks generalize (B2).
References
- J. von Neumann and H. Goldstine (1947). “Numerical inverting of matrices of high order.” Bulletin of the AMS, 53(11).
- A. Turing (1948). “Rounding-off errors in matrix processes.” Quarterly Journal of Mechanics and Applied Mathematics, 1. (Coined “condition number”.)
- N. Higham (2002). Accuracy and Stability of Numerical Algorithms, 2nd ed. SIAM.
- P. Bartlett, D. Foster, M. Telgarsky (2017). “Spectrally-normalized margin bounds for neural networks.” NeurIPS.
- M. Cissé, P. Bojanowski, E. Grave, Y. Dauphin, N. Usunier (2017). “Parseval networks: Improving robustness to adversarial examples.” ICML.
- T. Miyato, T. Kataoka, M. Koyama, Y. Yoshida (2018). “Spectral normalization for generative adversarial networks.” ICLR.
- L. Trefethen and D. Bau (1997). Numerical Linear Algebra. SIAM. Lectures 3, 12–15.