Book XXIV contents · ← Chapter 8 · master indexChapter 9 · Book XXI →
Principia Orthogona · Book XXIV · Linear and nonlinear · Chapter 9

Norms, singular values and conditioning

A matrix turns the unit circle into an ellipse. The longest axis of that ellipse is the size of the matrix, the shortest is the size of its inverse, and their ratio, the condition number, says how much a small error in the data of a linear system can be magnified in its answer. This chapter proves that, and shows that it is why solving least squares through the normal equations loses digits.

The object. A real 2×2 matrix A = [[a,b],[c,d]]. Choose a, b, c, d and read off F (the sum of the squares of the entries), the determinant D, the two singular values, and the condition number K. The button counts the 2401 matrices with entries −3..3.

abcd
Held textLax, Linear Algebra and Its Applications 2nd ed.: Chapter 7, the norm of a map and Theorems 13 to 15 (pp.89–91); Chapter 8, Theorem 13, the norm is the square root of the largest eigenvalue of A*A (p.119); Chapter 10, Theorem 22 (polar decomposition), the singular value decomposition and Exercises 13 and 14 (pp.169–171); Chapter 17, sensitivity and the condition number (pp.247–248) (scan; page checks in the script)
Claim typestandard mathematics, no new results; the pseudoinverse (section 4) and the Hilbert matrix (section 5) are not in the held text, and say so where they appear
LeanNumerical.lean: ten statements, compiled 2026-11-04: all ten clean (axioms: propext, Classical.choice, Quot.sound only), after one fix to the Hilbert control
Checksch09-verify.py: exact arithmetic, exhaustive finite families, a few steps in 60-digit decimal, page references
layers

1 · The size of a map

Intuition

Feed every unit vector to A. The outputs trace an ellipse (a line segment if A is singular). The longest output is the size of A, written |A|: the most that A can stretch anything. It is the right yardstick for a map because it bounds every single output: no vector is stretched by more than |A|.

Statement
Definition and Theorems 13 and 14 (Lax pp.89–91)|A| = max |Ax| over unit vectors x. Then |Az| ≤ |A||z| for every z; |A + B| ≤ |A| + |B|; |CA| ≤ |C||A|; and |AT| = |A|.
Theorem 15 (Lax p.91)If A is invertible and |A − B| < 1/|A-1|, then B is invertible.
The norm in terms of eigenvalues (Lax p.119, Chapter 8, Theorem 13)|A| is the square root of the largest eigenvalue of ATA. For a 2×2 matrix, with F the sum of the squares of its entries and D its determinant, |A|² = (F + √(F² − 4D²))/2.
Proof

The inequality. For z = 0 it is trivial. Otherwise z = |z|u with u a unit vector, so |Az| = |z||Au| ≤ |z||A|. Products. |CAx| ≤ |C||Ax| ≤ |C||A||x|; take the maximum over unit x. Transpose. (Ax, v) = (x, ATv), and |A| is the maximum of (Ax, v) over unit x and v (Lax p.90, from Theorem 2 of Chapter 7); the right-hand side gives |AT| in the same way.

Theorem 15. Put C = A − B, so B = A − C = A(I − A-1C), and |A-1C| ≤ |A-1||C| < 1. If Bx = 0 then x = A-1Cx, so |x| ≤ |A-1C||x|, which forces x = 0. So B has no kernel, and a square matrix with no kernel is invertible. The argument is Lax’s.

The eigenvalue formula. |Ax|² = (ATAx, x). By the spectral theorem of Chapter 8, ATA is symmetric, so this is at most λ|x|², where λ is its largest eigenvalue, with equality at a corresponding eigenvector. For 2×2, ATA has trace F and determinant det(AT)det(A) = D², so λ is the larger root of t² − Ft + D².

Remarks

Lean: opNorm_le and opNorm_comp_le are Mathlib’s operator-norm lemmas, stated for real normed spaces; compiled clean (axioms: propext, Classical.choice, Quot.sound only). The eigenvalue formula, Theorem 15 and |AT| = |A| are not stated in Lean. The script checks, exactly: for all 625 integer 2×2 matrices with entries −2..2 and 80 integer vectors (50,000 cases), |Ax|² ≤ λ|x|², comparing without square roots; where λ is an integer (273 matrices) it is attained at an eigenvector of ATA; A AT and ATA have the same F and the same D². It also checks, with the 1-norm (the largest column sum, a different norm, for which the product rule still holds because the proof used nothing special about the Euclidean one), |CA| ≤ |C||A| for all 390,625 pairs, and Theorem 15 in 40,176 cases. The bound in Theorem 15 cannot be improved: A = I and B = I − E11 has |A − B| = 1 = 1/|A-1| and B is singular; the script finds 568 such equality cases among its inputs.

2 · Polar decomposition and singular values

Intuition

A real number is a sign times a size. A matrix is a stretch times a turn: first rotate or reflect (an orthogonal map U, which preserves lengths), then stretch along perpendicular axes (a symmetric map R with non-negative eigenvalues). Choosing the axes, once in the input space and once in the output space, makes A diagonal: A = W D V, with W and V orthogonal and D diagonal. The diagonal entries of D are the singular values, the semi-axes of the ellipse of section 1.

Statement
Theorem 22, polar decomposition (Lax p.169)Every square matrix A factors as A = RU with R non-negative symmetric and U orthogonal (unitary in the complex case). If A is invertible, R is positive.
Singular value decomposition (Lax p.170)A = WDV with W and V orthogonal and D diagonal with non-negative entries. The diagonal entries of D, the singular values of A, are the non-negative square roots of the eigenvalues of AAT.
Exercises 13 and 14 (Lax pp.170–171)For a square matrix A, AAT and ATA have the same eigenvalues with the same multiplicities (Exercise 13, p.170). For a matrix A from one Euclidean space to another they have the same non-zero eigenvalues with the same multiplicities (Exercise 14, p.171).
Proof

Polar decomposition, A invertible (real case). (AATx, x) = |ATx|² > 0 for x ≠ 0, so AAT is a positive symmetric matrix and has a unique positive square root R, R² = AAT (Lax cites his Theorem 1 for this on p.169). Put U = R-1A. Then UUT = R-1AATR-1 = R-1R²R-1 = I, so U is orthogonal, and A = RU. For singular A Lax builds the isometry on the range of R and extends it (p.170); that argument is not reproduced here.

Singular values. By the spectral theorem R = WDWT with W orthogonal and D diagonal. Then A = WDWTU = WDV with V = WTU orthogonal. The eigenvalues of R² = AAT are the squares of the entries of D.

Exercise 14. If ATAx = λx with λ ≠ 0, then Ax ≠ 0 (else ATAx = 0) and AAT(Ax) = λAx. So A carries the λ-eigenspace of ATA injectively into that of AAT; by the same argument AT carries it back, so the two eigenspaces have equal dimension.

Remarks

Lean: gram_det states det(ATA) = det(A)², the product of the squared singular values. gram_same_nonzero_spectrum states tm·charpoly(ATA) = tn·charpoly(AAT) for any real m×n matrix, from Mathlib’s lemma for products in both orders: it says the two have the same non-zero roots with multiplicity; compiled clean, with the same axioms. The existence of the decomposition is not stated in Lean. The script builds A = W D VT from the rotations with cosine and sine 3/5 and 4/5, 5/13 and 12/13, 8/17 and 15/17, 7/25 and 24/25 (and the identity), and D = diag(s1, s2) with 0 ≤ s2 ≤ s1 ≤ 5, so every entry is a fraction. For all 525 matrices it checks exactly ATA V = V D², AAT W = W D², A = RU with R = W D WT symmetric and U = W VT orthogonal. That checks the theorem on a family where it can be written in fractions; it is not a proof. Exercise 14 is checked on all 729 3×2 matrices with entries −1, 0, 1: the characteristic polynomial of AAT is t times that of ATA. And det(ATA) = det(A)² on all 625 integer 2×2 matrices.

3 · The condition number and sensitivity

Intuition

Solve Ax = b where b carries a small error. If A squeezes the circle into a thin ellipse, then an error in b along the short axis comes from a large change in x, because A made that direction small. The worst case is a solution x that A stretches the most, together with an error in b along the direction A stretches the least. The magnification is then the longest axis divided by the shortest: K = |A||A-1|. It is at least 1, and equal to 1 only for a map that treats all directions alike.

Statement
Sensitivity and the condition number (Lax pp.247–248, formulas (4) and (5))Let A be invertible, Ax = b and A(x + δx) = b + δb. Then (|δx|/|x|) ≤ K(A)(|δb|/|b|), where K(A) = |A||A-1|, and the bound is attained for some x and δb.
Properties(i) K(A) ≥ 1 (Lax Exercise 1, p.248). (ii) K(A) ≥ β/α, where β and α are the largest and smallest absolute values of the eigenvalues of A (Lax (6), (6)′ and (7)). (iii) For the Euclidean norm, K(A) = σmax/σmin. (iv) For 2×2: K + 1/K = F/|D|. Since F − 2D = (a − d)² + (b + c)² and F + 2D = (a + d)² + (b − c)², K = 1 exactly when A is a non-zero multiple of a rotation or a reflection. (v) K(ATA) = K(A)².
Proof

Sensitivity. Subtracting the two equations gives Aδx = δb, so δx = A-1δb and |δx| ≤ |A-1||δb|. Also |b| = |Ax| ≤ |A||x|. Multiply: |δx||b| ≤ |A||A-1||δb||x|, which is the claim with the denominators cleared. Attained: take x with |Ax| = |A||x| and δb with |A-1δb| = |A-1||δb|; both inequalities become equalities.

(i) I = AA-1 and |I| = 1, so 1 ≤ |A||A-1|. (ii) If Ax = μx then |μ||x| = |Ax| ≤ |A||x|, so every eigenvalue has |μ| ≤ |A|; in particular β ≤ |A|. The eigenvalues of A-1 are the 1/μ, so the same argument gives 1/α ≤ |A-1|. Multiply. (iii) From A = WDV, A-1 = VTD-1WT has singular values 1/σi, so |A| = σmax and |A-1| = 1/σmin.

(iv) Write λ1 ≥ λ2 for the eigenvalues of ATA, so λ1 + λ2 = F and λ1λ2 = D², and K² = λ1/λ2. Then (K + 1/K)² = K² + 2 + K-2 = (λ1 + λ2)²/(λ1λ2) = F²/D². Since K + 1/K ≥ 2 with equality only at K = 1, K = 1 exactly when F = 2|D|, and by the two sum-of-squares identities that happens exactly when (a − d)² + (b + c)² = 0 (so D > 0) or (a + d)² + (b − c)² = 0 (so D < 0), with A not zero. (v) ATA = VTD²V has singular values σi², so its ratio is (σmax/σmin)².

Remarks

Lean: condition_ge_one states 1 ≤ |A||B| whenever B is a left inverse of A (B·A = id) on a non-trivial real normed space. sensitivity states |δx||Ax| ≤ (|A||B|)(|Aδx||x|) with b = Ax and δb = Aδx, so it carries no division and holds when x or b is zero. frobenius_det_bounds states the two sum-of-squares identities and 2|D| ≤ F. trace_sq_gram states trace((ATA)²) = F² − 2D² written out in the four entries, which is what turns (iv) into (v) for 2×2. All compiled clean. The script: K from the definition |A||A-1| equals σmax/σmin for all 2112 invertible integer matrices with entries −3..3 (2401 matrices in all: 289 singular and 2112 invertible), in 60-digit decimal because it needs square roots; K + 1/K = F/|D| for all of them; K ≥ 1 for all, and 96 have K = 1 exactly where the integer test says; trace((ATA)²) = F² − 2D² exactly and K(ATA) = K(A)²; (ii) is checked exactly with the 1-norm on all 2112. Sensitivity is checked exactly (1-norm, cross-multiplied) on 285,696 cases, and the bound is attained for A = diag(1, 1/m), x = e1, δb along e2, with ratio exactly m = K, for m = 1 to 20. One caution from Lax p.248: the bound is a worst case. With k-digit arithmetic the relative error in x can be as large as 10-kK(A); it is often smaller.

4 · The pseudoinverse, and why not the normal equations

Intuition

A tall matrix has no inverse, but it has a best substitute: the map that sends b to the least-squares answer of Chapter 8. That map is the pseudoinverse A+. In the singular value decomposition it is easy to write: undo each stretch that is not zero, and leave the zero directions alone. The classical way to compute the answer, solving ATAc = ATb, squares every singular value, and so squares the condition number: half the digits are gone before the arithmetic starts.

Statement
Standard facts, not in the held text beyond Lax p.86If A has independent columns, A+ = (ATA)-1AT, and A+A = I. In general A+ satisfies the four Penrose conditions AA+A = A, A+AA+ = A+, and AA+ and A+A symmetric. If A = WDV (W, V orthogonal, D diagonal), A+ = VTD+WT, where D+ inverts the non-zero diagonal entries. For rank one, A = uvT: A+ = vuT/(|u|²|v|²). The least-squares answer is c = A+b, and the normal equations have condition number K(ATA) = K(A)².
Proof

Independent columns. ATA is invertible (Chapter 8), so (ATA)-1ATA = I. Then AA+ = A(ATA)-1AT is the orthogonal projection onto the range of A (Chapter 8, section 3): it is symmetric and fixes every vector of the range, so AA+A = A. Since A+A = I, which is symmetric, A+AA+ = A+. Rank one. AA+A = uvTvuTuvT/(|u|²|v|²) = u(vTv)(uTu)vT/(|u|²|v|²) = uvT. Condition. Section 3 (v): the singular values of ATA are the squares of those of A. The SVD formula for A+ is stated here as the standard one; its proof is not given on this page.

