Chapter 3 Formula Sheet
Reference, not teaching. Each entry names the book’s equation or definition number, states the result, and says when to reach for it. Read the concept pages first; come back here when you are working.
The one-line summary
Section titled “The one-line summary”Add an inner product to a vector space and everything else follows:
§3.1 Norms
Section titled “§3.1 Norms”| result | statement | when |
|---|---|---|
| Def 3.1 norm axioms | absolutely homogeneous ; triangle ; positive definite | checking a candidate “length” |
| Eq 3.3 Manhattan | Lasso, robust loss, sparse recovery | |
| Eq 3.4 Euclidean | the book’s default everywhere after §3.1 | |
| maximum | adversarial budgets, worst-case bounds | |
| -norm | , | theory; rarely used directly |
| ordering | for | sanity-checking a computation |
| why | when | the triangle inequality fails; ball not convex |
np.linalg.norm(x, 1) # l1
np.linalg.norm(x) # l2 for a vector, FROBENIUS for a matrix
np.linalg.norm(x, np.inf) # maximum
np.linalg.norm(A, 2) # matrix 2-norm: largest singular value§3.2 Inner products
Section titled “§3.2 Inner products”| result | statement | when |
|---|---|---|
| bilinear | linear in each argument separately (Eq 3.6, 3.7) | automatic for |
| Def 3.2 symmetric | the condition Exercise 3.2 breaks | |
| Def 3.2 positive definite | for (Eq 3.8) | makes the induced norm real |
| Def 3.3 inner product | bilinear + symmetric + positive definite | the whole definition |
| Eq 3.10 matrix form | with | computing anything |
| Theorem 3.5 | inner product symmetric positive definite exists (Eq 3.15) | there are no other kinds |
| SPD consequences | trivial null space; every diagonal entry positive | necessary, not sufficient |
| the test | Cholesky succeeds positive definite | not eigvalsh(A) >= 0, which accepts semidefinite |
np.allclose(A, A.T) # symmetry
np.linalg.cholesky(A) # raises LinAlgError iff not positive definite
np.linalg.eigvalsh(A) # eigenvalues, if you want to see them§3.3 Lengths and distances
Section titled “§3.3 Lengths and distances”| result | statement | when |
|---|---|---|
| Eq 3.16 induced norm | every inner product gives a norm | |
| Eq 3.17 Cauchy-Schwarz | , equality iff parallel | makes the cosine well defined; gives the triangle inequality |
| Def 3.6 distance | (Eq 3.21) | the length of a difference, nothing more |
| metric axioms | positive definite, symmetric (Eq 3.22), triangle (Eq 3.23) | a metric needs no vector space |
| the hierarchy | inner products norms metrics | which structure you actually have |
| parallelogram law | test whether a norm comes from an inner product | |
| Remark | inner product and metric run in opposite directions | similar = large inner product, small distance |
| expansion | why dot-product ranking distance ranking | |
| Mahalanobis | distances that respect correlation |
§3.4 Angles and orthogonality
Section titled “§3.4 Angles and orthogonality”| result | statement | when |
|---|---|---|
| Eq 3.24, 3.25 | , | unsigned angle; always clip before arccos |
| cosine similarity | the same ratio | comparing embeddings; scale-free |
| Def 3.7 orthogonal | , written | is orthogonal to everything |
| Def 3.7 orthonormal | orthogonal and both of unit length | the extra half §3.5 needs |
| Def 3.8 orthogonal matrix | , so (Eq 3.29, 3.30) | free inverse, no conditioning cost |
| Eq 3.31 | lengths preserved | |
| Eq 3.32 | angles preserved | both from |
| concentration | for random pairs | why cosine works in high dimensions |
Orthogonality is relative to the inner product. Example 3.7: and are at under the dot product and at under , with .
§3.5 Orthonormal basis
Section titled “§3.5 Orthonormal basis”| result | statement | when |
|---|---|---|
| Def 3.9 ONB | for (Eq 3.33), (Eq 3.34) | orthogonal alone gives only Eq 3.33 |
| Gram matrix | both conditions in one equation | |
| coordinates | , i.e. | , no solve, independent per coordinate |
| Parseval | fails off an ONB; the basis of “variance explained” | |
| orthogonal but not normal | the division Fourier coefficients carry | |
| numerics | classical Gram-Schmidt loses orthogonality like | use np.linalg.qr (Householder) |
At : classical Gram-Schmidt gives (orthogonality entirely gone), modified , Householder .
§3.6 Orthogonal complement
Section titled “§3.6 Orthogonal complement”| result | statement | when |
|---|---|---|
| definition | it is a subspace | |
| dimension | the accounting that makes truncation exact | |
| intersection | from positive definiteness | |
| checking | orthogonal to a basis of suffices | = null space of ‘s basis as rows |
| Eq 3.36 | , uniquely | the split PCA relies on |
| Pythagoras | because | |
| normal vector | : one vector describes all of | hyperplanes, Ch 12 |
| point-to-plane | SVM margin | |
| residual operator | ; rank | keeps what discards |
§3.7 Inner product of functions
Section titled “§3.7 Inner product of functions”| result | statement | when |
|---|---|---|
| Eq 3.37 | the interval is part of the definition | |
| norm | norm | |
| Example 3.9 | on | the product is odd; exact cancellation |
| Eq 3.38 | pairwise orthogonal | the Fourier basis |
| squared norms | , | orthogonal, not orthonormal |
| coefficient | the is | |
| truncation error | total energy minus the energy kept | Parseval, predictive |
| caveat | convergence pointwise; Gibbs overshoot | reconstructing edges |
§3.8 Orthogonal projections
Section titled “§3.8 Orthogonal projections”The section to memorise.
| result | statement | when |
|---|---|---|
| Def 3.10 | , i.e. | idempotence alone permits oblique projections |
| orthogonal projection | idempotent and symmetric | the closest point |
| Eq 3.40 line, coordinate | one direction | |
| Eq 3.42 line, projection | — | |
| Eq 3.44 | geometric reading | |
| Eq 3.46 line, matrix | symmetric, rank 1 | |
| Eq 3.56 normal equation | the whole of §3.8.2 | |
| Eq 3.57 pseudo-inverse | needs of full column rank | |
| Eq 3.58 projection | — | |
| Eq 3.59 matrix | derivations, not computation | |
| Eq 3.63 projection error | the objective PCA minimises | |
| Eq 3.65, 3.66 ONB case | , | always prefer this |
| spectrum | eigenvalues ; | fastest diagnostic |
| Eq 3.67, 3.68 Gram-Schmidt | ; | building an ONB |
| Eq 3.72 affine | shift, project, shift back | |
| Eq 3.73 affine distance | translation preserves distance | |
| ridge / jitter | stabilises the solve; no longer a projection | |
| general inner product | Exercise 3.6; is then not symmetric |
lam, *_ = np.linalg.lstsq(B, x, rcond=None) # the right default: tolerates rank deficiency
proj = B @ lam
Q, _ = np.linalg.qr(B); proj = Q @ (Q.T @ x) # same answer, explicit ONB
P = B @ np.linalg.inv(B.T @ B) @ B.T # for a derivation, not productionNever form in production: . On a degree-11 monomial design () the normal-equation projection is away from the QR answer.
§3.9 Rotations
Section titled “§3.9 Rotations”| result | statement | when |
|---|---|---|
| rotation | orthogonal and | orientation preserved; is a reflection |
| Eq 3.76 | columns are the images of | |
| composition in | Abelian group | |
| Eq 3.77 about | fixes | |
| Eq 3.78 about | signs reversed — not a typo | |
| Eq 3.79 about | the 2-D case, padded | |
| Def 3.11 Givens | the identity with , , , (Eq 3.80, 3.81) | rotate one plane, fix dimensions |
| parameter count | angles | 1, 3, 6, 45 for |
| §3.9.4 properties | preserve distances; preserve angles; not commutative in ; group only about a shared fixed point | Euler-angle ordering matters |
Measured: in space, against in the plane.
The determinant as a one-glance diagnostic
Section titled “The determinant as a one-glance diagnostic”| with | what it is | |
|---|---|---|
| yes | rotation | |
| yes | reflection | |
| no | singular; a projection if also idempotent | |
| no | uniform scaling by | |
| no | area-preserving but distorting — a shear |
Numbers worth remembering
Section titled “Numbers worth remembering”| quantity | value | from |
|---|---|---|
| , , | Norms | |
| vs | vs — fails | Norms |
| eigenvalues of , | , | Example 3.4 |
| boundary of | exactly | Inner Products |
| under dot, Eq 3.19 | , exactly | Example 3.5 |
| Example 3.6 angle | , | §3.4 |
| Example 3.7 angle | then , | §3.4 |
| at | Angles | |
| classical Gram-Schmidt at | ONB | |
| digits data | rank of ; components for | Complement, Projections |
| digits complement | span of pixels , , | Complement |
| square wave , | , | Functions |
| Gibbs overshoot | , not | Functions |
| Example 3.10 | , | §3.8.1 |
| Example 3.11 | , , error | §3.8.2 |
| Example 3.11 matrix | §3.8.2 | |
| Exercise 3.5 | , , rank not | Exercises |
| Exercise 3.6 | , exactly | Exercises |
| Book Eq 3.74 | — the printed matrix is not orthogonal | Rotations |
| 3-D commutator at | Rotations |
Where each section is used later
Section titled “Where each section is used later”| from Chapter 3 | used in |
|---|---|
| norms (§3.1) | Ch 7 regularised objectives; Ch 9 ridge and Lasso |
| inner products (§3.2) | Ch 12 kernels; Ch 6 covariance |
| distances (§3.3) | Ch 11 clustering; nearest-neighbour anything |
| angles (§3.4) | embedding comparison; whitening |
| ONB (§3.5) | Ch 4 — eigendecomposition and SVD produce them |
| complement (§3.6) | Ch 10 discarded directions; Ch 9 residual space |
| function inner products (§3.7) | Ch 6 — the analogous move for random variables |
| projections (§3.8) | Ch 9 least squares; Ch 10 PCA |
| affine projections (§3.8.4) | Ch 12 separating hyperplane |
| rotations (§3.9) | Ch 4 — the outer factors of an SVD |
The five mistakes this chapter is designed to prevent
Section titled “The five mistakes this chapter is designed to prevent”- Assuming the dot product. Orthogonality, length, angle and projection all depend on the inner product. Exercise 3.6 gives three different wrong answers from three different versions of this assumption.
- Testing definiteness and calling it an inner product. Symmetry is a separate condition, and Exercise 3.2’s matrix passes the definiteness test.
- Testing
eigvalsh(A) >= 0. That accepts positive semidefinite matrices, where a nonzero vector has length zero. Use Cholesky. - Applying Equation 3.59 to a spanning set. It needs a basis. Exercise 3.5’s four vectors have rank 3, and the Gram matrix’s condition number is .
- Forming in production code. It squares the condition number. Use
lstsqor QR.
-
You need to project onto a subspace given by a matrix B whose columns may be linearly dependent. Which call?
Equation 3.59 requires a basis, and a rank-deficient B makes B-transpose B singular. lstsq returns the correct projection regardless, and it also avoids squaring the condition number.
pch.quizShowAnswer
B — np.linalg.lstsq(B, x, rcond=None), because it uses a minimum-norm pseudo-inverse and does not require full column rank — Equation 3.59 requires a basis, and a rank-deficient B makes B-transpose B singular. lstsq returns the correct projection regardless, and it also avoids squaring the condition number.
-
Which single number tells you the dimension of the subspace a projection matrix projects onto?
P squared equals P forces lambda squared equals lambda for every eigenvalue, so each is 0 or 1. The trace is their sum and the rank is the count of nonzeros, so both equal the dimension.
pch.quizShowAnswer
B — Its trace, which equals its rank because the eigenvalues are only 0 and 1 — P squared equals P forces lambda squared equals lambda for every eigenvalue, so each is 0 or 1. The trace is their sum and the rank is the count of nonzeros, so both equal the dimension.
-
A colleague reports that a norm they wrote satisfies the parallelogram law. What does that tell you?
The parallelogram law is exactly the test. Among the standard p-norms only p = 2 passes, which is why ridge has a closed-form solution and Lasso does not.
pch.quizShowAnswer
B — That it comes from an inner product, so it has angles, orthogonality and projections attached — which l1 and l-infinity do not — The parallelogram law is exactly the test. Among the standard p-norms only p = 2 passes, which is why ridge has a closed-form solution and Lasso does not.
Recall card
Section titled “Recall card”- One inner product generates the whole chapter: length is its square root on the diagonal, distance is the length of a difference, and the cosine is it divided by two lengths.
- Theorem 3.5 is an if and only if — every inner product on a finite-dimensional real space is a symmetric positive definite matrix, and testing a candidate means testing that matrix.
- Cholesky is the definiteness test, because comparing eigenvalues to zero accepts the semidefinite boundary case.
- The projection recipe is three steps: solve the normal equation for the coordinates, multiply by the basis for the projection, and sandwich the inverse Gram matrix for the projection matrix — and all three collapse when the basis is orthonormal.
- A projection matrix has eigenvalues zero and one only, so its rank and trace both equal the dimension it projects onto.
- A rotation is an orthogonal matrix of determinant plus one, needs n(n−1)/2 angles in n dimensions, and does not commute beyond the plane.
- Never form B-transpose B in production: it squares the condition number, which is the same failure behind classical Gram-Schmidt.
Back to: Analytic Geometry Overview — or forward to Chapter 4, where the orthonormal bases of §3.5 turn out to be what every decomposition produces.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading