A. Linear Algebra II: Norms, Positive Definiteness & the SVD
From a first linear algebra course to the matrix tools every later module uses
This primer assumes:
- A first course in linear algebra; refresh matrix products, solves, rank and eigenvectors in the worked recap below (baseline)
- School algebra (squares, fractions and inequalities); integrals only enter Section 8, with a local recap (baseline)
- Sets, quantifiers & logic (Primer 0)
- Supremum, infimum & maxima over infinite sets (Primer 0)
- Sequences, limits & the geometric series (Primer 0)
- Open, closed & compact sets (Primer 0)
Book contents · Apply this chapter to a real decision · Glossary
Almost every certificate in the modules is a statement about a matrix: this matrix is positive semidefinite (an LMI), this matrix stretches no vector by more than $L$ (a Lipschitz bound), this Gram matrix has these eigenvalues (a GP confidence bound). The modules need to compare sizes: of vectors in several norms, of matrices as maps, of quadratic forms in different directions. This primer builds those tools from $2\times2$ examples and says where each is used.
Begin with the first-course refresher if matrix arithmetic or eigenvectors feel rusty. Read Sections 1–5 in order, then use Section 6 before the LMI modules. Sections 7–8 build the structured-matrix and kernel tools; return to their deeper paragraphs when those applications arise.
Each of the eight sections has an Easy, Medium and Hard practice sequence: 24 local exercises, in addition to the mixed exercises at the end. Try the question, use the independent hint only when stuck, and write a complete attempt before opening the worked solution. Afterwards close it and reproduce the reasoning.
Practice menu: Vectors, norms and worst-case directions, Matrices as maps and norm bounds, Eigenvectors, quadratic forms and spectral limits, Definiteness, factors and ellipsoid support, Singular values, least squares and power iteration, Block algebra, Schur complements and updates, Orthogonal maps, projections and Cayley transforms, Functions as vectors, kernels and RKHS norms.
Use the readiness check to decide what to revisit. Research-module links show where the tools will be used; you do not need to read those modules while learning the definitions.
1. Vectors, Inner Products & Norms
A first course measures length by $\sqrt{x_1^2+\dots+x_n^2}$. The modules need several notions of size, inequalities that convert between them, and distances between points and sets.
First-course refresher: what a matrix calculation means
A vector is a list of coordinates. A matrix combines them by linear rules. Recover the following operations before learning the new norms; each calculation below has a direct substitution check.
Shapes: an $m\times n$ matrix has m rows and n columns and maps a column vector with n entries to one with m entries. For $A=\begin{bmatrix}1&2\\0&1\end{bmatrix}$ and $x=(1,2)^\top$, each output is one row dotted with x:
Products: AB means apply B first, then A; the inner dimensions must agree. With $B=\begin{bmatrix}2&0\\1&3\end{bmatrix}$, the first column of AB is A times $(2,1)^\top$ and the second is A times $(0,3)^\top$. Therefore
These differ: matrix products generally cannot be reordered. A transpose swaps rows and columns, so $A^\top=\begin{bmatrix}1&0\\2&1\end{bmatrix}$ and $(AB)^\top=B^\top A^\top$. The reversed order makes the shapes line up. A superscript $\top$ means transpose; an integer superscript such as $A^2=AA$ means a power.
Solve: $Ax=b$ with A above and $b=(5,2)^\top$ means $x_1+2x_2=5$, $x_2=2$. Solve the second equation first, then substitute into the first: $x_2=2$, $x_1=1$. This is backward substitution.
Inverse and determinant: $A^{-1}=\begin{bmatrix}1&-2\\0&1\end{bmatrix}$ undoes A because direct multiplication gives $A^{-1}A=AA^{-1}=I$. A square matrix has an inverse exactly when its determinant is nonzero. For $\begin{bmatrix}a&b\\c&d\end{bmatrix}$, the determinant is $ad-bc$; here it is $1$. Solving a system is usually better than explicitly computing its inverse.
Rank and null space: for $R=\begin{bmatrix}1&2\\2&4\end{bmatrix}$, the second row is twice the first, so there is only one independent equation: rank 1. The null space consists of all x with Rx=0, equivalently $x_1+2x_2=0$. Thus $x=t(-2,1)^\top$ for any real t. R loses this direction and has no inverse. Its range consists of multiples of $(1,2)^\top$; hence Rx=b is solvable exactly for such b.
Invariant direction: an eigenvector is a nonzero v with $Mv=\lambda v$. For $M=\begin{bmatrix}2&1\\1&2\end{bmatrix}$, multiplication gives $M(1,1)^\top=3(1,1)^\top$ and $M(1,-1)^\top=(1,-1)^\top$. The matrix scales these directions by eigenvalues 3 and 1.
Finding the values: a nonzero solution of $(M-\lambda I)v=0$ requires $\det(M-\lambda I)=0$. Here $(2-\lambda)^2-1=(1-\lambda)(3-\lambda)=0$. After finding an eigenvalue, solve its homogeneous equations to get the eigenvectors.
Perpendicular and unit: $(1,1)^\top(1,-1)=1-1=0$, so these vectors are orthogonal. Each has length $\sqrt2$, so dividing by $\sqrt2$ makes them orthonormal (unit length and perpendicular). Section 3 explains why a real symmetric matrix always has a complete basis of this kind.
Check before continuing: multiply A by $(2,-1)^\top$ to obtain $(0,-1)^\top$, solve $Ax=(4,1)^\top$ to obtain $(2,1)^\top$, and verify the eigenvector equations above. If the steps are clear, continue to the inner product; fluency returns with the local Easy exercises.
1.1 Inner products and the Cauchy–Schwarz inequality
Intuition and example. In the plane $x^\top y=\|x\|\,\|y\|\cos\theta$: the inner product measures alignment. For $x=(1,2)$, $y=(3,-1)$: $x^\top y=1$, $\|x\|=\sqrt5$, $\|y\|=\sqrt{10}$, $\theta\approx81.9^\circ$. With $M=\mathrm{diag}(1,4)$ (coordinate 2 counts double): $\langle x,y\rangle_M=3-8=-5$, $\|x\|_M=\sqrt{17}$, $\|y\|_M=\sqrt{13}$, an obtuse angle. Which vectors are long or perpendicular depends on the inner product.
Proof. If $y=0$ both sides are $0$. Otherwise, for every real $t$, $0\le\|x-ty\|^2=\|x\|^2-2t\langle x,y\rangle+t^2\|y\|^2$. This parabola in $t$ is smallest at $t^\star=\langle x,y\rangle/\|y\|^2$, where it equals $\|x\|^2-\langle x,y\rangle^2/\|y\|^2\ge0$. Equality forces $x=t^\star y$. $\square$ Only (i)–(iii) were used, so it holds for weighted inner products and for functions (Section 8).
Uses. $|a^\top d|\le\|a\|\bar d$ for a disturbance with $\|d\|\le\bar d$, and $\max_{\|u\|\le u_{\max}}b^\top u=u_{\max}\|b\|$. A logit difference is $(e_y-e_j)^\top f$ with $\|e_y-e_j\|=\sqrt2$, so an $L$-Lipschitz $f$ moves the margin by at most $\sqrt2L\|\delta\|$ (the $\sqrt2$ of Module 12's certified radius). For $H\succ0$, $u^\top H^{-1}v$ is an inner product, and for CPO's $q=g^\top H^{-1}g$, $r=g^\top H^{-1}b$, $s=b^\top H^{-1}b$ Cauchy–Schwarz reads $qs\ge r^2$.
1.2 Norms and their unit balls
Example. $x=(3,-4)$: $\|x\|_1=7$, $\|x\|_2=5$, $\|x\|_\infty=4$. The unit balls are a diamond, a disc and a square, nested as $\{\|x\|_1\le1\}\subseteq\{\|x\|_2\le1\}\subseteq\{\|x\|_\infty\le1\}$; all are convex and symmetric.
Triangle inequality for $\ell_2$ from Cauchy–Schwarz: $\|x+y\|^2=\|x\|^2+2x^\top y+\|y\|^2\le(\|x\|+\|y\|)^2$. The reverse triangle inequality $\big|\,\|x\|-\|y\|\,\big|\le\|x-y\|$ follows from $\|x\|\le\|x-y\|+\|y\|$ and symmetry: every norm is 1-Lipschitz. Stacked vectors $z=(x,u)$: $\|z\|_2^2=\|x\|_2^2+\|u\|_2^2$, $\|z\|_1=\|x\|_1+\|u\|_1$, $\|z\|_\infty=\max\{\|x\|_\infty,\|u\|_\infty\}$. A punctured ball $\{u:0\lt\|u\|_2\le1\}$ excludes the centre, where $u/\|u\|_2$ is undefined.
1.3 Hölder's inequality and dual norms
Proof of the $(1,\infty)$ case (used in Module 9): $|\sum_iu_iv_i|\le\sum_i|u_i||v_i|\le\max_j|v_j|\sum_i|u_i|$. The general case follows from Young's inequality $ab\le a^p/p+b^q/q$ (see Further Reading). Example: $w=(2,-1,3)$, $\varepsilon=0.1$: $w^\top\delta$ ranges over $\pm0.6$ on the $\ell_\infty$ ball, $\pm0.374$ on the $\ell_2$ ball, $\pm0.3$ on the $\ell_1$ ball. Since the box $[-1,1]^n$ is the $\ell_\infty$ unit ball, the hyperplane $w^\top a=b$ meets it iff $|b|\le\|w\|_1$.
1.4 Norm equivalence: the dimension factors
Proof. $\max_ix_i^2\le\sum_ix_i^2\le(\sum_i|x_i|)^2$ (cross terms are $\ge0$); $\sum_i|x_i|\cdot1\le\|x\|_2\|\mathbf 1\|_2$ by Cauchy–Schwarz; $\sum_ix_i^2\le n\max_ix_i^2$. $\square$ E.g. $x=(3,-4,12)$: $12\le13\le19\le13\sqrt3\approx22.5$.
Balls and certificates. $\{\|\delta\|_\infty\le\varepsilon/\sqrt n\}\subseteq\{\|\delta\|_2\le\varepsilon\}\subseteq\{\|\delta\|_\infty\le\varepsilon\}$, so an $\ell_2$ certificate of radius $\varepsilon$ certifies only the $\ell_\infty$ radius $\varepsilon/\sqrt n$: on MNIST ($\sqrt{784}=28$) an $\ell_2$ radius $1.58$ gives $0.056$. Lipschitz constants convert likewise, $\|f(x)-f(y)\|_\infty\le\|f(x)-f(y)\|_2\le L\|x-y\|_2\le L\sqrt n\|x-y\|_\infty$: changing the input norm costs a factor in the input dimension $n$, changing the output norm one in the output dimension $m$.
Covering numbers. A cube of side $s$ lies in the $\ell_2$ ball of radius $s\sqrt d/2$ about its centre. Cutting $[0,1]^d$ into $m^d$ cubes with $m=\lceil\sqrt d/(2\tau)\rceil$ covers it by $m^d$ balls of radius $\tau$; their centres form a $\tau$-net, and the fewest balls that suffice is the covering number $M(\tau,[0,1]^d)$. For $\tau=0.1$: $64$ balls in $d=2$, about $1.1\times10^{12}$ in $d=10$. If an $L$-Lipschitz function has margin $m_0$ at every net point, its margin is at least $m_0-L\tau$ everywhere (Primer B).
1.5 Metrics, balls and distances to sets
Examples. $\mathrm{dist}(x,\{x_1\le0\})=\max\{x_1,0\}$; for the unit disc, $\max\{\|x\|_2-1,0\}$. The $\ell_\infty$ ball $\{\|x-x_0\|_\infty\le\varepsilon\}$ is the box $|x_i-x_{0,i}|\le\varepsilon$, handled coordinate by coordinate by interval methods. Shortest-path length on a grid is a metric too. Certified balls: if $g$ is $L$-Lipschitz with $L\gt0$ and $g(z)=c\gt0$, then $g\ge0$ on $B_{c/L}(z)$, since $g(y)\ge c-L\,d(y,z)$; a union of such balls is certified. If $L=0$, the Lipschitz inequality makes $g$ constant on its domain, so the positive value at $z$ certifies the whole domain; no division by zero is needed.
Signed distance and Hausdorff distance. A signed distance to a closed set equals $\mathrm{dist}(x,C)$ on one side of the boundary and $-\mathrm{dist}(x,\text{complement})$ on the other; which side is positive is a declared convention (reachability modules put the safe side positive). It vanishes on the boundary, so "$\ell\gt0$" and "$\ell\ge0$" differ exactly there. The Hausdorff distance $d_H(A,B)=\max\{\sup_{a\in A}\mathrm{dist}(a,B),\sup_{b\in B}\mathrm{dist}(b,A)\}$ compares nonempty compact sets, e.g. $d_H([0,1],[0,2])=1$.
Isometric embeddings. $E:D\to\mathbb R^m$ is isometric if $\|E(x)-E(x')\|=d(x,x')$; e.g. a line $E(t)=x_0+tu$ with $\|u\|=1$. A kernel that depends only on distance, $k=\kappa(d(x,x'))$, is unchanged under such a map; a learned nonlinear embedding is generally not isometric and changes which points count as close.
Practice: Vectors, norms and worst-case directions
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.1a — Easy: Compute a dot product and three lengths
Let $x=(2,-1,2)$ and $y=(1,2,0)$. Find $x^\top y$, $\|x\|_1$, $\|x\|_2$ and $\|x\|_\infty$. Are the vectors perpendicular?
Review: Vectors, norms and worst-case directions
Show hint
Multiply corresponding coordinates for the dot product. Norms use absolute values, squares or the largest absolute coordinate.
Show worked solution
Dot product: $x^\top y=2(1)+(-1)(2)+2(0)=0$. Both vectors are nonzero, so a zero dot product means perpendicular in the standard Euclidean inner product.
Lengths: $\|x\|_1=2+1+2=5$; $\|x\|_2=\sqrt{4+1+4}=3$; $\|x\|_\infty=2$. The negative coordinate contributes positively to each length.
Check: $2\le3\le5\le3\sqrt3$, as the norm-comparison inequalities require. The norm is a size, whereas the dot product also captures direction.
Exercise A.1b — Medium: Find the worst perturbation in two balls
For $w=(3,-4)$, maximise $w^\top\delta$ subject first to $\|\delta\|_\infty\le0.2$ and then to $\|\delta\|_2\le0.2$. Give a maximiser in each case and verify it.
Review: Vectors, norms and worst-case directions
Show hint
For a box choose each sign separately. For the Euclidean ball align $\delta$ with $w$.
Show worked solution
Box upper bound: $3\delta_1-4\delta_2\le3|\delta_1|+4|\delta_2|\le7(0.2)=1.4$. Taking $\delta=(0.2,-0.2)$ is feasible and attains $0.6+0.8=1.4$.
Euclidean upper bound: Cauchy–Schwarz gives $w^\top\delta\le\|w\|_2\|\delta\|_2=5(0.2)=1$. Take $\delta=0.2w/5=(0.12,-0.16)$. Its norm is $\sqrt{0.0144+0.0256}=0.2$, and the objective is $0.36+0.64=1$.
Interpret: the box includes its corners, whose Euclidean lengths exceed $0.2$. The larger maximum is consistent with the larger feasible region; using the same numerical radius in two norms does not describe the same perturbations.
Exercise A.1c — Hard: Prove that distance cannot change too fast
Let $C$ be a nonempty closed subset of $\mathbb R^n$. Prove $|\operatorname{dist}(x,C)-\operatorname{dist}(y,C)|\le\|x-y\|$. Compute the distance from $(3,4)$ to the closed unit disc, and bound its change after a displacement of Euclidean length at most $0.1$.
Review: Vectors, norms and worst-case directions
Show hint
Choose a closest point in $C$ to $y$, apply the triangle inequality, then interchange $x$ and $y$. A nearest point exists for a closed nonempty set in finite dimensions.
Show worked solution
One direction: let $c_y\in C$ minimise distance to $y$. Then $\operatorname{dist}(x,C)\le\|x-c_y\|\le\|x-y\|+\|y-c_y\|=\|x-y\|+\operatorname{dist}(y,C)$.
Symmetry: exchanging $x$ and $y$ bounds the opposite difference. Combining the two inequalities proves the absolute-value bound. The argument also works without closedness using points within any positive tolerance of the infimum.
Disc: $\|(3,4)\|_2=5$. For any $c$ with $\|c\|\le1$, reverse triangle gives $\|(3,4)-c\|\ge5-1=4$. The radial point $c=(3/5,4/5)$ attains it, so the distance is $4$.
Perturbation: the proved inequality puts the new distance in $[3.9,4.1]$. This is a guarantee for every displacement of length at most $0.1$, independent of its direction.
2. Matrix Norms & Operator Norms
A matrix is a map $x\mapsto Ax$; its most useful size is the largest factor by which it stretches a vector, i.e. the Lipschitz constant of the map.
Proofs. $|(Ax)_i|\le\sum_j|a_{ij}|\,\|x\|_\infty$, attained by $x_j=\mathrm{sign}(a_{i^\star j})$ for the worst row $i^\star$. $\|Ax\|_1\le\sum_j|x_j|\sum_i|a_{ij}|$, attained at $x=e_{j^\star}$. Each output coordinate $a_{i,:}x$ is bounded by $\|a_{i,:}\|_q\|x\|_p$ (Hölder, attainable). $\square$ Running example $A=\begin{bmatrix}2 & 2\\ -1 & 1\end{bmatrix}$: $\|A\|_1=3$, $\|A\|_\infty=4$ (at $x=(1,1)$), $\|A\|_{1\to\infty}=2$, $\|A\|_{2\to\infty}=\sqrt8$, $\|A\|_2=2\sqrt2\approx2.83$: the longest semi-axis of the ellipse $A$ makes of the unit circle (Section 5, explorer).
Examples. A column-stochastic $P$ (entries $\ge0$, columns summing to $1$) has $\|P\|_1=1$; for $0\le\gamma\lt1$, $G=(I-\gamma P)^{-1}=\sum_k\gamma^kP^k\ge0$ and $\mathbf 1^\top G=\mathbf 1^\top/(1-\gamma)$, so $\|G\|_1=1/(1-\gamma)$ exactly; for a substochastic (transient) chain $(I-P)^{-1}=\sum_tP^t$ counts expected visits. For $K\succeq0$ with $\|K\|\lt\lambda$: $(K+\lambda I)^{-1}=\lambda^{-1}I-\lambda^{-2}K+\lambda^{-3}K^2-\dots$, with remainder after the $\lambda^{-2}$ term of norm $\le\lambda^{-1}(\|K\|/\lambda)^2/(1-\|K\|/\lambda)=O(\lambda^{-3})$.
The image of a box is a zonotope. $W$ maps $\{\|\delta\|_\infty\le\varepsilon\}$ to a sum of segments $\varepsilon[-w_j,w_j]$ over its columns (a parallelogram for invertible $2\times2$ $W$). The tightest enclosing box has half-widths $\varepsilon\|w_{i,:}\|_1$, which is what interval bound propagation keeps: for $W=\begin{bmatrix}1 & 1\\ 1 & -1\end{bmatrix}$, $\varepsilon=1$, the image is the square with corners $(\pm2,0),(0,\pm2)$, area $8$, inside the box $[-2,2]^2$ of area $16$.
Practice: Matrices as maps and norm bounds
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.2a — Easy: Do not interchange row and column sums
For $A=\begin{bmatrix}1&-2\\0&3\end{bmatrix}$, compute $\|A\|_1$, $\|A\|_\infty$ and $\|A\|_F$. Verify the 1-norm bound at $x=(0,1)$.
Review: Matrices as maps and norm bounds
Show hint
Induced 1-norm uses absolute column sums; induced infinity-norm uses absolute row sums.
Show worked solution
Column sums: $1+0=1$ and $2+3=5$, so $\|A\|_1=5$. Row sums: $1+2=3$ and $0+3=3$, so $\|A\|_\infty=3$.
Frobenius: square every entry and add: $\|A\|_F=\sqrt{1+4+0+9}=\sqrt{14}$. This counts the entries as one long vector; it is a different norm from the two induced norms.
Attainment: $\|x\|_1=1$ and $Ax=(-2,3)$ has 1-norm $5$. Thus $\|Ax\|_1\le5\|x\|_1$ is tight here. Negative entries must be replaced by absolute values when summing columns.
Exercise A.2b — Medium: Compare a product bound with the actual product
Let $A=\operatorname{diag}(3,1/2)$ and $B=\operatorname{diag}(1/2,3)$. Compute their spectral norms, $AB$, and $\|AB\|_2$. Explain the gap from $\|A\|_2\|B\|_2$.
Review: Matrices as maps and norm bounds
Show hint
A diagonal matrix stretches each coordinate separately. Its spectral norm is the largest absolute diagonal entry.
Show worked solution
Individual stretches: $\|A\|_2=\|B\|_2=3$, hence the product theorem gives $\|AB\|_2\le9$.
Actual composition: multiply corresponding diagonal entries to obtain $AB=\operatorname{diag}(3/2,3/2)=(3/2)I$. Therefore $\|ABx\|_2=(3/2)\|x\|_2$ for every $x$, and $\|AB\|_2=1.5$.
Reason for the gap: B stretches the second coordinate most, but A shrinks that coordinate by $1/2$. The two largest individual stretches do not align through the composition. Submultiplicativity gives a valid upper bound, with no promise of equality.
Exercise A.2c — Hard: Bound a truncated matrix geometric series
For $A=\operatorname{diag}(1/2,1/4)$, compute $(I-A)^{-1}$. Let $S_T=\sum_{k=0}^{T-1}A^k$. Find the exact spectral norm of $(I-A)^{-1}-S_T$ and the smallest $T$ making it at most $0.01$.
Review: Matrices as maps and norm bounds
Show hint
Apply the scalar geometric-tail formula to each diagonal entry, then take the larger tail.
Show worked solution
Inverse: $I-A=\operatorname{diag}(1/2,3/4)$, so $(I-A)^{-1}=\operatorname{diag}(2,4/3)$. The Neumann-series hypothesis holds because $\|A\|_2=1/2\lt1$.
Remainder: summing each diagonal series leaves $\operatorname{diag}(2(1/2)^T,(4/3)(1/4)^T)$. For $T\ge0$ the first entry is at least the second, because their ratio is $(3/2)2^T\ge1$. Thus the exact norm is $2^{1-T}$.
Threshold: require $2^{1-T}\le0.01$, equivalently $2^T\ge200$. Since $2^7=128$ and $2^8=256$, the smallest integer is $T=8$. The remainders are $0.015625$ at $T=7$ and $0.0078125$ at $T=8$.
Check the indexing: eight terms means powers $A^0$ through $A^7$; the first omitted term is $A^8$. Here the general norm tail bound is attained by the first coordinate.
3. Symmetric Matrices & the Spectral Theorem
In a first course eigenvalues can be complex (a rotation has no real ones) and eigenvectors can be missing (the shear $\begin{bmatrix}1 & 1\\ 0 & 1\end{bmatrix}$ has one direction). Symmetric matrices, $A=A^\top$, have neither problem, and every certificate matrix in the modules is symmetric.
Two short proofs. Real eigenvalues: if $Av=\lambda v$, $v\ne0$ complex, then $v^*Av=\lambda v^*v$; the number $v^*Av$ equals its own conjugate $v^*A^\top v=v^*Av$, so it is real, hence so is $\lambda$ (and the real singular matrix $A-\lambda I$ has a real null vector). Orthogonality: if $Av=\lambda v$, $Aw=\mu w$, $\lambda\ne\mu$, then $\lambda v^\top w=(Av)^\top w=v^\top Aw=\mu v^\top w$, so $v^\top w=0$.
Example. $A=\begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}$: $(2-\lambda)^2-1=0$ gives $\lambda_1=3$, $\lambda_2=1$, $q_1=(1,1)/\sqrt2$, $q_2=(1,-1)/\sqrt2$, and $3q_1q_1^\top+q_2q_2^\top=\tfrac32\begin{bmatrix}1 & 1\\ 1 & 1\end{bmatrix}+\tfrac12\begin{bmatrix}1 & -1\\ -1 & 1\end{bmatrix}=A$. In words: a symmetric matrix is a pure stretch along perpendicular axes (here by $3$ along the diagonal, by $1$ across it), with no rotation or shear.
Functions of a symmetric matrix. $f(A)=Qf(\Lambda)Q^\top=\sum_if(\lambda_i)q_iq_i^\top$ agrees with powers, polynomials and $A^{-1}$ (all $\lambda_i\ne0$), gives $(A+\eta I)^{-1}=\sum_i(\lambda_i+\eta)^{-1}q_iq_i^\top$ (all $\lambda_i+\eta\ne0$) and square roots (Section 4). Functions of one $A$ share its eigenvectors, so comparing them reduces to comparing scalars eigenvalue by eigenvalue: for $K\succeq0$ and $\eta\gt0$, $K(K+\eta I)^{-1}$ has eigenvalues $\lambda_i/(\lambda_i+\eta)\in[0,1)$.
Proof. With $y=Q^\top x$ ($\|y\|=\|x\|$): $x^\top Ax=\sum_i\lambda_iy_i^2\le\lambda_{\max}\|x\|^2$, and similarly from below. $\square$ For the example, $x=(1,0)$ gives $2$ and $x=(1,1)/\sqrt2$ gives $3=\lambda_{\max}$. A Lyapunov function $x^\top Px$ is thus squeezed between $\lambda_{\min}(P)\|x\|^2$ and $\lambda_{\max}(P)\|x\|^2$.
Complex matrices. $M$ is Hermitian if $M^*=M$. Everything above holds with $^\top$ replaced by $^*$: real eigenvalues, $M=U\Lambda U^*$ with $U$ unitary ($U^*U=I$), and $v^*Mv$ real for all complex $v$. Example: $\begin{bmatrix}2 & i\\ -i & 2\end{bmatrix}$ has eigenvalues $3,1$, and $v=(1,i)$ gives $v^*Mv=2$. Hermitian semidefiniteness ($v^*Mv\ge0$ for all $v\in\mathbb C^n$) is the complex version of Section 4.
The Jacobi method repeatedly applies a plane rotation $J$ in coordinates $(p,q)$, $A\leftarrow J^\top AJ$, with $\tan2\theta=2a_{pq}/(a_{pp}-a_{qq})$ zeroing the $(p,q)$ entry. Each step keeps the eigenvalues and removes $2a_{pq}^2$ from the off-diagonal sum of squares $\mathrm{off}=\sum_{i\ne j}a_{ij}^2$. Convergence needs a pivot rule (repeatedly choosing an entry that is already zero changes nothing): if $(p,q)$ is the off-diagonal entry of largest magnitude, $a_{pq}^2\ge\mathrm{off}/(n(n-1))$, so each step shrinks $\mathrm{off}$ by at least the factor $1-2/(n(n-1))$ and $A\to\mathrm{diag}(\lambda_i)$ (cyclic sweeps over all pairs also converge); the rotations multiply to $Q$. For $\begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}$ one $45^\circ$ rotation finishes.
In double precision (unit roundoff $\approx1.1\times10^{-16}$) computed eigenvalues carry errors of order $10^{-16}\|A\|$: a computed $\lambda_{\min}=10^{-15}$ does not prove $A\succeq0$. Rigorous checks test a margin ($A-\tau I\succ0$ with $\tau$ above an error bound) or use exact or interval arithmetic.
Practice: Eigenvectors, quadratic forms and spectral limits
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.3a — Easy: Verify an orthonormal eigenbasis
Let $A=\begin{bmatrix}3&1\\1&3\end{bmatrix}$. Verify that $q_+=(1,1)/\sqrt2$ and $q_-=(1,-1)/\sqrt2$ are orthonormal eigenvectors. State their eigenvalues.
Review: Eigenvectors, quadratic forms and spectral limits
Show hint
You can verify a proposed eigenvector directly by multiplying, without solving a determinant.
Show worked solution
First direction: $A(1,1)^\top=(4,4)^\top=4(1,1)^\top$, so $Aq_+=4q_+$. Second: $A(1,-1)^\top=(2,-2)^\top=2(1,-1)^\top$, so $Aq_-=2q_-$.
Normalisation: each original vector has squared length $2$, so dividing by $\sqrt2$ makes length $1$. Their dot product is $(1-1)/2=0$. Thus they are orthonormal.
Decomposition: $A=4q_+q_+^\top+2q_-q_-^\top$. Multiplying the outer products gives $\tfrac42\begin{bmatrix}1&1\\1&1\end{bmatrix}+\tfrac22\begin{bmatrix}1&-1\\-1&1\end{bmatrix}=A$. These are stretches along perpendicular axes.
Exercise A.3b — Medium: Use the Rayleigh bound and recognise equality
For the matrix of the Easy exercise and $x=(1,2)$, compute $x^\top Ax$ and the Rayleigh quotient. Check the eigenvalue bounds, then give directions attaining both bounds.
Review: Eigenvectors, quadratic forms and spectral limits
Show hint
The Rayleigh quotient divides the quadratic form by $x^\top x$, so you need not normalise $x$ explicitly.
Show worked solution
Multiply: $Ax=(5,7)$ and $x^\top Ax=1(5)+2(7)=19$. Also $x^\top x=1+4=5$, so the quotient is $19/5=3.8$.
Bounds: the extreme eigenvalues are $2$ and $4$, hence $2\|x\|^2\le x^\top Ax\le4\|x\|^2$. Numerically $10\le19\le20$, or $2\le3.8\le4$ after division by $5$.
Equality: any nonzero multiple of $(1,-1)$ has quotient $2$, and any nonzero multiple of $(1,1)$ has quotient $4$. The inequality is strict at $(1,2)$ because it has nonzero components in both eigendirections.
Exercise A.3c — Hard: Positive eigenvalues can hide a negative quadratic form
For $N=\begin{bmatrix}1&4\\0&1\end{bmatrix}$, compute its eigenvalues and $x^\top Nx$ at $x=(1,-1)$. Find the symmetric part $S=(N+N^\top)/2$ and its eigenvalues. Explain why the spectral theorem cannot be applied to N.
Review: Eigenvectors, quadratic forms and spectral limits
Show hint
For an upper triangular matrix, the eigenvalues are on the diagonal. A real quadratic form uses only the symmetric part.
Show worked solution
Eigenvalues of N: $\det(N-\lambda I)=(1-\lambda)^2$, so both are $1$. However $Nx=(-3,-1)$ and $x^\top Nx=-3+1=-2$.
Symmetric part: $S=\begin{bmatrix}1&2\\2&1\end{bmatrix}$. Its eigenvalues are $3$ along $(1,1)$ and $-1$ along $(1,-1)$. The negative form at $x$ is $-1\cdot\|x\|^2=-2$.
Why this happens: writing $N=S+K$ with $K^\top=-K$ gives $x^\top Kx=-(x^\top Kx)$ after transposing the scalar, so this term is zero. Thus $x^\top Nx=x^\top Sx$.
Assumption audit: N is not symmetric. Its positive eigenvalues do not imply nonnegative quadratic forms or an orthonormal eigenbasis. The positivity tests stated for symmetric matrices must be applied to S here.
4. Positive (Semi)Definite Matrices & Quadratic Forms
A quadratic form is $q(x)=x^\top Px=\sum_{ij}p_{ij}x_ix_j$; only the symmetric part of $P$ matters, so take $P\in\mathbb S^n$. In the plane, if $p_{11}\gt0$, completing the square gives $$q(x)=p_{11}\Big(x_1+\frac{p_{12}}{p_{11}}x_2\Big)^2+\Big(p_{22}-\frac{p_{12}^2}{p_{11}}\Big)x_2^2,$$ so $q\gt0$ for all $x\ne0$ iff $p_{11}\gt0$ and $p_{11}p_{22}-p_{12}^2\gt0$. The second coefficient is our first Schur complement (Section 6).
Examples. $\begin{bmatrix}1 & 2\\ 2 & 1\end{bmatrix}$ has positive entries, yet $x=(1,-1)$ gives $-2$: indefinite. $\begin{bmatrix}1 & -1\\ -1 & 1\end{bmatrix}$ gives $(x_1-x_2)^2\ge0$: PSD and singular. For diagonal matrices the notions agree: $T=\mathrm{diag}(\lambda_i)\succeq0$ iff every $\lambda_i\ge0$. The level sets $q=1$ are ellipses (PD), parallel lines (singular PSD) or hyperbolas (indefinite): see the explorer.
$P\succeq0$ $\iff$ all eigenvalues $\ge0$ $\iff$ all principal minors $\ge0$ (so $p_{ii}\ge0$) $\iff$ $P=R^\top R$ for some $R$.
Minors. A principal minor is $\det P[I,I]$, the determinant of the submatrix that keeps the same index set $I$ of rows and columns; the leading ones use $I=\{1,\dots,k\}$. A $3\times3$ matrix has $3$ leading principal minors ($p_{11}$, the top-left $2\times2$ determinant, $\det P$) but $7$ nonempty principal minors (also $p_{22}$, $p_{33}$ and the determinants for $I=\{1,3\}$ and $\{2,3\}$).
Proof of (a), (d). With $y=Q^\top x$, $x^\top Px=\sum_i\lambda_iy_i^2$: positive for all $y\ne0$ iff all $\lambda_i\gt0$ (take $x=q_i$). If $P=R^\top R$, $x^\top Px=\|Rx\|^2$, positive for $x\ne0$ iff $R$ has independent columns; conversely take $R=\Lambda^{1/2}Q^\top$. $\square$ Module 5's Gram matrix $K=\begin{bmatrix}1 & 0 & 0\\ 0 & 1 & 2\\ 0 & 2 & 5\end{bmatrix}$ has leading minors $1,1,1$, so $K\succ0$ (eigenvalues $3\mp2\sqrt2$, $1$).
4.1 Gram matrices, outer products and regularisation
For any $R$, $R^\top R\succeq0$ and $RR^\top\succeq0$ ($x^\top R^\top Rx=\|Rx\|^2$); $R^\top R\succ0$ iff $R$ has independent columns. For $\epsilon\gt0$, $x^\top(\epsilon I+R^\top R)x=\epsilon\|x\|^2+\|Rx\|^2\gt0$ ($x\ne0$), so $\epsilon I+R^\top R\succ0$ is invertible: a neural certificate uses this to get $\|(\epsilon I+R^\top R)(\xi-\xi^\ast)\|_1\gt0$ for $\xi\ne\xi^\ast$. Likewise $K+\lambda I\succ0$ for a kernel matrix $K\succeq0$ and $\lambda\gt0$, so a regularised GP never fails Cholesky in exact arithmetic. The outer product $aa^\top$ is PSD, of rank one when $a\ne0$ and $0$ when $a=0$ ($v^\top aa^\top v=(a^\top v)^2$; for $a\ne0$, eigenvalue $\|a\|^2$ on $a$, $0$ on $a^\perp$), and adding $\beta aa^\top$, $\beta\ge0$, is a PSD increase: the quadratic form grows by $\beta(a^\top v)^2$ and decreases nowhere (whether a damped loop then converges faster is a separate question).
4.2 The Loewner order, congruence and the PSD cone
Meaning and facts. $\mathrm{Var}(u^\top X)=u^\top\Sigma u$, so $\Sigma_1\succeq\Sigma_2$ means at least as much variance in every direction (a "consistent" uncertainty estimate never under-reports). $\lambda_{\min}(A)I\preceq A\preceq\lambda_{\max}(A)I$; $A\succeq B$ implies $\lambda_i(A)\ge\lambda_i(B)$ for each ordered eigenvalue (Courant–Fischer) and $\mathrm{tr}A\ge\mathrm{tr}B$; and, for $\gamma\ge0$, $\|W\|_2\le\gamma\iff W^\top W\preceq\gamma^2I$ (both say $\|Wx\|^2\le\gamma^2\|x\|^2$; squaring loses the sign of $\gamma$).
Example. $T=\begin{bmatrix}1 & -2\\ 0 & 1\end{bmatrix}$ turns $M=\begin{bmatrix}1 & 2\\ 2 & 1\end{bmatrix}$ into $T^\top MT=\mathrm{diag}(1,-3)$: it completed the square, changed the eigenvalues ($3,-1$) but not their signs (Sylvester's law of inertia). The PSD cone: $A,B\succeq0$, $\alpha,\beta\ge0\Rightarrow\alpha A+\beta B\succeq0$, so PSD matrices form a convex cone (Primer B) with the PD matrices as interior; for $2\times2$, $\begin{bmatrix}a & b\\ b & c\end{bmatrix}\succeq0\iff a,c\ge0,\ ac\ge b^2$. A linear matrix inequality $F_0+\sum_iz_iF_i\succeq0$ is a convex constraint on $z$ (Module 2).
4.3 Square roots, weighted norms and ellipsoids
Example. $\begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}^{1/2}=\sqrt3\,q_1q_1^\top+q_2q_2^\top=\tfrac12\begin{bmatrix}\sqrt3+1 & \sqrt3-1\\ \sqrt3-1 & \sqrt3+1\end{bmatrix}\approx\begin{bmatrix}1.366 & 0.366\\ 0.366 & 1.366\end{bmatrix}$. Weighted norms. For $H\succ0$, $\|x\|_H=\sqrt{x^\top Hx}=\|H^{1/2}x\|$, and $|g^\top x|=|(H^{-1/2}g)^\top(H^{1/2}x)|\le\|g\|_{H^{-1}}\|x\|_H$, with equality for $x\propto H^{-1}g$. Steps live in the $H$-norm, gradients in the $H^{-1}$-norm: $\max\{g^\top x:\tfrac12x^\top Hx\le\delta\}=\sqrt{2\delta\,g^\top H^{-1}g}$ for $\delta\ge0$, at $x^\star\propto H^{-1}g$ if $g\ne0$ (the natural-gradient step), and $\varphi^\top V^{-1}\varphi$ is a "squared $V^{-1}$-norm". For $a\ne0$ the $H$-norm projection of $u_0$ onto $\{a^\top u\ge b\}$ moves along $H^{-1}a$: $u^\star=u_0+[b-a^\top u_0]_+H^{-1}a/(a^\top H^{-1}a)$, with the positive part $[t]_+=\max\{t,0\}$ (no move if $u_0$ is already feasible). For $a=0$ the set is all of $\mathbb R^n$ if $b\le0$ and empty if $b\gt0$. A merely PSD $H$ may be singular; the damped $H+\epsilon I\succ0$ is not.
Inversion reverses the order. If $A\succeq B\succ0$, congruence gives $B^{-1/2}AB^{-1/2}\succeq I$; its eigenvalues are $\ge1$, those of its inverse $B^{1/2}A^{-1}B^{1/2}$ are $\le1$, and congruence again gives $A^{-1}\preceq B^{-1}$.
Generalised eigenvalues: for $A\succeq0$, $M\succ0$, the nonsymmetric $AM^{-1}=M^{1/2}(M^{-1/2}AM^{-1/2})M^{-1/2}$ is similar to a symmetric PSD matrix, so its eigenvalues are real and $\ge0$, $\lambda_{\max}(AM^{-1})=\max_{x\ne0}x^\top Ax/x^\top Mx$, and for $F\ge0$: $M-FA\succeq0\iff F\lambda_{\max}(AM^{-1})\le1$.
Reading off sizes ($c=0$). Cauchy–Schwarz with $y=P^{1/2}x$ gives $\max_{\mathcal E}a^\top x=\sqrt{a^\top Sa}$, so the enclosing box has half-widths $\sqrt{S_{ii}}$ and the farthest point lies at $1/\sqrt{\lambda_{\min}(P)}=\sqrt{\lambda_{\max}(S)}$. For $P=\begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}$: semi-axes $1/\sqrt3$ along $(1,1)$ and $1$ along $(1,-1)$, area $\pi/\sqrt3\approx1.81$. The slice $x_2=0$ has half-width $1/\sqrt{p_{11}}\approx0.707$, the projection (shadow) on $x_1$ has $\sqrt{S_{11}}=\sqrt{2/3}\approx0.816$: minimising over $x_2$ leaves the Schur complement $p_{11}-p_{12}^2/p_{22}=1.5$. Slices underestimate projections unless $p_{12}=0$.
4.4 Cholesky factorisation and linear solves
Worked example. $P=\begin{bmatrix}4 & 2 & -2\\ 2 & 5 & 1\\ -2 & 1 & 3\end{bmatrix}$: $L_{11}=2$, $L_{21}=1$, $L_{31}=-1$, $L_{22}=\sqrt{5-1}=2$, $L_{32}=(1+1)/2=1$, $L_{33}=\sqrt{3-1-1}=1$. To solve $Px=b$, $b=(2,7,5)$, never form $P^{-1}$: solve $Ly=b$ forwards, $y=(1,3,3)$, then $L^\top x=y$ backwards, $x=(2,0,3)$ (each $\approx n^2$ operations). $\log\det P=2\sum_j\log L_{jj}=\log16$.
Setting for Algorithm 1. Given observations $y_i=f(x_i)+\varepsilon_i$ at inputs $x_1,\dots,x_t$ ($y=(y_1,\dots,y_t)$), take a zero-mean GP prior on $f$ with kernel $k$ and noise $\varepsilon_i\sim\mathcal N(0,\sigma_n^2)$, $\sigma_n^2\gt0$, independent of each other and of $f$. Write $K_{ij}=k(x_i,x_j)$ for the prior covariances among the data and $k(x)=(k(x_i,x))_{i\le t}$ for those between the data and a new input $x$. The algorithm returns the posterior mean and variance of the latent function value at $x$; a new noisy observation there has variance $\sigma_t^2(x)+\sigma_n^2$. The probabilistic reading is in Primer C; here it is linear algebra, two triangular solves instead of an inverse.
- Factor $K+\sigma_n^2I=LL^\top$ (it exists because $\sigma_n^2\gt0$).
- $\alpha=L^{-\top}(L^{-1}y)$ by two triangular solves; mean $\mu_t(x)=k(x)^\top\alpha$.
- $v=L^{-1}k(x)$; variance $\sigma_t^2(x)=k(x,x)-v^\top v$; $\log\det(K+\sigma_n^2I)=2\sum_i\log L_{ii}$.
Orientation. NumPy's cholesky returns lower $L$ ($P=LL^\top$), MATLAB's chol upper $R=L^\top$ ($P=R^\top R$). Module 13 writes $F=L^\top L$ with an upper-type $L$; a library's lower factor silently transposes its formulas. Conjugate gradients solve $Hx=g$ for $H\succ0$ using only products $v\mapsto Hv$ (Fisher-vector products), by minimising $\tfrac12x^\top Hx-g^\top x$ over growing subspaces until the residual $r_k=g-Hx_k$ has $\|r_k\|\le\mathrm{tol}\|g\|$; the output exactly solves $Hx=g-r_k$, and the $H$-norm error shrinks at least like $2\big((\sqrt\kappa-1)/(\sqrt\kappa+1)\big)^k$ (Section 5).
Sum-of-squares certificates. If $p(x)=z(x)^\top Qz(x)$ with a vector of monomials $z(x)$ and $Q=\sum_il_il_i^\top\succeq0$, then $p=\sum_i(l_i^\top z)^2\ge0$; e.g. $z=(1,x,x^2)$, $Q=\mathbf 1\mathbf 1^\top$ gives $x^4+2x^3+3x^2+2x+1=(1+x+x^2)^2$. Finding such a $Q$ is an SDP; the test is only sufficient (some nonnegative polynomials are not SOS).
Practice: Definiteness, factors and ellipsoid support
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.4a — Easy: Classify by the quadratic form
Classify $P=\operatorname{diag}(2,0)$ and $Q=\begin{bmatrix}2&3\\3&2\end{bmatrix}$ as positive definite, singular positive semidefinite or indefinite. Supply vectors witnessing any failure of positive definiteness.
Review: Definiteness, factors and ellipsoid support
Show hint
Expand $x^\top Px$. For Q compare $(1,1)$ with $(1,-1)$.
Show worked solution
P: $x^\top Px=2x_1^2\ge0$, so P is PSD. At nonzero $x=(0,1)$ the form is $0$, so P is not PD and is singular.
Q: at $x=(1,1)$, the form is $2+6+2=10\gt0$. At $x=(1,-1)$, it is $2-6+2=-2\lt0$. Since both signs occur, Q is indefinite.
Interpret: all entries of Q are positive, but definiteness asks about every direction, including mixed-sign directions. A single negative value disproves PSD; a single zero at a nonzero vector disproves PD but does not by itself disprove PSD.
Exercise A.4b — Medium: Solve with a Cholesky factor
Factor $P=\begin{bmatrix}4&2\\2&2\end{bmatrix}=LL^\top$ with L lower triangular and positive diagonal. Use two triangular solves to solve $Px=(6,4)^\top$, and compute $\log\det P$.
Review: Definiteness, factors and ellipsoid support
Show hint
Set $L_{11}=\sqrt4$, then obtain $L_{21}$ from the off-diagonal entry and $L_{22}$ from the remaining diagonal.
Show worked solution
Factor: $L_{11}=2$, $L_{21}=2/2=1$, and $L_{22}=\sqrt{2-1^2}=1$, giving $L=\begin{bmatrix}2&0\\1&1\end{bmatrix}$. Positive pivots establish that P is PD.
Forward solve: $Ly=(6,4)^\top$ gives $2y_1=6$, hence $y_1=3$, followed by $y_1+y_2=4$, hence $y_2=1$.
Backward solve: $L^\top x=y$ gives $x_2=1$ and $2x_1+x_2=3$, so $x=(1,1)$. Direct check: $Px=(6,4)^\top$.
Log determinant: $\det P=(\det L)^2=(2\cdot1)^2=4$, so $\log\det P=2(\log2+\log1)=\log4$. No matrix inverse was needed.
Exercise A.4c — Hard: Maximise a linear margin over an ellipsoid
Let $P=\operatorname{diag}(4,1)$ and $\mathcal E=\{x:x^\top Px\le1\}$. Find $\max_{x\in\mathcal E}(x_1+2x_2)$, a maximiser, and the two semi-axis lengths. Derive the maximum rather than only citing the formula.
Review: Definiteness, factors and ellipsoid support
Show hint
Change variables to $u=P^{1/2}x$. The constraint becomes a unit ball and the objective becomes an inner product.
Show worked solution
Coordinates: $u=(2x_1,x_2)$, so $\|u\|_2\le1$ and $x_1+2x_2=(1/2,2)^\top u$. The coefficient vector has norm $\sqrt{1/4+4}=\sqrt{17}/2$.
Upper bound and attainment: Cauchy–Schwarz gives objective at most $\sqrt{17}/2$. Equality holds at $u=(1,4)/\sqrt{17}$, which has unit norm.
Transform back: $x^\star=(1/(2\sqrt{17}),4/\sqrt{17})$. Feasibility check: $4(x_1^\star)^2+(x_2^\star)^2=1/17+16/17=1$. The objective is $1/(2\sqrt{17})+8/\sqrt{17}=\sqrt{17}/2$.
Geometry: $4x_1^2+x_2^2\le1$ has semi-axis lengths $1/2$ and $1$. The maximiser points along $P^{-1}(1,2)^\top$, not generally along the Euclidean vector $(1,2)$.
5. The Singular Value Decomposition
Eigenvalues can be complex and say little about stretching. The SVD exists for every matrix, rectangular or not, and describes exactly how it stretches.
Geometry. Read $U\Sigma V^\top x$ right to left: rotate or reflect by $V^\top$, stretch coordinate $i$ by $\sigma_i$, rotate or reflect by $U$. The unit ball becomes a filled, possibly flat ellipsoid with semi-axes $\sigma_iu_i$ ($i\le r$), and $v_1$ is the most-stretched input direction. For an injective $A$ the unit sphere maps onto the boundary of this ellipsoid within $\mathrm{range}(A)$ (an invertible $2\times2$ matrix turns the circle into an ellipse); if $A$ has a nontrivial null space, the sphere covers the whole filled ellipsoid ($A=\begin{bmatrix}1 & 0\end{bmatrix}$ maps the unit circle onto $[-1,1]$).
Consequences. (1) $\|A\|_2=\sigma_1$, because $\max_{\|x\|=1}\|Ax\|^2=\max_{\|x\|=1}x^\top A^\top Ax=\lambda_{\max}(A^\top A)$ (Rayleigh). Hence $\|A^\top\|_2=\|A\|_2$ and $\|A\|_F^2=\sum_i\sigma_i^2$; for $n\le m$, $\sigma_n=\min_{\|x\|=1}\|Ax\|$. (2) $\mathrm{range}(A)=\mathrm{span}(u_1,\dots,u_r)$ and $\mathrm{null}(A)=\mathrm{span}(v_{r+1},\dots,v_n)$: orthonormal bases of both, e.g. the nullspace basis of elimination arguments. (3) Keeping $k$ terms gives the best rank-$k$ approximation, with spectral error $\sigma_{k+1}$ (Eckart–Young).
5.1 Conditioning and the pseudo-inverse
Why Gram matrices become ill-conditioned. $K^{-1}y=\sum_i(q_i^\top y/\lambda_i)q_i$ amplifies components along small-eigenvalue directions by $1/\lambda_i$. Two inputs $0.01$ apart under a squared-exponential kernel with length scale $1$ give $K=\begin{bmatrix}1 & 0.99995\\ 0.99995 & 1\end{bmatrix}$, eigenvalues $1.99995$ and $5\times10^{-5}$, $\kappa\approx4\times10^4$; adding $\lambda=0.01$ lifts the small one to $0.01005$ and $\kappa\approx200$. Sixty close grid points are far worse.
Range conditions. $b\in\mathrm{range}(A)\iff(I-AA^+)b=0$. Module 2 writes $C^\dagger$ and $(I-CC^\dagger)B^\top=0$ (the columns of $B^\top$ lie in $\mathrm{range}(C)$), Module 9 $G^+$, Module 13 $(A^\top)^+$: the same object. Example: $\begin{bmatrix}1 & 2\\ 2 & 4\end{bmatrix}=5uu^\top$, $u=(1,2)/\sqrt5$, has rank 1 and pseudo-inverse $\tfrac15uu^\top$.
5.2 Power iteration and matrix factors
- Pick a unit $x_0$ (random, so that $v_1^\top x_0\ne0$ almost surely).
- For $k=0,1,\dots$: $x_{k+1}=A^\top Ax_k/\|A^\top Ax_k\|$ (needs $A^\top Ax_k\ne0$); estimate $\hat\sigma_k=\|Ax_k\|$.
Since $\|Ax\|\le\sigma_1$ for every unit $x$, every estimate is a lower bound. If $\sigma_1\gt\sigma_2$ and $v_1^\top x_0\ne0$, the angle to $v_1$ shrinks like $(\sigma_2/\sigma_1)^{2k}$, slowly when $\sigma_2\approx\sigma_1$; if $\sigma_1=\sigma_2\gt0$, there is no single dominant $v_1$; provided $x_0$ has a nonzero projection onto the dominant right-singular subspace, $x_k$ approaches that subspace while $\hat\sigma_k\to\sigma_1$. The step breaks down only if $A^\top Ax_k=0$, i.e. $Ax_k=0$; all iterates after the first lie in $\mathrm{range}(A^\top)=\mathrm{null}(A)^\perp$, so this can only happen at $x_0$, which a random start avoids unless $A=0$. For the walkthrough matrix from $(1,0)$: $2.236,\ 2.765,\ 2.824,\ 2.8282\to2\sqrt2$. Dividing $W$ by such an estimate can leave $\|W/\hat\sigma\|_2\gt1$; guaranteed upper bounds are $\|A\|_F$ and $\sqrt{\|A\|_1\|A\|_\infty}$ ($\sqrt{12}\approx3.46$ here).
Polar factors and factor recovery. $A=(UV^\top)(V\Sigma V^\top)$ splits a square $A$ into an orthogonal factor and a PSD stretch; $UV^\top$ is the orthogonal matrix nearest to $A$ in Frobenius norm, the usual projection back onto orthogonal matrices after a gradient step. To write an invertible nonsymmetric $N$ as $VU^\top$, take $N=\tilde U\tilde\Sigma\tilde V^\top$ and $V=\tilde U\tilde\Sigma^{1/2}$, $U=\tilde V\tilde\Sigma^{1/2}$: both factors are invertible with condition number $\sqrt{\kappa(N)}$ (any $VT$, $UT^{-\top}$ also works; the SVD choice is balanced). Complex matrices have $A=U\Sigma V^*$ with unitary $U,V$, and $\sigma_{\max}(G(e^{j\omega}))$ is the gain of a transfer matrix at frequency $\omega$ (Primer D).
Practice: Singular values, least squares and power iteration
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.5a — Easy: A negative eigenvalue still has positive stretch
For $A=\operatorname{diag}(2,-1)$, give one SVD $A=U\Sigma V^\top$, the singular values, spectral and Frobenius norms, and condition number. What happens to the unit circle?
Review: Singular values, least squares and power iteration
Show hint
Put the sign in an orthogonal factor. Singular values measure lengths and cannot be negative.
Show worked solution
SVD: choose $U=\operatorname{diag}(1,-1)$, $\Sigma=\operatorname{diag}(2,1)$ and $V=I$. Both U and V are orthogonal and their product gives $A$.
Stretches: $A^\top A=\operatorname{diag}(4,1)$, whose eigenvalues have square roots $2$ and $1$. Thus $\|A\|_2=2$, $\|A\|_F=\sqrt{4+1}=\sqrt5$, and $\kappa(A)=2/1=2$.
Geometry: the unit circle becomes an ellipse with semi-axis lengths $2$ and $1$. The second coordinate is reflected, but its length is preserved. The eigenvalues $2,-1$ describe signed invariant directions; the singular values $2,1$ describe unsigned stretches.
Exercise A.5b — Medium: Solve an underdetermined system with minimum length
Let $A=\begin{bmatrix}1&2\end{bmatrix}$ and $b=5$. Compute $A^+$, find $x^\star=A^+b$, and prove it is the minimum Euclidean norm solution of $Ax=5$.
Review: Singular values, least squares and power iteration
Show hint
For a nonzero row, $A^+=A^\top/(AA^\top)$. All other solutions differ by a vector in the null space.
Show worked solution
Pseudo-inverse: $AA^\top=1^2+2^2=5$, so $A^+=(1,2)^\top/5$. Therefore $x^\star=(1,2)$ and $Ax^\star=1+4=5$.
All solutions: the null direction is $n=(-2,1)$ because $An=-2+2=0$. Every solution is $x=x^\star+tn$, $t\in\mathbb R$, since a single independent equation in two variables leaves one free coordinate.
Minimal norm: $(x^\star)^\top n=-2+2=0$, so $\|x\|^2=\|x^\star\|^2+t^2\|n\|^2=5+5t^2\ge5$, with equality only at $t=0$. Hence $A^+b$ is the unique minimum-norm solution, even though the equation has infinitely many solutions.
Exercise A.5c — Hard: A power estimate cannot certify normalisation
Let $A=\operatorname{diag}(3,1)$ and $x_0=(1,1)/\sqrt2$. Compute $\hat\sigma_0=\|Ax_0\|_2$, one power iterate $x_1=A^\top Ax_0/\|A^\top Ax_0\|_2$, and $\hat\sigma_1$. If W is A divided by $\hat\sigma_0$, is $\|W\|_2\le1$? Give a simple guaranteed alternative.
Review: Singular values, least squares and power iteration
Show hint
The largest singular value is $3$. A power estimate evaluates one unit direction and therefore provides a lower bound.
Show worked solution
Initial estimate: $Ax_0=(3,1)/\sqrt2$, so $\hat\sigma_0=\sqrt{(9+1)/2}=\sqrt5\approx2.2361$, below $3$.
One iteration: $A^\top A=\operatorname{diag}(9,1)$, hence $x_1=(9,1)/\sqrt{82}$. Then $Ax_1=(27,1)/\sqrt{82}$ and $\hat\sigma_1=\sqrt{730/82}\approx2.9837$. It is closer, but still below $3$.
Failed certificate: $\|A/\hat\sigma_0\|_2=3/\sqrt5\approx1.3416\gt1$. A lower bound in the denominator does not give the claimed upper bound on the resulting norm.
Guaranteed choices: here the exact value $3$ is known, so division by $3$ gives norm $1$. More generally division by $\|A\|_F=\sqrt{10}$ gives norm at most $1$, since spectral norm never exceeds Frobenius norm. A finite power estimate alone supplies no such guarantee.
6. Block Matrices, Determinants, Trace & log det
6.1 Blocks, stacked vectors and sparsity
Partition into blocks of compatible sizes and multiply blocks like numbers, keeping their order: $\begin{bmatrix}A & B\\ C & D\end{bmatrix}\begin{bmatrix}x\\ u\end{bmatrix}=\begin{bmatrix}Ax+Bu\\ Cx+Du\end{bmatrix}$ (a state-space model in one matrix), and $\begin{bmatrix}x\\ y\end{bmatrix}^\top\begin{bmatrix}A & B\\ B^\top & C\end{bmatrix}\begin{bmatrix}x\\ y\end{bmatrix}=x^\top Ax+2x^\top By+y^\top Cy$. $\mathrm{blkdiag}(M_1,\dots,M_k)\succeq0$ iff every $M_i\succeq0$, which is how several LMIs become one. A selection matrix $E_i=[0\ \cdots\ I\ \cdots\ 0]$ extracts block $i$ of a stacked vector, $E_iz=z_i$, and $E_i^\top z_i$ zero-pads it back. Blocks are often named by the variables they couple ($P_{x,u}$: rows of $x$, columns of $u$); zero blocks are left blank.
Sparsity. If $L$ is block-bidiagonal (blocks only on the diagonal and first subdiagonal), $(LL^\top)_{ij}=\sum_kL_{ik}L_{jk}^\top$ vanishes unless $|i-j|\le1$: $LL^\top$ is block-tridiagonal. Conversely the block Cholesky factor of a PD block-tridiagonal matrix is block-bidiagonal (no fill-in), so layer-wise LMIs are cheap to factor. More generally, a symmetric sparsity pattern is a graph (edge $\{i,j\}$ if entry $ij$ may be nonzero); if it is chordal (every cycle of length $\ge4$ has a chord), a PSD matrix with that pattern is a sum of PSD matrices each supported on one clique (Vandenberghe & Andersen 2014, Thm. 9.2), so a large LMI splits into small ones. A tridiagonal pattern is a path; its cliques are consecutive pairs.
6.2 Block elimination and the Schur complement
Example (multiply out the factors to verify the theorem). For $M=\begin{bmatrix}2 & 1 & 0\\ 1 & 2 & 1\\ 0 & 1 & 2\end{bmatrix}$ with $A=2$: $S=\begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}-\tfrac12\begin{bmatrix}1 & 0\\ 0 & 0\end{bmatrix}=\begin{bmatrix}1.5 & 1\\ 1 & 2\end{bmatrix}$, $\det S=2$, $\det M=2\cdot2=4$.
Proof. Complete the square: $x^\top Ax+2x^\top By+y^\top Cy=x^\top(A-BC^{-1}B^\top)x+(y+C^{-1}B^\top x)^\top C(y+C^{-1}B^\top x)$. The second term is $\ge0$ and vanishes at $y=-C^{-1}B^\top x$. $\square$ (A congruence with a block-triangular $T$.)
Why GP regression needs it. With features $\varphi(x_i)^\top$ as rows of $\Phi$, $\Phi\Phi^\top=K_t$ is the $t\times t$ kernel matrix while $\Phi^\top\Phi=\sum_i\varphi(x_i)\varphi(x_i)^\top$ lives in feature space (possibly $p=\infty$). Push-through moves between them, and Woodbury gives, with $k_t(x)=\Phi\varphi(x)$, $$\varphi(x)^\top(\lambda I+\Phi^\top\Phi)^{-1}\varphi(x)=\lambda^{-1}\big(k(x,x)-k_t(x)^\top(K_t+\lambda I)^{-1}k_t(x)\big)=\lambda^{-1}\sigma_t^2(x).$$ Gaussian conditioning uses the same Schur complement (Primer C).
6.3 Determinants and log det
Meaning. $\{x:x^\top P^{-1}x\le1\}$ has volume $\propto\det(P)^{1/2}$, so $\tfrac12\log\det P$ is a log-volume, as in the Gaussian entropy $\tfrac12\log\det(2\pi e\Sigma)$ (Primer C); products of factors become sums of logs. Pitfall: $\det(2I_3)=8$, so $\det\big(\lambda^{-1}(\lambda I_t+K_t)\big)=\lambda^{-t}\det(\lambda I_t+K_t)$.
Proof. Eliminate either corner of $\begin{bmatrix}I_m & -A\\ B & I_n\end{bmatrix}$: the Schur complement of $I_m$ gives $\det(I_n+BA)$, that of $I_n$ gives $\det(I_m+AB)$. Then $\det(V+uv^\top)=\det V\det(I+V^{-1}uv^\top)$. $\square$ Uses. (1) $\det(I_t+\lambda^{-1}K_t)=\det(I_p+\lambda^{-1}\Phi^\top\Phi)$; in infinite-dimensional feature space the right side is a Fredholm determinant, which for the rank-$\le t$ operator $\Phi^\top\Phi$ is just $\prod_i(1+\mu_i/\lambda)$ over its nonzero eigenvalues, those of $K_t$. (2) Adding a point, $V_t=V_{t-1}+\varphi_t\varphi_t^\top$, raises $\log\det$ by $\log(1+\|\varphi_t\|_{V_{t-1}^{-1}}^2)$; the sum over $t$ is the "elliptical potential" (Exercise A.6).
6.4 Trace
Lifting. $y^\top My=\langle M,yy^\top\rangle$, and $Y=yy^\top$ is PSD, rank one, $\mathrm{diag}(Y)=(y_i^2)$: a nonconvex quadratic problem in $y$ becomes linear in $Y$, and dropping "rank one" but keeping $Y\succeq0$ gives an SDP whose value upper-bounds the original maximum (the Goemans–Williamson idea).
Total variance: $\mathrm{tr}\,\Sigma=\sum_i\mathrm{Var}(X_i)=\mathbb E\|X-\mathbb EX\|^2$, while $\mathrm{tr}(\Sigma^{1/2})=\sum_i\sqrt{\lambda_i}$ is the sum of marginal standard deviations only for diagonal $\Sigma$; for $\begin{bmatrix}1 & 0.8\\ 0.8 & 1\end{bmatrix}$ it is $\sqrt{1.8}+\sqrt{0.2}\approx1.79$, not $2$.
Tight frames: unit $x_1,\dots,x_T\in\mathbb R^d$ with $\sum_tx_tx_t^\top=cI$ force $c=T/d$ (take traces: $T=cd$); three unit vectors at $120^\circ$ give $\tfrac32I$.
Let $\bar\Sigma\succ0$ (aleatoric), $\hat\Sigma\succeq0$ (epistemic) be $n\times n$ ($n=n_S$, the state dimension), $S=\bar\Sigma+\hat\Sigma$. $G=\bar\Sigma S^{-1}$ is generally not symmetric, so its diagonal entries are no "variance ratios". But $S^{-1/2}GS^{1/2}=S^{-1/2}\bar\Sigma S^{-1/2}$, and $0\prec\bar\Sigma\preceq S$ gives by congruence $0\prec S^{-1/2}\bar\Sigma S^{-1/2}\preceq I$. Similar matrices share eigenvalues, so those of $G$ lie in $(0,1]$ and $\mathrm{tr}\,G\in(0,n]$.
Numbers: $\bar\Sigma=\mathrm{diag}(2,1)$, $\hat\Sigma=\begin{bmatrix}1 & 1\\ 1 & 1\end{bmatrix}$ give $G=\tfrac15\begin{bmatrix}4 & -2\\ -1 & 3\end{bmatrix}$, eigenvalues $1$ and $0.4$, $\tfrac12\mathrm{tr}\,G=0.7$. The eigenvalue $1$ comes from the null direction $(1,-1)$ of $\hat\Sigma$, where the epistemic part adds nothing.
Practice: Block algebra, Schur complements and updates
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.6a — Easy: Read a block matrix as ordinary equations
For $M=\begin{bmatrix}2&1&0\\1&3&0\\0&0&4\end{bmatrix}$ and $z=(1,2,3)$, compute $Mz$, $\operatorname{tr}M$ and $\det M$. Explain the determinant using its block structure.
Review: Block algebra, Schur complements and updates
Show hint
The top-left $2\times2$ block and the scalar $4$ act independently.
Show worked solution
Product: row-by-column multiplication gives $Mz=(2(1)+1(2),\ 1(1)+3(2),\ 4(3))=(4,7,12)$. The zero off-block entries mean there is no coupling to coordinate 3.
Trace: add diagonal entries: $\operatorname{tr}M=2+3+4=9$.
Determinant: M is block diagonal, so its determinant is the product of block determinants. The first block has determinant $2(3)-1(1)=5$; multiply by $4$ to obtain $\det M=20$. Trace adds blocks, while determinant multiplies them.
Exercise A.6b — Medium: Find the parameter range of a Schur complement
For which real a is $M(a)=\begin{bmatrix}a&2\\2&3\end{bmatrix}$ PSD? For which is it PD? Show a null vector at the boundary using a completed square.
Review: Block algebra, Schur complements and updates
Show hint
Use the strictly positive lower-right corner $3$ as the pivot.
Show worked solution
Complete the square: for $z=(x,y)$, $z^\top M(a)z=ax^2+4xy+3y^2=(a-4/3)x^2+3(y+2x/3)^2$. Expanding the right side verifies the cross term and the cancelled $4x^2/3$.
PSD: the second term is always nonnegative and can be made zero by $y=-2x/3$. Therefore the form is nonnegative for all z exactly when $a-4/3\ge0$, or $a\ge4/3$.
PD and boundary: both squared directions are strictly controlled when $a\gt4/3$, so M is PD. At $a=4/3$, take $z=(3,-2)$: the square vanishes and $M z=0$. Thus the boundary matrix is PSD and singular. For $a\lt4/3$ the same direction gives a negative form.
Exercise A.6c — Hard: Update an inverse and a log determinant
Let $V=\operatorname{diag}(2,1)$ and $u=(1,2)$. Compute $\det(V+uu^\top)$ and the increase in $\log\det V$ using the determinant lemma. Compute $(V+uu^\top)^{-1}$ using the rank-one inverse formula, then verify by multiplication.
Review: Block algebra, Schur complements and updates
Show hint
First compute $V^{-1}u$ and the scalar $u^\top V^{-1}u$; both identities reuse them.
Show worked solution
Shared quantities: $V^{-1}=\operatorname{diag}(1/2,1)$, $v=V^{-1}u=(1/2,2)$, and $u^\top v=1/2+4=9/2$.
Determinant: the lemma gives $\det(V+uu^\top)=2(1+9/2)=11$. Thus the log-determinant increase is $\log11-\log2=\log(11/2)\approx1.70475$.
Inverse: subtract $vv^\top/(1+u^\top v)$ from $V^{-1}$ to get $\operatorname{diag}(1/2,1)-\tfrac2{11}\begin{bmatrix}1/4&1\\1&4\end{bmatrix}=\tfrac1{11}\begin{bmatrix}5&-2\\-2&3\end{bmatrix}$.
Independent check: $V+uu^\top=\begin{bmatrix}3&2\\2&5\end{bmatrix}$. Multiplying it by the proposed inverse gives $\tfrac1{11}\begin{bmatrix}15-4&-6+6\\10-10&-4+15\end{bmatrix}=I$. Its direct determinant is $15-4=11$, agreeing with the update.
7. Orthogonal, Skew-Symmetric & Structured Matrices
7.1 Orthogonal matrices, reflections and projections
Householder reflections. For a unit vector $v$, $H=I-2vv^\top$ reflects across $v^\perp$ ($Hv=-v$, $Hw=w$ for $w\perp v$); it is symmetric, orthogonal and its own inverse, while $I-vv^\top$ is the (singular) orthogonal projector onto $v^\perp$. For $v=(1,1)/\sqrt2$, $H=\begin{bmatrix}0 & -1\\ -1 & 0\end{bmatrix}$ maps $(1,0)$ to $(0,-1)$. Since $\det$ is continuous with values $\pm1$ on orthogonal matrices, no continuous path joins a reflection to a rotation: orthogonal matrices form two separate pieces, and a continuous parameterisation from $\mathbb R^p$ reaches only one (Primer 0).
7.2 Skew-symmetric matrices and the Cayley transform
Proof of orthogonality. $I\pm A$ are polynomials in $A$, so they commute; and $XY=YX$ with $Y$ invertible gives $Y^{-1}X=XY^{-1}$ (multiply by $Y^{-1}$ on both sides), so $I-A$ also commutes with $(I+A)^{-1}$. With $(I+A)^\top=I-A$: $Q^\top Q=(I-A)^{-1}(I+A)(I-A)(I+A)^{-1}=(I-A)^{-1}(I-A)(I+A)(I+A)^{-1}=I$. $\square$ Example: $A=\begin{bmatrix}0 & -\tfrac12\\ \tfrac12 & 0\end{bmatrix}$ gives $Q=\begin{bmatrix}0.6 & 0.8\\ -0.8 & 0.6\end{bmatrix}$, a rotation by $-53.1^\circ$. Optimising over orthogonal matrices: differentiating $Q(t)^\top Q(t)=I$ gives $\dot Q^\top Q+Q^\top\dot Q=0$, so the tangent directions at $Q$ are $QA$ with $A$ skew; methods move along them ($Q\,\mathrm{Cayley}(tA)$, $Qe^{tA}$) or take a plain step and project back with the polar factor $UV^\top$ (Section 5).
7.3 Diagonal, permutation, Toeplitz and circulant matrices
$D=\mathrm{diag}(d)$ scales coordinates, $\|D\|_p=\max_i|d_i|$, and $D\succeq0$ iff $d\ge0$. A permutation matrix $\Pi$ is orthogonal, and $\Pi^\top M\Pi$ keeps eigenvalues and definiteness. $\ell_p$ norms are permutation invariant; GroupSort and MaxMin permute entries within groups, so where differentiable their Jacobian is a permutation matrix: orthogonal, norm-preserving.
Example. $h=(1,2)$: $T_4=\begin{bmatrix}1 & 0 & 0 & 0\\ 2 & 1 & 0 & 0\\ 0 & 2 & 1 & 0\\ 0 & 0 & 2 & 1\end{bmatrix}$. The matrix grows with the signal, the filter does not: $\|T_N\|_2=2.41,\,2.83,\,2.95,\,3.00$ for $N=2,4,8,32$, approaching the frequency-response gain $\max_\omega|1+2e^{-i\omega}|=3$. The $4\times4$ circulant has eigenvalues $3,\,1-2i,\,-1,\,1+2i$ and norm $3$; for real $h$, $\hat h_{N-k}=\overline{\hat h_k}$ (conjugate symmetry), so per-frequency operations can return real outputs. Vector-valued signals give block-Toeplitz matrices; finite memory makes them banded. Time invariance is the Toeplitz structure, finite memory the band.
7.4 Kronecker products and flattening
Examples. $I_2\otimes\begin{bmatrix}1 & 2\\ 3 & 4\end{bmatrix}=\begin{bmatrix}1 & 2 & 0 & 0\\ 3 & 4 & 0 & 0\\ 0 & 0 & 1 & 2\\ 0 & 0 & 3 & 4\end{bmatrix}$ is block diagonal; $\begin{bmatrix}1 & 2\\ 3 & 4\end{bmatrix}\otimes I_2=\begin{bmatrix}1 & 0 & 2 & 0\\ 0 & 1 & 0 & 2\\ 3 & 0 & 4 & 0\\ 0 & 3 & 0 & 4\end{bmatrix}$ interleaves. So $I_N\otimes Q$ applies $Q$ to each of $N$ pixels, $\mathrm{diag}(\lambda)\otimes I_g$ gives each group of $g$ neurons one multiplier, and $z^\top(\mathrm{diag}(\gamma)\otimes\mathbf 1\mathbf 1^\top)z=\sum_i\gamma_i(\mathbf 1^\top z_i)^2$ collects group sums. Flattening order matters: $c$ channels at $N$ pixels flattened pixel by pixel turn $\sum_px_p^\top Qx_p$ into $\mathrm{vec}^\top(I_N\otimes Q)\mathrm{vec}$; channel by channel it is $Q\otimes I_N$. Complex counterparts: unitary ($U^*U=I$) and skew-Hermitian ($A^*=-A$) matrices; the Cayley transform of the latter is unitary.
Practice: Orthogonal maps, projections and Cayley transforms
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.7a — Easy: A reflection preserves length
Let $Q=\operatorname{diag}(1,-1)$. Compute $Q^\top Q$, $Q(3,4)^\top$ and its length. Is Q a rotation or a reflection?
Review: Orthogonal maps, projections and Cayley transforms
Show hint
An orthogonal matrix satisfies $Q^\top Q=I$. The determinant distinguishes a plane rotation from a reflection.
Show worked solution
Orthogonality: Q equals its transpose and $Q^\top Q=\operatorname{diag}(1,1)=I$. Therefore $\|Qx\|_2^2=x^\top Q^\top Qx=\|x\|_2^2$ for every x.
Example: $Q(3,4)^\top=(3,-4)^\top$ and its length is $\sqrt{9+16}=5$, equal to the original length.
Orientation: $\det Q=-1$. Q fixes the horizontal axis and reverses the vertical coordinate, so it is a reflection across the horizontal axis. Orthogonal does not mean rotation only.
Exercise A.7b — Medium: Projection is different from an orthogonal matrix
Let $P=\operatorname{diag}(1,0)$. Show that it is an orthogonal projection onto the horizontal axis. Is P itself an orthogonal matrix? Find the projection error of $x=(3,4)$.
Review: Orthogonal maps, projections and Cayley transforms
Show hint
A projection matrix satisfies $P^2=P$; an orthogonal projection is also symmetric. An orthogonal matrix must satisfy $P^\top P=I$.
Show worked solution
Projection: $Px=(x_1,0)$ keeps exactly the horizontal component. P is symmetric and $P^2=P$, so projecting twice has the same effect as projecting once.
Error: for $(3,4)$ the projection is $(3,0)$ and the residual is $(0,4)$. Their dot product is $0$, explaining the word orthogonal in orthogonal projection. Pythagoras gives $3^2+4^2=5^2$.
Different property: $P^\top P=P\ne I$, so P is not an orthogonal matrix. It loses the vertical component and is singular; an orthogonal matrix preserves every length and is invertible. Its operator norm is still $1$, since it never increases length and preserves horizontal vectors.
Exercise A.7c — Hard: Derive a Cayley rotation and its missing case
For $A=\begin{bmatrix}0&-1\\1&0\end{bmatrix}$ compute $Q=(I-A)(I+A)^{-1}$ and verify orthogonality. Prove that the Cayley transform of any real skew-symmetric A cannot have a nonzero vector v with $Qv=-v$.
Review: Orthogonal maps, projections and Cayley transforms
Show hint
For the proof set $w=(I+A)^{-1}v$, so that the eigenvector equation becomes $(I-A)w=-(I+A)w$.
Show worked solution
Inverse: $I+A=\begin{bmatrix}1&-1\\1&1\end{bmatrix}$ has determinant $2$, hence inverse $\tfrac12\begin{bmatrix}1&1\\-1&1\end{bmatrix}$.
Product: $I-A=\begin{bmatrix}1&1\\-1&1\end{bmatrix}$, so Q is $\tfrac12\begin{bmatrix}0&2\\-2&0\end{bmatrix}=\begin{bmatrix}0&1\\-1&0\end{bmatrix}$. Direct multiplication gives $Q^\top Q=I$ and determinant $1$: a clockwise quarter-turn.
General exclusion: $I+A$ is invertible for skew-symmetric A, because $(I+A)w=0$ would give $0=w^\top(I+A)w=\|w\|^2$, forcing $w=0$. If $Qv=-v$, define w as in the hint. Then $w-Aw=-w-Aw$, so $2w=0$ and v is also zero.
Consequence: no Cayley transform of a finite skew-symmetric matrix has eigenvalue $-1$. The orthogonal matrix $-I$ is therefore outside this parameterisation; this is a restriction of the parameterisation, not of orthogonal matrices in general.
8. Functions as Vectors: Inner Product & Hilbert Spaces
Functions $f:D\to\mathbb R$ add and scale pointwise, so they are vectors. On a finite $D=\{x_1,\dots,x_n\}$, $f$ is the vector $(f(x_1),\dots,f(x_n))$; on an interval there are infinitely many independent functions ($1,x,x^2,\dots$). Kernel methods (Modules 3–6) do linear algebra in such infinite-dimensional spaces.
Examples. On $[0,1]$: $\langle1,x\rangle=\tfrac12$, $\|x\|=1/\sqrt3$, angle $30^\circ$. In the Fourier basis $1,\sqrt2\cos2\pi kx,\sqrt2\sin2\pi kx$, $3+4\sqrt2\cos2\pi x$ has coefficients $(3,4,0,\dots)$ and norm $5$: Pythagoras for functions.
What infinite dimensions add. (1) A Hilbert space is an inner-product space that is complete: every Cauchy sequence converges inside it. Polynomials are not complete in $L^2$ on $[0,1]$ (the Taylor polynomials of $e^x$ converge to $e^x$, which is no polynomial); the completion adds such limits, as the reals complete the rationals. (2) Norms are no longer equivalent: $x^n$ on $[0,1]$ has sup norm $1$ but $L^2$ norm $1/\sqrt{2n+1}\to0$. (3) Projection still works: the best approximation of $f$ in $\mathrm{span}(g_1,\dots,g_t)$ solves $G\alpha=b$, $G_{ij}=\langle g_i,g_j\rangle$, $b_i=\langle g_i,f\rangle$, and $\|f\|^2=\|f_\parallel\|^2+\|f_\perp\|^2$.
Functionals and adjoints. On $\mathbb R^n$ every linear functional is $x\mapsto a^\top x$; on a Hilbert space every bounded one ($|L(f)|\le C\|f\|$) is $\langle g_L,f\rangle$ for a unique $g_L$ (Riesz). Point evaluation $f\mapsto f(x)$ is not even defined on $L^2(dx)$ (changing $f$ at one point changes nothing), and on continuous functions with the $L^2$ norm it is unbounded: the spikes $f_n(y)=\max\{1-n|y-x|,0\}$ have $f_n(x)=1$ but $\|f_n\|_{L^2}^2\le\tfrac2{3n}\to0$. (For a discrete $\mu$ with a point mass $p\gt0$ at $x$ it is bounded, $|f(x)|\le\|f\|_{L^2}/\sqrt p$.) The spaces where it is bounded are the RKHSs below. The adjoint is defined by $\langle Tv,w\rangle=\langle v,T^*w\rangle$ ($T^*=T^\top$ on $\mathbb R^n$). For the design operator $\Phi g=(\langle\varphi(x_i),g\rangle)_{i\le t}$, $v^\top\Phi g=\langle\sum_iv_i\varphi(x_i),g\rangle$ gives $\Phi^*v=\sum_iv_i\varphi(x_i)$; $\Phi\Phi^*$ is the $t\times t$ matrix $[\langle\varphi(x_i),\varphi(x_j)\rangle]$, and $\Phi^*\Phi=\sum_i\varphi(x_i)\langle\varphi(x_i),\cdot\,\rangle$ is a positive operator of rank $\le t$, the operator version of $\sum_i\varphi_i\varphi_i^\top$.
8.1 Feature maps and kernels
Examples. $\varphi(x)=(1,\sqrt2x,x^2)$ gives $k(x,x')=(1+xx')^2$ (at $x=1$, $x'=2$ both sides are $9$): a kernel computes feature inner products without forming features. The squared-exponential kernel $\sigma_f^2\exp(-\|x-x'\|^2/(2\ell^2))$ has infinitely many features; $\sigma_f^2=k(x,x)$ is the prior variance and $\ell$ the length scale: $k/\sigma_f^2=0.61,\,0.14,\,0.011$ at distances $\ell,2\ell,3\ell$. Building kernels: sums, positive multiples and products of kernels are kernels. A product kernel on pairs, $k_1(\theta,\theta')k_2(t,t')$, has features $\varphi_1(\theta)\otimes\varphi_2(t)$, and its Gram matrix $K_1\circ K_2$ (entrywise product) is a principal submatrix of the PSD $K_1\otimes K_2$. The Wiener kernel $\min(t,t')=\int_0^\infty\mathbf 1[s\le t]\,\mathbf 1[s\le t']\,ds$ ($t,t'\ge0$) has the feature functions $\mathbf 1_{[0,t]}$.
8.2 The reproducing kernel Hilbert space (the bridge to Module 3)
The RKHS norm measures wiggliness. If $K\succ0$ (e.g. the SE kernel at distinct inputs), the smallest-norm $f$ with $f(x_i)=y_i$ has $\|f\|_k^2=y^\top K^{-1}y$. (For singular $K$ an interpolant exists iff $y\in\mathrm{range}(K)$, and the smallest squared norm is then $y^\top K^+y$: for the constant kernel $k\equiv1$ at two inputs, $K=\mathbf 1\mathbf 1^\top$, the data $(1,1)$ cost $1$ and $(1,-1)$ cannot be interpolated.) SE kernel, $\ell=1$, two points $0.1$ apart ($k=0.995$): $y=(1,1)$ needs $\|f\|_k\approx1.00$, $y=(1,-1)$ needs $\|f\|_k\approx20.0$. For a smooth kernel such as this one, a bound $\|f\|_k\le B$ rules out fast oscillation (the assumption behind GP confidence bounds); the alternating data sit on the small-eigenvalue direction of $K$ (Section 5).
Intuition. On a finite $D$ with $K=Q\Lambda Q^\top\succ0$, $\|f\|_k^2=f^\top K^{-1}f=\sum_j(q_j^\top f)^2/\lambda_j$, so small-eigenvalue components are expensive: the RKHS unit ball is an ellipsoid with semi-axes $\sqrt{\lambda_j}$ along the eigenvectors, and fast eigenvalue decay makes it thin in all but a few directions. For a smooth kernel such as the SE kernel the expensive components are the rough, oscillating ones; in general smoothness depends on the eigenfunctions as well as the eigenvalues. Stationary kernels are a separate whole-space case: if $k(x,x')=\kappa(x-x')$ on $\mathbb R^d$ with $\kappa$ continuous and integrable, and $\hat g(\omega)=\int g(x)e^{-i\omega^\top x}dx$, Fourier modes replace eigenfunctions: if $\hat\kappa\gt0$, $\mathcal H_k$ consists of the continuous $f\in L^2$ with $\|f\|_k^2=(2\pi)^{-d}\int|\hat f(\omega)|^2/\hat\kappa(\omega)\,d\omega\lt\infty$ (Kanagawa et al., arXiv 2018, Thm. 2.4; smooth kernels have $\hat\kappa$ tiny at high frequencies, which makes rough $f$ expensive). On a compact $D$ this does not apply directly: the RKHS norm of $f$ is the smallest whole-space norm among its extensions to $\mathbb R^d$. Operator eigenvalues are not those of a sampled $K_t$, though $\lambda_j(K_t)/t\approx\lambda_j$ for large $t$ if $\mu$ is a probability measure and the inputs are i.i.d. from $\mu$ (for a general finite $\mu$, sampling from $\mu/\mu(D)$ gives the limit $\lambda_j/\mu(D)$).
Distances between distributions: the mean embedding $m_P=\mathbb E_{X\sim P}\varphi(X)$ gives the maximum mean discrepancy $\mathrm{MMD}(P,Q)=\|m_P-m_Q\|_k$, with $\mathrm{MMD}^2=\mathbb Ek(X,X')-2\mathbb Ek(X,Y)+\mathbb Ek(Y,Y')$ ($X,X'\sim P$, $Y,Y'\sim Q$ independent); for the SE kernel it vanishes only if $P=Q$, the basis of kernel two-sample tests.
Practice: Functions as vectors, kernels and RKHS norms
Work from Easy to Medium before trying Hard. Use the review link for a missing definition, then try again with the explanation closed.
Exercise A.8a — Easy: Replace a sum by an integral
In $L^2([0,1])$, take $f(x)=1$ and $g(x)=x$. Compute $\langle f,g\rangle$, both norms, and the constant c such that $g-cf$ is perpendicular to f.
Review: Functions as vectors, kernels and RKHS norms
Show hint
Use $\int_0^1x\,dx=1/2$ and $\int_0^1x^2\,dx=1/3$. Perpendicular means inner product zero.
Show worked solution
Inner product: $\langle f,g\rangle=\int_0^1x\,dx=1/2$. Norms: $\|f\|^2=\int_0^1 1\,dx=1$ and $\|g\|^2=\int_0^1x^2\,dx=1/3$, so the norms are $1$ and $1/\sqrt3$.
Remove the constant component: $\langle f,g-cf\rangle=1/2-c$. Setting it to zero gives $c=1/2$. Thus $x-1/2$ is perpendicular to the constant function.
Check Pythagoras: $\int_0^1(x-1/2)^2dx=1/3-1/2+1/4=1/12$. The squared norm splits as $1/3=(1/2)^2+1/12$. The same projection algebra used for vectors now works for functions.
Exercise A.8b — Medium: Build a kernel matrix from explicit features
Let $\varphi(x)=(1,x)$ and $k(x,x^\prime)=\varphi(x)^\top\varphi(x^\prime)$. Compute k and its Gram matrix at inputs $0,1$. Verify PSD by writing $\alpha^\top K\alpha$ as a sum of squares. Is K PD?
Review: Functions as vectors, kernels and RKHS norms
Show hint
Write $\alpha_1\varphi(0)+\alpha_2\varphi(1)$ and square its length.
Show worked solution
Kernel: $k(x,x^\prime)=1+xx^\prime$. At inputs $0,1$, the values give $K=\begin{bmatrix}1&1\\1&2\end{bmatrix}$.
Gram identity: the weighted feature sum is $\alpha_1(1,0)+\alpha_2(1,1)=(\alpha_1+\alpha_2,\alpha_2)$. Its squared norm is $(\alpha_1+\alpha_2)^2+\alpha_2^2=\alpha^\top K\alpha\ge0$, proving PSD for all coefficients.
Strictness: the sum of squares vanishes only if $\alpha_2=0$ and then $\alpha_1=0$, so K is PD. Equivalently its features are independent, and its determinant is $2-1=1\gt0$. Kernels are PSD because of their feature inner products, not merely because their entries look positive.
Exercise A.8c — Hard: Interpolate and interpret an RKHS norm
For $k(x,x^\prime)=1+xx^\prime$ on $\mathbb R$, fit $f(0)=1$ and $f(1)=3$ with a function in its RKHS. Compute its squared RKHS norm using both the feature coefficients and $y^\top K^{-1}y$. Why does this finite norm not give a finite uniform bound on all real x?
Review: Functions as vectors, kernels and RKHS norms
Show hint
The feature map is $(1,x)$, so functions are $f(x)=w_1+w_2x$ with squared norm $w_1^2+w_2^2$. Also $k(x,x)=1+x^2$.
Show worked solution
Fit: the first condition gives $w_1=1$; the second gives $w_1+w_2=3$, hence $w_2=2$. Therefore $f(x)=1+2x$ and $\|f\|_k^2=1^2+2^2=5$.
Matrix check: $K=\begin{bmatrix}1&1\\1&2\end{bmatrix}$ has inverse $\begin{bmatrix}2&-1\\-1&1\end{bmatrix}$. For $y=(1,3)$, $K^{-1}y=(-1,2)$ and $y^\top K^{-1}y=-1+6=5$. These are the same norm calculation in two coordinate systems.
Representer check: $f(x)=-k(0,x)+2k(1,x)=-1+2(1+x)=1+2x$, so the coefficient solution indeed lies in the RKHS.
Domain matters: reproducing-property Cauchy–Schwarz gives $|f(x)|\le\sqrt5\sqrt{1+x^2}$, whose right side grows with x. The kernel diagonal is unbounded on $\mathbb R$, and f itself is unbounded there. On $[-1,1]$ the same theorem gives the valid uniform bound $\sqrt{10}$; a finite RKHS norm alone does not supply a domain-independent bound.
Interactive: Quadratic Forms, Eigenvectors & the SVD
Set the entries of $A=\begin{bmatrix}a_{11} & a_{12}\\ a_{21} & a_{22}\end{bmatrix}$. Left: $A$ maps the unit circle (grey) to an ellipse (blue); dashed teal: right singular vectors $v_1,v_2$; blue: their images $\sigma_iu_i$; purple: real eigen-directions; orange: the power iterate $x_k$ and $Ax_k$. Right: level sets $x^\top Sx=c$, $S=\tfrac12(A+A^\top)$, for $c=\pm\tfrac12,\pm1,\pm2$ (blue positive, orange negative, $c=1$ thick). The readouts use closed-form formulas evaluated in floating-point arithmetic (the determinant and eigenvalue discriminant come from the integer slider ticks, so singular matrices are recognised exactly); the level-set curves are approximated numerically on a grid.
What to look for. Walkthrough: no real eigenvectors ($\rho=2$), yet two singular directions with $\sigma_1=2\sqrt2$; the power estimate climbs to $2.83$ from below. Symmetric PD: eigen- and singular vectors coincide, the level sets are ellipses with semi-axes $1/\sqrt{\lambda_i}$, Cholesky succeeds. Indefinite: hyperbolas; Cholesky fails at pivot 2 although all entries are positive. Singular PSD: the ellipse collapses to a segment (rank 1), level sets become lines. Nilpotent: $\rho(A)=0$ but $\|A\|_2=2$, and power iteration from $(1,0)\perp v_1$ breaks down at once: $(1,0)\in\mathrm{null}(A)$, so $A^\top A(1,0)=0$ and there is no next iterate (the readout says so). Rotation: $\sigma_1=\sigma_2=1$ (every direction is a dominant one, so $v_1$ is not unique), and $S=0.6I$ is PD although $A$ is not symmetric.
From the mathematics to a real decision
Two sensor channels do not automatically give two independent pieces of information. If both channels measure almost the same combination of unknown quantities, a small reading error can become a large reconstruction error. This chapter uses a constructed displacement fixture to connect linear systems, singular values, least squares and uncertainty geometry. Every displacement and sensor error below is hypothetical; the example is a teaching model for deciding what a calculation can support.
- Read matrix rows as measurements and columns as responses to individual unknowns.
- Propagate a bounded measurement error through a linear reconstruction.
- Distinguish a unique solution, a well-conditioned solution and a minimum-length convention.
- Use residual orthogonality to check a least-squares estimate and state what it cannot verify.
A matrix is a measurement design
Let $z=(z_1,z_2)^\top$ contain two unknown fixture displacements, both in millimetres. A linear measurement model is $y=Hz+\eta$, where $y$ is the vector of sensor readings and $\eta$ is additive sensor error, also in millimetres. Each row of the dimensionless matrix $H$ describes one channel: it lists the coefficient multiplying each unknown displacement. Each column tells how all readings change when only one displacement increases by one millimetre.
To use the model, one assumes these coefficients are known and remain valid over the displacement range being studied. Calibration error in $H$ is a different uncertainty from additive error in $y$; the examples initially include only the latter. Solving the linear equations cannot establish that the measurement model itself is correct. It gives a conditional reconstruction from a stated model.
Suppose one channel measures the sum $z_1+z_2$ and another measures the difference $z_1-z_2$. Equal readings can then be explained by changes in different combinations. Adding and subtracting the channels separates these combinations. The matrix calculation is a compact record of that physical idea.
Set up. Take $H=\begin{bmatrix}1&1\\1&-1\end{bmatrix}$ and readings $y=(6,2)^\top$ millimetres. First ignore additive error to compute an estimate $\hat z$. The equations are $\hat z_1+\hat z_2=6$ and $\hat z_1-\hat z_2=2$. Adding gives $2\hat z_1=8$; subtracting gives $2\hat z_2=4$. Thus $\hat z=(4,2)^\top$ millimetres.
Check the map. Multiplication gives $H\hat z=(6,2)^\top$. Also $H^\top H=2I$, where $I$ is the two-dimensional identity. Therefore $\|Hz\|_2^2=z^\top H^\top Hz=2\|z\|_2^2$: every direction stretches by $\sqrt2$. Both singular values are $\sqrt2$, so the spectral condition number is one. There is no preferred weak direction.
Restore uncertainty. With $|\eta_i|\le0.1$, the error in the estimate is $\hat z-z=H^{-1}\eta$, since $\hat z=H^{-1}y$ and $y=Hz+\eta$. Here:
Decide. If a hypothetical assembly requires $z_1\le4.15$ millimetres, its worst permitted value is $4.1$, so this upper-limit test passes. A requirement $z_1\le4.05$ would not be certified. The error set is a rotated square, not a square with independent reconstructed errors: attaining the largest error in the first displacement forces zero error in the second at the relevant sensor-error corners.
Find the direction the measurements barely see
A system can be invertible while giving fragile estimates. Replace the difference channel by another almost-sum channel. The rows now point in nearly the same direction. Increasing $z_1$ while decreasing $z_2$ leaves the first reading unchanged and changes the second only slightly. This is a weakly observed direction: a large displacement change produces a small measurement change.
The smallest singular value quantifies the weakest stretch. For an invertible square matrix, the largest amplification through its inverse is $1/\sigma_{\min}(H)$. The condition number $\sigma_{\max}(H)/\sigma_{\min}(H)$ compares the strongest and weakest stretches; it concerns relative sensitivity in Euclidean coordinates. It is not a universal absolute error bound without a measurement error size. Units and coordinate scaling must be chosen before interpreting that comparison.
Change the design. Let $H=\begin{bmatrix}1&1\\1&1.1\end{bmatrix}$ and let the error-free readings be $(6,6.2)^\top$ millimetres. Subtraction gives $0.1z_2=0.2$, hence $z_2=2$ and $z_1=4$. The determinant $0.1$ is nonzero, so the solution is unique.
Inject a small permitted error. Perturb the readings by $\eta=(0.01,-0.01)^\top$. The new readings are $(6.01,6.19)^\top$. Their difference is $0.18$, so the reconstructed second displacement becomes $1.8$. Subtracting it from $6.01$ gives the first displacement $4.21$. The error is $(0.21,-0.2)^\top$, whose Euclidean length is $0.29$ millimetres, although each sensor changed by only $0.01$ millimetres.
Explain the sensitivity. Direct elimination gives $\Delta z_2=(\eta_2-\eta_1)/0.1$ and $\Delta z_1=11\eta_1-10\eta_2$. Opposite-sign errors are amplified by subtraction and division by the small row difference. Since this particular $H$ is symmetric positive definite, its singular values equal its positive eigenvalues:
Make a design decision. Exact solution of these equations cannot remove the sensitivity. A sensor observing a genuinely different direction, stronger sensor accuracy, or an additional justified prior constraint would change the information. Reporting more decimal places would not. Replacing $1.1$ by exactly $1$ would remove uniqueness altogether: both channels would report only the sum.
More measurements require a fitting criterion
Adding a third channel that directly measures $z_2$ gives a rectangular matrix. Noisy readings may fail to lie in its two-dimensional column space, so no displacement vector matches all of them exactly. Least squares chooses the estimate minimizing the sum of squared residuals, $\|H\hat z-y\|_2^2$. A residual is a mismatch in measurement space, not automatically a displacement error.
To derive the check without memorizing a derivative, perturb a candidate estimate by a small vector $tv$. Writing $r=H\hat z-y$, the squared residual becomes $\|r+tHv\|_2^2=\|r\|_2^2+2t v^\top H^\top r+t^2\|Hv\|_2^2$. A minimum cannot improve for either sign of sufficiently small $t$, so $H^\top r=0$. The residual is perpendicular to every possible modeled change in the readings. If $H$ has independent columns, $H^\top H$ is positive definite and this condition identifies a unique least-squares estimate.
Equal residual weights assume that squared errors in the different channels are comparable for the decision being made. If one sensor has a much different error scale, scaling or weighting the rows may be appropriate, but that is an additional modeling choice. A small residual can also coexist with a large state error along a weakly observed direction. Checking residuals and checking sensitivity answer different questions.
With only the sum measurement $z_1+z_2=6$, a pseudoinverse returns $(3,3)$. That is the solution of smallest Euclidean length, because $\|(3+t,3-t)\|_2^2=18+2t^2$. The measurement did not establish equal displacements. Repair the conclusion by reporting the full solution family or by stating the extra criterion explicitly. A convenient unique estimate is not the same as uniquely determined physical quantities.
Application practice: estimation and justified decisions
Exercise A.B1 — Easy: Check an assembly limit after reconstruction
The balanced sum/difference design has readings $(3,-1)^\top$ millimetres. Reconstruct both displacements. A component requires $z_1\le1.05$ millimetres. Can this be certified if each additive sensor error has magnitude at most $0.1$? What if the bound improves to $0.04$? Explain why using only the reconstructed central value is insufficient.
Show hint
Add the readings, then carry the two sensor errors through the same operation.
Show worked solution
Adding gives $2\hat z_1=2$, so $\hat z_1=1$; subtraction gives $2\hat z_2=4$, so $\hat z_2=2$. The first estimate error is $(\eta_1+\eta_2)/2$, bounded in magnitude by the individual sensor bound, with equality when the two errors have equal extreme signs.
At error bound $0.1$, the true first displacement may be as large as $1.1$, so the limit is not certified. At bound $0.04$, it is at most $1.04$, so the test passes. The sign convention for estimate-minus-true error does not change these symmetric intervals. Both conclusions assume the calibration matrix and additive bounds apply; the central estimate alone discards information needed for the limit test.
Exercise A.B2 — Medium: Separate minimum length from identification
Only one error-free channel remains: $z_1+z_2=6$ millimetres. Find all real solutions and the minimum-Euclidean-length solution. If physical information additionally says $z_1,z_2\ge0$, find the full range of $z_1$. Does either calculation certify a limit $z_1\le4$?
Show hint
Parameterize the line around (3,3), then impose nonnegativity on both coordinates.
Show worked solution
Every solution is $(3+t,3-t)$ for real $t$. Its squared norm is $18+2t^2$, minimized uniquely at $t=0$. Thus the pseudoinverse convention returns $(3,3)$, but the entire line fits the measurement.
Nonnegativity requires $-3\le t\le3$, so $z_1\in[0,6]$. The feasible point $(5,1)$ violates the proposed limit while fitting the reading and nonnegativity assumptions. The minimum-length estimate satisfies the limit, but this does not certify the unknown physical displacement. An additional measurement or a justified prior restriction is required to remove the counterexample.
Exercise A.B3 — Medium: Normalize quantities before taking a norm
A prediction is $y=p+(2\ \mathrm{s})v$, where position $p$ is in millimetres and velocity $v$ in millimetres per second. Define dimensionless coordinates by $p=(2\ \mathrm{mm})z_1$ and $v=(0.5\ \mathrm{mm/s})z_2$. If the normalized state error obeys $\|\Delta z\|_2\le0.1$, derive the largest possible prediction error and an attaining direction. Compare with separately bounding both normalized coordinates by $0.1$.
Show hint
In normalized coordinates the measurement row is (2,1), with output in millimetres. Apply Cauchy–Schwarz and examine equality.
Show worked solution
Substitution gives $y=(2z_1+z_2)$ millimetres. Therefore $|\Delta y|=|(2,1)^\top\Delta z|\le\sqrt5\|\Delta z\|_2\le0.1\sqrt5$ millimetres, approximately $0.223607$. The bound is attained at $\Delta z=0.1(2,1)^\top/\sqrt5$; its normalized length is exactly $0.1$.
The separate-coordinate bounds give $|\Delta y|\le2(0.1)+0.1=0.3$ millimetres. This is valid but looser: it includes the corner $(0.1,0.1)$, which lies outside the original radius-$0.1$ ball. Adding raw position and velocity squares without scales would not define this dimensionless geometry. The chosen scales are part of the uncertainty model and must be reported.
Exercise A.B4 — Hard: Audit a third sensor using residual orthogonality
Add a direct second-displacement sensor to the near-redundant design: $H=\begin{bmatrix}1&1\\1&1.1\\0&1\end{bmatrix}$ and $y=(6,6.2,2.1)^\top$ millimetres. Find the equal-weight least-squares estimate by solving its normal equations. Check residual orthogonality, explain uniqueness, and compare with the underlying teaching state $(4,2)$ when only the third reading was perturbed by $0.1$.
Show hint
Compute the two-by-two Gram matrix and H-transpose times y. Eliminate one unknown and retain enough precision to check both residual equations.
Show worked solution
The normal equations have matrix $G=H^\top H=\begin{bmatrix}2&2.1\\2.1&3.21\end{bmatrix}$ and right side $(12.2,14.92)^\top$. Eliminating the first variable gives $2.01\hat z_2=4.22$, so $\hat z_2=422/201\approx2.09950249$ and $\hat z_1=261/67\approx3.89552239$ millimetres.
Using $r=y-H\hat z$, the residual is $(1/201,-1/201,1/2010)^\top$ millimetres. Its products with the two columns are $r_1+r_2=0$ and $r_1+1.1r_2+r_3=0$. Thus $H^\top r=0$, verifying least-squares stationarity. Since the first and third rows already distinguish both unknowns, the columns are independent and $G$ is positive definite; the stationary point is the unique global minimum.
The estimate error relative to $(4,2)$ is $(-7/67,20/201)^\top$ millimetres, with length $29/201\approx0.144279$. The third channel has not simply been treated as exact: its discrepancy is distributed among all three residuals according to the equal-weight criterion. This example checks a particular perturbation; it does not establish a worst-case comparison between arbitrary sensor designs.
Read the geometry behind the answer
The measurement rows determine what can be distinguished. Their column rank decides uniqueness; their weakest singular direction decides sensitivity; the error set and its units decide what a reconstruction can certify. Least squares then explains what happens when measurements disagree. None of these questions is answered merely by successfully multiplying an inverse into a vector.
For recall, sketch the solution line of one sum measurement and explain what a second difference measurement changes. Reproduce the near-redundant calculation without an inverse. Explain why a residual can be zero while sensitivity is poor, and why a minimum-length estimate can satisfy a limit that the unknown true state violates. Finally, identify where deterministic sensor bounds entered the assembly decision.
Primer B turns least squares into a general optimization model and adds constraints to estimation or command selection. Gaussian-process regression in Module 3 uses related linear solves with a probabilistic interpretation. The present bounds were deterministic; assigning a probability to them requires the explicit assumptions developed in Primer C.
Exercises
Ready to use these matrix tools?
Before Primer B, redo the Easy and Medium exercises on vector norms, eigenvectors, definiteness and solves, and singular values. You should be able to explain why a symmetric PSD matrix has a nonnegative quadratic form, and why an eigenvalue is different from a singular value.
Before Module 2, check the Schur complement practice. Before Module 3, check the feature and RKHS practice. A missed calculation points to that section's local refresher; a missed assumption points to its definition or pitfall box. Next: Primer B: derivatives and optimisation.
Further Reading
| Resource | Type | Read it for |
|---|---|---|
| Introduction to Linear Algebra (Strang), 6th ed. | Textbook, Wellesley-Cambridge 2023 | Refreshing the first course: eigenvalues, positive definiteness, SVD. |
| Essence of Linear Algebra (Sanderson, 3Blue1Brown) | Video series, 2016 | Pictures: linear maps, determinants as volume, eigenvectors. |
| Linear Algebra Done Right (Axler), 4th ed. | Textbook, Springer 2024, open access | Inner-product spaces, adjoints, spectral theorem, positive operators, SVD, with proofs. |
| Introduction to Applied Linear Algebra (Boyd, Vandenberghe) | Textbook, Cambridge 2018, free PDF | Norms, distances, least squares and pseudo-inverses, computationally. |
| Convex Optimization (Boyd, Vandenberghe), App. A | Textbook, Cambridge 2004, free PDF | Dual and induced norms, the PSD cone, Schur complements including the singular case. |
| Numerical Linear Algebra (Trefethen, Bau) | Textbook, SIAM 1997 (25th-anniv. ed. 2022) | SVD, conditioning, Cholesky, power iteration, conjugate gradients. |
| Matrix Analysis (Horn, Johnson), 2nd ed. | Reference, Cambridge 2012 | Norms, Hermitian and positive definite matrices, Loewner order, inertia. |
| The Matrix Cookbook (Petersen, Pedersen) | Reference, version Nov. 2012 | Identities: Woodbury, determinant lemma, trace, Kronecker. |
| Gaussian Processes for Machine Learning (Rasmussen, Williams) | Textbook, MIT Press 2006, free PDF | Algorithm 2.1 (Cholesky GP regression), matrix identities in Appendix A. |
| Gaussian Processes and Kernel Methods: A Review on Connections and Equivalences (Kanagawa, Hennig, Sejdinovic, Sriperumbudur) | Tutorial review, arXiv 2018 | RKHS, feature maps, Mercer expansions: the bridge to Module 3. |