Remarks

Lean: left_inverse_normal states that (ATA)-1AT is a left inverse of A when det(ATA) is a unit; compiled clean. The Penrose conditions and the SVD formula are not stated in Lean. The script checks, exactly: the four Penrose conditions for 200 random integer rank-one 3×2 matrices with the rank-one formula; for 200 random integer 4×2 matrices of full column rank, that (ATA)-1AT is a left inverse and satisfies all four conditions; and, on the 525 matrices A = W D VT of section 2 (including the singular and zero ones), that V D+ WT satisfies all four. The chapter 8 four-point fit gives A+b = (9/10, 9/10), the fitted line y = 0.9 + 0.9t. For that matrix ATA = [[4,6],[6,14]] has F = 284 and D = 20, so K(ATA) = 14.13 and K(A) = 3.76: here the squaring costs about one digit, which is harmless. It costs half of all digits when K(A) is large.

5 · A real example: the Hilbert matrix

Intuition

The Hilbert matrix Hn has entries 1/(i + j − 1), the integrals of xi+j-2 over [0, 1]. It looks harmless and has an inverse made of whole numbers, but its columns are nearly parallel, so its ellipse is almost flat and its condition number grows very fast.

Statement
Computed values (not in the held text)H3 = [[1,1/2,1/3],[1/2,1/3,1/4],[1/3,1/4,1/5]] has inverse [[9,-36,30],[-36,192,-180],[30,-180,180]]. With the 1-norm (largest column sum), |H3| = 11/6 and |H3-1| = 408, so κ1(H3) = 748. For n = 1 to 5 the 1-norm condition numbers are 1, 27, 748, 28375, 943656, and Hn-1 has integer entries for every n up to 8.
Proof

By direct computation in exact fractions: H3H3-1 = I, the column sums of H3-1 in absolute value are 75, 408 and 390, and those of H3 are 11/6, 13/12 and 47/60; 11/6 × 408 = 748. Nothing deeper is claimed; the growth for general n is observed here, not proved.

Remarks

Lean: control_hilbert3_inverse states that the integer matrix above times H3 is the identity over the rationals; a direct computation; compiled clean on the third try: the first proof left vector entries unevaluated, a first replacement left !![1,0,0;0,1,0;0,0,1] = 1 unsolved, and the second replacement closed it. The script verifies all of the above exactly for n = 1 to 8. It also solves Hnx = Hn(1, …, 1) in ordinary floating point (numpy, double precision, not exact) for n = 3, 5, 8, where the 2-norm condition numbers are about 5×102, 5×105 and 1.5×1010. The relative errors of the computed solution are of order 10-14, 10-12 and 10-7, and the script asserts only that each is below 2.3 × 10-15 times K, a stand-in for Lax’s 10-kK with double precision (about 16 digits) and a margin of 10. These floating-point digits depend on the machine and the library, so they are illustrations, not part of the results.

6 · What is not here

The conditioning of the eigenvalue problem (it differs from that of Ax = b and is worse for non-normal matrices), floating-point error models and the stability of Gaussian elimination, iterative methods and their rates (Lax Chapter 17, from p.248 on), the QR algorithm (Chapter 18), the best low-rank approximation of a matrix by truncating its singular values, and complex matrices beyond what is stated. Lean states none of the decompositions, only the identities and inequalities listed in the remarks above.

7 · Exercises

  1. Show K(A) ≥ 1 from |I| = 1 (Lax Exercise 1). Then show K(cA) = K(A) for every non-zero number c.
  2. For A = [[1,1],[0,1]], compute F and D, then use K + 1/K = F/|D| to show K = (3 + √5)/2 = 2.618…. Check the singular values are φ and 1/φ with φ the golden ratio.
  3. For A = diag(1, ε), find K, and find x and δb for which the sensitivity bound is an equality.
  4. Compute the singular values of A = [[3,0],[4,5]] from AAT (here F = 50 and D = 15), and K(A). Find R and U in A = RU.
  5. Use Exercise 14 to show that the non-zero singular values of A and of AT agree, and give a 3×2 example where one of ATA, AAT has the eigenvalue 0 and the other does not.
  6. Verify H3H3-1 = I with the matrix of section 5, and compute κ1(H3) = 748 yourself.
  7. For the four-point fit of Chapter 8, solve the least-squares problem in exact fractions through ATAc = ATb, then explain why the same computation in 3-digit arithmetic would lose accuracy faster than one that works with A directly when K(A) is large.