A. Linear Algebra II: Norms, Positive Definiteness & the SVD

From a first linear algebra course to the matrix tools every later module uses

Before you start

This primer assumes:

Book contents · Apply this chapter to a real decision · Glossary

Contents
1. Vectors, Inner Products & Norms Practice: Vectors, norms and worst-case directions (Easy → Hard) 2. Matrix Norms & Operator Norms Practice: Matrices as maps and norm bounds (Easy → Hard) 3. Symmetric Matrices & the Spectral Theorem Practice: Eigenvectors, quadratic forms and spectral limits (Easy → Hard) 4. Positive (Semi)Definite Matrices & Quadratic Forms Practice: Definiteness, factors and ellipsoid support (Easy → Hard) 5. The Singular Value Decomposition Practice: Singular values, least squares and power iteration (Easy → Hard) 6. Block Matrices, Determinants, Trace & log det Practice: Block algebra, Schur complements and updates (Easy → Hard) 7. Orthogonal, Skew-Symmetric & Structured Matrices Practice: Orthogonal maps, projections and Cayley transforms (Easy → Hard) 8. Functions as Vectors: Inner Product & Hilbert Spaces Practice: Functions as vectors, kernels and RKHS norms (Easy → Hard) Interactive: Quadratic Forms, Eigenvectors & the SVD Application lab & chapter review Exercises Further Reading Flashcards

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.

Notation — used on this page and in the modules
Vectors are columns, $x\in\mathbb R^n$; $e_i$ is the $i$-th unit vector, $\mathbf 1$ the all-ones vector, $I_n$ (or $I$) the identity, $A^\top$ the transpose and $A^*=\bar A^\top$ the conjugate transpose (Section 3). $\mathbb S^n$ is the set of symmetric $n\times n$ matrices; $P\succeq0$ / $P\succ0$ means positive semidefinite / definite (Section 4), not entrywise. $\lambda_{\min},\lambda_{\max}$, $\sigma_1\ge\sigma_2\ge\dots$, $\rho(A)$: extreme eigenvalues, singular values, spectral radius. $\|\cdot\|$ without subscript is the Euclidean norm on vectors and the spectral norm on matrices (as in Modules 12–13). $\mathrm{diag}(d)$ and $\mathrm{blkdiag}$ build diagonal and block-diagonal matrices, $\mathrm{tr}$ is the trace.
A route through this primer

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.

Background — Shapes, matrix products and transposes

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:

$$Ax=\begin{bmatrix}1(1)+2(2)\\0(1)+1(2)\end{bmatrix}=\begin{bmatrix}5\\2\end{bmatrix}.$$

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

$$AB=\begin{bmatrix}4&6\\1&3\end{bmatrix},\qquad BA=\begin{bmatrix}2&4\\1&5\end{bmatrix}.$$

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.

Background — Solving equations, inverses, rank and null space

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.

Background — Eigenvectors and orthogonality

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

Definition — Inner product and induced length
An inner product on $\mathbb R^n$ is a function $\langle x,y\rangle\in\mathbb R$ that is (i) symmetric, (ii) linear in each argument, (iii) positive: $\langle x,x\rangle\gt0$ for $x\ne0$. It induces the length $\|x\|=\sqrt{\langle x,x\rangle}$. The standard one is $x^\top y=\sum_ix_iy_i$; a weighted one is $\langle x,y\rangle_M=x^\top My$ with $M$ symmetric positive definite (Section 4; e.g. $M=\mathrm{diag}(m_i)$, all $m_i\gt0$), with length $\|x\|_M=\sqrt{x^\top Mx}$.

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.

Theorem — Cauchy–Schwarz inequality
For every inner product and all $x,y$: $\ |\langle x,y\rangle|\le\|x\|\,\|y\|$, with equality iff $x$ and $y$ are parallel.

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).

Fact — Maximising a linear function over a ball
$\max_{\|u\|\le1}c^\top u=\|c\|$, attained at $u=c/\|c\|$ if $c\ne0$ (for $c=0$ every $u$ is a maximiser); over $\|u-u_0\|\le r$, $r\ge0$, the maximum is $c^\top u_0+r\|c\|$.

Uses. $|a^\top d|\le\|a\|\bar d$ for a disturbance with $\|d\|\le\bar d$, and, for $u_{\max}\ge0$, $\max_{\|u\|\le u_{\max}}b^\top u=u_{\max}\|b\|$. For a distinct class $j\ne y$, 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$.

Fact — AM–GM and Young's inequality
For $a,b\ge0$: $\sqrt{ab}\le\tfrac12(a+b)$, equality iff $a=b$ (expand $(\sqrt a-\sqrt b)^2\ge0$). Hence $u+c/u\ge2\sqrt c$ for $u,c\gt0$, with equality at $u=\sqrt c$, and $2|ab|\le\varepsilon a^2+b^2/\varepsilon$ for every $\varepsilon\gt0$ (splitting a cross term into squares).

1.2 Norms and their unit balls

Definition — Norm, $\ell_p$ norms
A norm satisfies (i) $\|x\|=0\iff x=0$; (ii) $\|\alpha x\|=|\alpha|\,\|x\|$; (iii) the triangle inequality $\|x+y\|\le\|x\|+\|y\|$. For $1\le p\lt\infty$, $\|x\|_p=\big(\sum_i|x_i|^p\big)^{1/p}$, and $\|x\|_\infty=\max_i|x_i|$. For $\lambda\ge0$ entrywise, $\|\lambda\|_1=\sum_i\lambda_i$. The unit ball is $\{x:\|x\|\le1\}$.

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.

Pitfall
In dimensions $n\ge2$, for $0\lt p\lt1$ the formula is not a norm: $p=\tfrac12$ gives $\|(1,1)\|=4\gt\|(1,0)\|+\|(0,1)\|=2$. And modules switch norms: Module 11's Berkenkamp bounds use the 1-norm, while its robust MPC uses Euclidean state norms and the input $\ell_\infty$ norm. Always check which norm a constant refers to.

1.3 Hölder's inequality and dual norms

Theorem — Hölder's inequality and dual norms
For conjugate exponents $p,q\in[1,\infty]$, $\tfrac1p+\tfrac1q=1$ ($1\leftrightarrow\infty$, $2\leftrightarrow2$): $|u^\top v|\le\|u\|_p\|v\|_q$, and equality is attainable. So the dual norm $\|w\|_*=\max_{\|\delta\|\le1}w^\top\delta$ of $\ell_p$ is $\ell_q$, and $$\max_{\|\delta\|_p\le\varepsilon}w^\top\delta=\varepsilon\|w\|_q=-\min_{\|\delta\|_p\le\varepsilon}w^\top\delta,$$ attained at $\delta=\varepsilon\,\mathrm{sign}(w)$ for $p=\infty$, $\delta=\varepsilon w/\|w\|_2$ for $p=2$, $\delta=\varepsilon\,\mathrm{sign}(w_j)e_j$ ($|w_j|$ largest) for $p=1$ (with $\varepsilon\ge0$, $\mathrm{sign}(0)=0$, and $w\ne0$ for the $p=2$ formula; if $w=0$ every feasible $\delta$ maximises).

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, $\pm\sqrt{14}/10\approx\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

Fact — Comparing $\ell_1$, $\ell_2$, $\ell_\infty$ in $\mathbb R^n$
$$\|x\|_\infty\le\|x\|_2\le\|x\|_1\le\sqrt n\,\|x\|_2,\qquad \|x\|_2\le\sqrt n\,\|x\|_\infty,\qquad \|x\|_1\le n\,\|x\|_\infty,$$ tight for $x=e_1$ (left) and $x=\mathbf 1$ (right).

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$.

Common mistake — the direction of the inclusion
For $\varepsilon\ge0$, the smallest Euclidean radius whose ball contains the entire $\ell_\infty$ ball of radius $\varepsilon$ is $\sqrt n\,\varepsilon$. If $\varepsilon\gt0$ and $n\ge2$, an $\ell_2$ certificate of radius $\varepsilon$ alone does not cover that entire ball. All norms on $\mathbb R^n$ are equivalent up to positive constants; in infinite dimensions this guarantee can fail (Section 8).

Covering numbers. Assume $s\ge0$, $\tau>0$ and $d\ge1$. 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

Definition — Metric, ball, distance to a set
A metric $d$ on $D$ satisfies $d(x,y)=0\iff x=y$, $d(x,y)=d(y,x)$, $d(x,z)\le d(x,y)+d(y,z)$; every norm gives $d(x,y)=\|x-y\|$. The closed ball $B_r(x)=\{y:d(x,y)\le r\}$ is empty for $r\lt0$ and $\{x\}$ for $r=0$. For $C\ne\emptyset$, $\mathrm{dist}(x,C)=\inf_{y\in C}\|x-y\|$.

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. For a closed set $C$ with $C\ne\emptyset$ and $C^c\ne\emptyset$, a signed distance 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.

Where this is used
Cauchy–Schwarz, AM–GM: Module 1, Module 2 and its walkthrough, Module 3, CPO, robust CBFs, Module 12. Hölder: the trust-region bound, bound propagation, the action filter of Module 7. Norm equivalence, $\ell_p$ balls: Module 13, Module 15, Module 11, $\|\lambda^\star\|_1$ in Module 8; covering numbers and nets in Module 3. Metrics, balls, distances: SafeOpt, isometric embeddings in Module 4, Module 5, certified balls in Module 6 and GoSafeOpt, signed distances and punctured balls in Module 7 and its safety measure, Module 10, Hausdorff distance in HJ reachability.

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

For $x=(2,-1,2)^\top$ and $y=(1,2,0)^\top$, multiply corresponding coordinates and add:

$$x^\top y=2(1)+(-1)(2)+2(0)=2-2+0=0.$$

Both vectors are nonzero, so this zero dot product means they are perpendicular in the standard Euclidean inner product.

The one-norm adds absolute coordinates, the two-norm takes the square root of their squared sum, and the infinity-norm takes the largest absolute coordinate:

$$\begin{aligned} \|x\|_1&=|2|+|-1|+|2|=2+1+2=5,\\ \|x\|_2&=\sqrt{2^2+(-1)^2+2^2}=\sqrt{4+1+4}=\sqrt9=3,\\ \|x\|_\infty&=\max\{2,1,2\}=2. \end{aligned}$$

The negative coordinate contributes positively to every length. In three dimensions, the comparison is $\|x\|_\infty\le\|x\|_2\le\|x\|_1\le\sqrt3\|x\|_2$. Here it reads $2\le3\le5\le3\sqrt3$. For the last inequality both sides are nonnegative, so it is equivalent to $25\le27$. Norms measure size; the dot product also records relative 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

The objective is $w^\top\delta=3\delta_1-4\delta_2$ for $w=(3,-4)^\top$.

Coordinatewise ball. The constraint $\|\delta\|_\infty\le0.2$ means $|\delta_1|,|\delta_2|\le0.2$. Hence

$$3\delta_1-4\delta_2\le3|\delta_1|+4|\delta_2| \le3(0.2)+4(0.2)=0.6+0.8=1.4.$$

Choose $\delta=(0.2,-0.2)^\top$. Its infinity-norm is $0.2$, and the objective is $3(0.2)-4(-0.2)=1.4$. An upper bound and a feasible attaining point prove the maximum is $1.4$.

Euclidean ball. First $\|w\|_2=\sqrt{3^2+(-4)^2}=\sqrt{25}=5$. Cauchy–Schwarz gives $w^\top\delta\le|w^\top\delta|\le5\|\delta\|_2\le5(0.2)=1$. Choose the vector in the positive $w$ direction:

$$\delta=\frac{0.2}{5}(3,-4)^\top=(0.12,-0.16)^\top.$$

It is feasible because $\|\delta\|_2=\sqrt{0.12^2+(-0.16)^2}=\sqrt{0.0144+0.0256}=\sqrt{0.04}=0.2$. Its objective is $3(0.12)-4(-0.16)=0.36+0.64=1$. Thus the Euclidean maximum is $1$.

The Euclidean ball lies inside the coordinatewise ball since each coordinate magnitude is at most the Euclidean norm. The box corner used above has Euclidean length $0.2\sqrt2\gt0.2$, so it is unavailable in the second problem. Equal numerical radii in different norms describe different 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

1. Turn the definition into an inequality. Write $d_x=\inf_{c\in C}\|x-c\|$ and $d_y=\inf_{c\in C}\|y-c\|$. These are finite nonnegative numbers because $C$ is nonempty. For any $\varepsilon\gt0$, the definition of infimum supplies $c_\varepsilon\in C$ with $\|y-c_\varepsilon\|\lt d_y+\varepsilon$. The triangle inequality gives

$$d_x\le\|x-c_\varepsilon\|\le\|x-y\|+\|y-c_\varepsilon\|\lt\|x-y\|+d_y+\varepsilon.$$

This holds for every positive $\varepsilon$, so $d_x-d_y\le\|x-y\|$. Otherwise choosing $\varepsilon$ smaller than the positive gap would contradict the displayed bound. Interchanging $x$ and $y$ gives $d_y-d_x\le\|x-y\|$. The two bounds together say $|d_x-d_y|\le\|x-y\|$. This proof works even without closedness; for the closed finite-dimensional set in the question one could instead use an actual nearest point as suggested by the hint.

2. Compute the distance to the disc. The point $x=(3,4)$ has length $5$. Every point $c$ in the closed unit disc has $\|c\|_2\le1$, so the reverse triangle inequality gives $\|x-c\|_2\ge5-1=4$. The point $c=(3/5,4/5)$ lies on the unit circle, and $x-c=(12/5,16/5)$ has length $\sqrt{144+256}/5=4$. A lower bound and a point attaining it prove that the distance is exactly $4$.

3. Carry the displacement bound through the theorem. If $\|x'-x\|_2\le0.1$, then $|\operatorname{dist}(x',C)-4|\le0.1$. Hence the new distance lies in $[3.9,4.1]$. The displacement direction need not be known.

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.

Definition — Induced (operator) norm
For $A\in\mathbb R^{m\times n}$ with $n\ge1$, input norm $\|\cdot\|_a$ and output norm $\|\cdot\|_b$: $\ \|A\|_{a\to b}=\max_{x\ne0}\|Ax\|_b/\|x\|_a=\max_{\|x\|_a=1}\|Ax\|_b$. It is the smallest constant with $\|Ax\|_b\le\|A\|_{a\to b}\|x\|_a$ for all $x$. We write $\|A\|_p$ when $a=b=p$; Module 13 writes $\|W\|_{p,\infty}$ for input $\ell_p$, output $\ell_\infty$.
Fact — Formulas for the common induced norms
For $m,n\ge1$, $\|A\|_1=\max_j\sum_i|a_{ij}|$ (largest absolute column sum); $\|A\|_\infty=\max_i\sum_j|a_{ij}|$ (largest absolute row sum); $\|A\|_2=\sigma_{\max}(A)=\sqrt{\lambda_{\max}(A^\top A)}$, the spectral norm (Section 5); mixed: $\|A\|_{p\to\infty}=\max_i\|a_{i,:}\|_q$ with $\tfrac1p+\tfrac1q=1$ (e.g. $\|A\|_{2\to\infty}$ is the largest row length, $\|A\|_{1\to\infty}=\max_{ij}|a_{ij}|$) and $\|A\|_{1\to p}=\max_j\|a_{:,j}\|_p$.

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).

Definition — Frobenius norm and trace inner product
$\|A\|_F=\sqrt{\sum_{ij}a_{ij}^2}=\sqrt{\mathrm{tr}(A^\top A)}$ (the matrix as one long vector), with inner product $\langle A,B\rangle=\mathrm{tr}(A^\top B)=\sum_{ij}a_{ij}b_{ij}$. Not induced ($\|I_n\|_F=\sqrt n$), but $\|A\|_2\le\|A\|_F\le\sqrt{\mathrm{rank}A}\,\|A\|_2$; here $\|A\|_F=\sqrt{10}\approx3.16$.
Theorem — Submultiplicativity and the product bound
$\|AB\|\le\|A\|\,\|B\|$ for induced norms (and for $\|\cdot\|_F$), since $\|ABx\|\le\|A\|\,\|Bx\|\le\|A\|\,\|B\|\,\|x\|$. Hence $\|A^k\|\le\|A\|^k$ for induced norms and every integer $k\ge0$; the same bound for the Frobenius norm holds for $k\ge1$. A network $W_l\phi(\cdots\phi(W_0x))$ with 1-Lipschitz activations is $\prod_k\|W_k\|_2$-Lipschitz.
Pitfall — alignment and compatibility
$\mathrm{diag}(2,\tfrac12)\,\mathrm{diag}(\tfrac12,2)=I$ has norm $1$, but the product of norms is $4$: the product bound ignores that one layer shrinks what the other stretches (LipSDP removes this cost, Module 12). Keep norms compatible: $|x^\top My|\le\|x\|_2\|M\|_2\|y\|_2$ pairs Euclidean vectors with the spectral norm; otherwise use the dual norm, $|x^\top My|\le\|x\|_{b*}\|M\|_{a\to b}\|y\|_a$.
Theorem — Neumann series
If $\|A\|\lt1$ in an induced norm, then $I-A$ is invertible, $(I-A)^{-1}=\sum_{k\ge0}A^k$ and $\|(I-A)^{-1}\|\le1/(1-\|A\|)$. Proof: $\|A^k\|\le\|A\|^k$ makes the series converge like a geometric series (Primer 0), and $(I-A)\sum_{k\le N}A^k=I-A^{N+1}\to I$. $\square$

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. For $\varepsilon>0$, $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$.

Where this is used
Product bounds in Module 12 and its product-bound section; the induced 1-norm, column-stochastic matrices and $(I-\gamma P_\pi)^{-1}$ in the trust-region bound; operator-norm bounds in Module 11 and expected visits in its transient CMDPs; spectral, Frobenius, $\|W\|_{p,\infty}$ and $\|W\|_\infty$ norms in Module 13; $\mathrm{tr}(Y^\top W)$ and $\|\cdot\|_F^2$ in the augmented Lagrangian of Module 12; the inverse expansion in Exercise 3.3; zonotopes in Module 15.

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

Plan. Use the column-sum formula for the induced 1-norm, the row-sum formula for the induced $\infty$-norm and the entrywise formula for the Frobenius norm; then test the 1-norm bound on $x=(0,1)$.

Step 1 — Recall why column sums give the 1-norm. For any $x$, the triangle inequality applied to each output coordinate, then swapping the order of the two finite sums, gives

$$\begin{aligned}\|Ax\|_1&=\sum_i\Big|\sum_j a_{ij}x_j\Big|\le\sum_i\sum_j|a_{ij}|\,|x_j|\\&=\sum_j|x_j|\sum_i|a_{ij}|\\&\le\Big(\max_j\sum_i|a_{ij}|\Big)\|x\|_1.\end{aligned}$$

The last step replaces every column sum $\sum_i|a_{ij}|$ by the largest one, which can only increase the total because each weight $|x_j|$ is nonnegative.

The basis vector $e_j$ of the column with the largest absolute sum attains the bound, so $\|A\|_1$ is the largest absolute column sum. The same argument with the roles of rows and columns exchanged (bound $|\sum_j a_{ij}x_j|\le\|x\|_\infty\sum_j|a_{ij}|$) shows that $\|A\|_\infty$ is the largest absolute row sum.

Step 2 — Column sums. For $A=\begin{bmatrix}1&-2\\0&3\end{bmatrix}$:

$$\begin{aligned}\text{col }1&:\ |1|+|0|=1,\\ \text{col }2&:\ |-2|+|3|=2+3=5,\end{aligned}$$

so $\|A\|_1=\max\{1,5\}=5$.

Step 3 — Row sums.

$$\begin{aligned}\text{row }1&:\ |1|+|-2|=1+2=3,\\ \text{row }2&:\ |0|+|3|=3,\end{aligned}$$

so $\|A\|_\infty=\max\{3,3\}=3$. Swapping the two rules would give the wrong pair $(3,5)$, which is why the title warns against it.

Step 4 — Frobenius norm. Square every entry, add, take the square root:

$$\|A\|_F=\sqrt{1^2+(-2)^2+0^2+3^2}=\sqrt{1+4+0+9}=\sqrt{14}\approx3.742.$$

This treats the four entries as one long vector; it is not an induced norm, so it need not equal either value above.

Step 5 — Test the bound at $x=(0,1)$. Row by column,

$$\begin{aligned}Ax&=\begin{bmatrix}1\cdot0+(-2)\cdot1\\0\cdot0+3\cdot1\end{bmatrix}=\begin{bmatrix}-2\\3\end{bmatrix},\\ \|Ax\|_1&=|-2|+|3|=5.\end{aligned}$$

Since $\|x\|_1=0+1=1$, the bound $\|Ax\|_1\le\|A\|_1\|x\|_1$ reads $5\le5\cdot1$: it holds with equality. This is expected, because $x=e_2$ selects exactly the column with the largest absolute sum.

Check. The $\infty$-norm is attained too: $x=(1,-1)$ has $\|x\|_\infty=1$ and $Ax=(1+2,\,0-3)=(3,-3)$, so $\|Ax\|_\infty=3=\|A\|_\infty$.

Interpretation. The 1-norm and $\infty$-norm of the same matrix differ ($5$ versus $3$), and negative entries count by their absolute values. A bound quoted for one norm cannot be reused for another.

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

Plan. Compute each spectral norm from the diagonal entries, apply the product bound, then multiply the matrices and compare.

Step 1 — Spectral norm of a diagonal matrix. For $D=\operatorname{diag}(d_1,d_2)$,

$$\|Dx\|_2^2=d_1^2x_1^2+d_2^2x_2^2\le\max_i d_i^2\,(x_1^2+x_2^2),$$

with equality at the basis vector of the largest $|d_i|$. Hence $\|D\|_2=\max_i|d_i|$. Applied here: $\|A\|_2=\max\{3,1/2\}=3$ (attained at $e_1$) and $\|B\|_2=\max\{1/2,3\}=3$ (attained at $e_2$).

Step 2 — The product bound. Applying the definition of the operator norm twice, $\|ABx\|_2\le\|A\|_2\|Bx\|_2\le\|A\|_2\|B\|_2\|x\|_2$, so

$$\|AB\|_2\le\|A\|_2\|B\|_2=3\cdot3=9.$$

Step 3 — Multiply. Products of diagonal matrices multiply entry by entry on the diagonal:

$$AB=\begin{bmatrix}3\cdot\tfrac12&0\\0&\tfrac12\cdot3\end{bmatrix}=\begin{bmatrix}\tfrac32&0\\0&\tfrac32\end{bmatrix}=\tfrac32 I.$$

Step 4 — Its spectral norm. For every $x$, $\|ABx\|_2=\|\tfrac32x\|_2=\tfrac32\|x\|_2$, so every direction is stretched by exactly $1.5$ and $\|AB\|_2=1.5$.

Step 5 — Locate the gap. Follow the two directions through the composition (B acts first):

$$\begin{aligned}e_1&\xrightarrow{B}\tfrac12e_1\xrightarrow{A}\tfrac32e_1,\\ e_2&\xrightarrow{B}3e_2\xrightarrow{A}\tfrac32e_2.\end{aligned}$$

B stretches $e_2$ by $3$, but A then shrinks that same direction by $1/2$; A would stretch $e_1$ by $3$, but B has already shrunk it by $1/2$. The bound $9$ would require one direction that both maps stretch maximally, and no such direction exists. The bound overestimates by the factor $9/1.5=6$.

Check. Diagonal matrices commute, so $BA=\tfrac32I$ as well; and $1.5\le9$ is consistent with the theorem.

Interpretation. Submultiplicativity is always valid but is tight only when the largest output direction of B is a largest input direction of A. Chaining norm bounds through many layers can therefore be very conservative.

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

1. Sum each diagonal entry. Here $A=\operatorname{diag}(1/2,1/4)$, so $A^t=\operatorname{diag}((1/2)^t,(1/4)^t)$. For a scalar $r\ne1$, multiplying $1+r+\cdots+r^{T-1}$ by $1-r$ cancels every middle term and leaves $1-r^T$. Therefore

$$\sum_{t=0}^{T-1}A^t=\operatorname{diag}\left(2[1-2^{-T}],\frac43[1-4^{-T}]\right).$$

Both powers tend to zero as $T$ grows. Thus the infinite sum is $\operatorname{diag}(2,4/3)=(I-A)^{-1}$, and subtracting the finite sum gives the exact remainder $\operatorname{diag}(2^{1-T},(4/3)4^{-T})$.

2. Take the spectral norm. A diagonal matrix stretches coordinate axes by the absolute values of its diagonal entries, so its spectral norm is the larger one. Their ratio is $2^{1-T}/[(4/3)4^{-T}]=(3/2)2^T\ge1$ for $T\ge0$. The remainder norm is consequently $2^{1-T}$.

3. Find the first acceptable integer. The tolerance requires $2^{1-T}\le0.01$, equivalently $2^T\ge200$. Since $2^7=128\lt200$ and $2^8=256\ge200$, the smallest $T$ is $8$. This means the eight terms $A^0$ through $A^7$. The errors at $T=7$ and $T=8$ are respectively $1/64=0.015625$ and $1/128=0.0078125$, confirming the cutoff.

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.

Notation — Complex numbers in five lines
$z=a+ib$ with $i^2=-1$ (engineers write $j$), conjugate $\bar z=a-ib$, modulus $|z|=\sqrt{z\bar z}$, polar form $z=re^{i\theta}=r(\cos\theta+i\sin\theta)$. For complex vectors $v^*=\bar v^\top$ and $v^*v=\sum_i|v_i|^2\gt0$ for $v\ne0$. Example: the rotation $R(\theta)=\begin{bmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{bmatrix}$ has eigenvalues $e^{\pm i\theta}$ with eigenvectors $(1,\mp i)$.
Theorem — Spectral theorem for real symmetric matrices
If $A\in\mathbb S^n$, then $\ A=Q\Lambda Q^\top=\sum_{i=1}^n\lambda_iq_iq_i^\top$ with $\Lambda=\mathrm{diag}(\lambda_i)$ real and $Q=[q_1,\dots,q_n]$ orthogonal ($Q^\top Q=I$): the $q_i$ are orthonormal eigenvectors.

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$.

Proof sketch — a full orthonormal eigenbasis, even with repeated eigenvalues
Induction on $n$. Take a real unit eigenvector $q_1$. The subspace $q_1^\perp$ is mapped into itself, since $q_1^\top Ax=(Aq_1)^\top x=\lambda_1q_1^\top x=0$ for $x\perp q_1$. There $A$ is again symmetric, so by induction it has an orthonormal eigenbasis $q_2,\dots,q_n$. Distinct eigenvalues are never needed; for a repeated one any orthonormal basis of its eigenspace works, so for $n\ge1$, $Q$ is not unique.

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: this positive-definite example is a pure stretch along perpendicular axes (by $3$ along the diagonal and 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)$.

Theorem — Rayleigh quotient
For $n\ge1$ and $A\in\mathbb S^n$: $\ \lambda_{\max}(A)=\max_{\|x\|=1}x^\top Ax$, $\ \lambda_{\min}(A)=\min_{\|x\|=1}x^\top Ax$, and $\lambda_{\min}\|x\|^2\le x^\top Ax\le\lambda_{\max}\|x\|^2$ for all $x$, with equality at the corresponding eigenvectors.

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$.

Definition — Spectral radius
$\rho(A)=\max_i|\lambda_i(A)|$ over all (complex) eigenvalues of a square $A$. For every induced norm $\rho(A)\le\|A\|$, since $Av=\lambda v$ gives $|\lambda|\,\|v\|=\|Av\|\le\|A\|\,\|v\|$. For symmetric $A$, $\rho(A)=\max\{|\lambda_{\min}|,|\lambda_{\max}|\}=\|A\|_2$.
Pitfall — three different numbers
$\mathrm{diag}(1,-3)$ has $\lambda_{\max}=1$ but $\rho=3$; $\begin{bmatrix}0 & 10\\ 0 & 0\end{bmatrix}$ has $\rho=0$ but norm $10$. Iterating $x_{t+1}=Ax_t$ is governed by $\rho(A)\lt1$ (Primer D); $\|A\|\lt1$ is only sufficient. For nonsymmetric $A$ only the symmetric part enters a quadratic form, $x^\top Ax=x^\top\tfrac12(A+A^\top)x$: $\begin{bmatrix}1 & 4\\ 0 & 1\end{bmatrix}$ has eigenvalues $1,1$, yet $x=(1,-1)$ gives $-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.

Going deeper — how eigenvalues are computed (Jacobi), and why a computed $\lambda_{\min}\ge0$ is not a proof

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.

Where this is used
$\rho(A)$ and eigenvalue bounds in Module 2; eigenvalue-by-eigenvalue comparisons of regularised matrices in Module 3; $\lambda_{\max}$ of tube shape matrices in Module 7 and Module 10 (worked out in Section 4); $\lambda_{\min}\|x\|^2\le x^\top Px\le\lambda_{\max}\|x\|^2$ in Module 11; Jacobian spectral norms in Module 12; Hermitian multipliers in Module 2 and Primer D; the Jacobi check in the Module 14 explorer.

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

Plan. Multiply $A$ by each proposed vector and recognise a scalar multiple; then check unit length and perpendicularity; finally rebuild $A$ from the pieces.

Step 1 — Test $q_+$. Work with the unscaled vector $(1,1)$ first; the factor $1/\sqrt2$ can be pulled out because matrix multiplication is linear.

$$A\begin{bmatrix}1\\1\end{bmatrix}=\begin{bmatrix}3\cdot1+1\cdot1\\1\cdot1+3\cdot1\end{bmatrix}=\begin{bmatrix}4\\4\end{bmatrix}=4\begin{bmatrix}1\\1\end{bmatrix}.$$

Multiplying both sides by $1/\sqrt2$ gives $Aq_+=4q_+$: $q_+$ is an eigenvector with eigenvalue $4$.

Step 2 — Test $q_-$.

$$A\begin{bmatrix}1\\-1\end{bmatrix}=\begin{bmatrix}3\cdot1+1\cdot(-1)\\1\cdot1+3\cdot(-1)\end{bmatrix}=\begin{bmatrix}2\\-2\end{bmatrix}=2\begin{bmatrix}1\\-1\end{bmatrix},$$

so $Aq_-=2q_-$: eigenvalue $2$.

Step 3 — Orthonormality. Unit length and zero dot product:

$$\begin{aligned}\|q_\pm\|_2^2&=\Big(\tfrac1{\sqrt2}\Big)^2+\Big(\pm\tfrac1{\sqrt2}\Big)^2=\tfrac12+\tfrac12=1,\\ q_+^\top q_-&=\tfrac{1\cdot1+1\cdot(-1)}{2}=0.\end{aligned}$$

This is what the spectral theorem predicts: $A$ is symmetric and the two eigenvalues are distinct, so the eigenvectors must be perpendicular.

Step 4 — Rebuild $A$ (spectral decomposition). The outer products are $q_+q_+^\top=\tfrac12\begin{bmatrix}1&1\\1&1\end{bmatrix}$ and $q_-q_-^\top=\tfrac12\begin{bmatrix}1&-1\\-1&1\end{bmatrix}$, so

$$\begin{aligned}4q_+q_+^\top+2q_-q_-^\top&=\begin{bmatrix}2&2\\2&2\end{bmatrix}+\begin{bmatrix}1&-1\\-1&1\end{bmatrix}\\&=\begin{bmatrix}3&1\\1&3\end{bmatrix}=A.\end{aligned}$$

Check. The eigenvalues must add to the trace and multiply to the determinant: $4+2=6=3+3$ and $4\cdot2=8=3\cdot3-1\cdot1$. Both agree.

Interpretation. $A$ stretches by $4$ along the diagonal direction $(1,1)$ and by $2$ along the perpendicular direction $(1,-1)$; it is a pure stretch along perpendicular axes, with no rotation.

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

Plan. Compute the quadratic form and the Rayleigh quotient directly, then explain the bounds by writing $x$ in the orthonormal eigenbasis from Exercise A.3a ($\lambda=4$ along $q_+$, $\lambda=2$ along $q_-$).

Step 1 — The quadratic form.

$$\begin{aligned}Ax&=\begin{bmatrix}3\cdot1+1\cdot2\\1\cdot1+3\cdot2\end{bmatrix}=\begin{bmatrix}5\\7\end{bmatrix},\\ x^\top Ax&=1\cdot5+2\cdot7=19.\end{aligned}$$

Step 2 — The Rayleigh quotient. With $x^\top x=1^2+2^2=5$,

$$R(x)=\frac{x^\top Ax}{x^\top x}=\frac{19}{5}=3.8.$$

Step 3 — Why the bounds hold. $A$ is symmetric, so by the spectral theorem we may write $x=c_+q_++c_-q_-$ with $c_\pm=q_\pm^\top x$. Here

$$c_+=\frac{1+2}{\sqrt2}=\frac{3}{\sqrt2},\qquad c_-=\frac{1-2}{\sqrt2}=-\frac{1}{\sqrt2}.$$

Since $Aq_+=4q_+$ and $Aq_-=2q_-$, linearity gives $Ax=4c_+q_++2c_-q_-$. Multiplying out and using $q_+^\top q_+=q_-^\top q_-=1$, $q_+^\top q_-=0$:

$$\begin{aligned}x^\top x&=(c_+q_++c_-q_-)^\top(c_+q_++c_-q_-)=c_+^2+c_-^2,\\ x^\top Ax&=(c_+q_++c_-q_-)^\top(4c_+q_++2c_-q_-)=4c_+^2+2c_-^2.\end{aligned}$$

Replacing the weight $4$ by $2$, or the weight $2$ by $4$, gives

$$2(c_+^2+c_-^2)\le4c_+^2+2c_-^2\le4(c_+^2+c_-^2),$$

that is, $\lambda_{\min}\|x\|^2\le x^\top Ax\le\lambda_{\max}\|x\|^2$ with $\lambda_{\min}=2$, $\lambda_{\max}=4$.

Step 4 — Check the numbers. $c_+^2=9/2$ and $c_-^2=1/2$, so $c_+^2+c_-^2=5=x^\top x$ and $4(9/2)+2(1/2)=18+1=19=x^\top Ax$. The bounds read

$$2\cdot5=10\le19\le20=4\cdot5,\qquad\text{i.e.}\qquad 2\le3.8\le4.$$

Step 5 — When equality holds. Subtracting, $4\|x\|^2-x^\top Ax=2c_-^2$ and $x^\top Ax-2\|x\|^2=2c_+^2$. The upper bound is an equality exactly when $c_-=0$, i.e. $x$ is a nonzero multiple of $(1,1)$; the lower bound exactly when $c_+=0$, i.e. $x$ is a nonzero multiple of $(1,-1)$. Directly: $(1,1)$ gives $Ax=(4,4)$, quotient $8/2=4$; $(1,-1)$ gives $Ax=(2,-2)$, quotient $4/2=2$.

Check. At $x=(1,2)$ both $c_+$ and $c_-$ are nonzero, so both inequalities are strict, as observed. In fact $3.8$ is the weighted average $\tfrac{9}{10}\cdot4+\tfrac{1}{10}\cdot2$ with weights $c_\pm^2/\|x\|^2$.

Interpretation. The Rayleigh quotient is always an average of the eigenvalues, weighted by how much of $x$ lies in each eigendirection; that is why it can never leave $[\lambda_{\min},\lambda_{\max}]$.

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

Plan. Get the eigenvalues of $N$ from its characteristic polynomial, evaluate the form at $x=(1,-1)$, then split $N$ into symmetric and skew parts to see which part the form actually measures.

Step 1 — Eigenvalues of $N$. For a triangular matrix the determinant is the product of the diagonal:

$$\det(N-\lambda I)=\det\begin{bmatrix}1-\lambda&4\\0&1-\lambda\end{bmatrix}=(1-\lambda)^2.$$

So $\lambda=1$ is a double eigenvalue. Its eigenvectors solve $(N-I)v=\begin{bmatrix}0&4\\0&0\end{bmatrix}v=0$, i.e. $4v_2=0$: only multiples of $(1,0)$. There is a single eigendirection, so $N$ has no eigenbasis at all.

Step 2 — The form at $x=(1,-1)$.

$$\begin{aligned}Nx&=\begin{bmatrix}1\cdot1+4\cdot(-1)\\0\cdot1+1\cdot(-1)\end{bmatrix}=\begin{bmatrix}-3\\-1\end{bmatrix},\\ x^\top Nx&=1\cdot(-3)+(-1)\cdot(-1)=-2.\end{aligned}$$

Both eigenvalues are positive, yet the form is negative.

Step 3 — Symmetric and skew parts.

$$\begin{aligned}S&=\tfrac12(N+N^\top)=\tfrac12\begin{bmatrix}2&4\\4&2\end{bmatrix}=\begin{bmatrix}1&2\\2&1\end{bmatrix},\\ K&=\tfrac12(N-N^\top)=\begin{bmatrix}0&2\\-2&0\end{bmatrix},\end{aligned}$$

and $S+K=N$, $S^\top=S$, $K^\top=-K$.

Step 4 — Eigenvalues of $S$. $\det(S-\lambda I)=(1-\lambda)^2-4=0$ gives $1-\lambda=\pm2$, so $\lambda=3$ or $\lambda=-1$. Checking directions: $S(1,1)^\top=(3,3)^\top=3(1,1)^\top$ and $S(1,-1)^\top=(1-2,\,2-1)^\top=(-1,1)^\top=-1\cdot(1,-1)^\top$.

Step 5 — Why only $S$ matters. The number $x^\top Kx$ is a $1\times1$ matrix, so it equals its own transpose:

$$x^\top Kx=(x^\top Kx)^\top=x^\top K^\top x=-x^\top Kx\ \Longrightarrow\ x^\top Kx=0.$$

(Directly: $x^\top Kx=2x_1x_2-2x_2x_1=0$.) Hence $x^\top Nx=x^\top Sx+x^\top Kx=x^\top Sx$. Our $x=(1,-1)$ is the eigenvector of $S$ for $-1$, so $x^\top Sx=-1\cdot\|x\|^2=-1\cdot2=-2$, matching Step 2.

Step 6 — Assumption audit. The spectral theorem requires a real symmetric matrix. $N$ is not symmetric (entry $(1,2)$ is $4$, entry $(2,1)$ is $0$), so none of its conclusions transfer: there is no orthonormal eigenbasis (Step 1) and the bound $x^\top Nx\ge\lambda_{\min}\|x\|^2$ fails (it would claim $x^\top Nx\ge2$ at our $x$, but the value is $-2$).

Check. $\operatorname{tr}S=2=3+(-1)$ and $\det S=1-4=-3=3\cdot(-1)$.

Interpretation. To decide the sign of a quadratic form, symmetrise first and apply positivity tests to $S$. Eigenvalues of a non-symmetric matrix describe invariant directions, not the sign of $x^\top Nx$.

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).

Definition — Positive semidefinite and definite matrices
$P\in\mathbb S^n$ is positive semidefinite, $P\succeq0$, if $x^\top Px\ge0$ for all $x$, and positive definite, $P\succ0$, if $x^\top Px\gt0$ for all $x\ne0$. $P\preceq0$ ($P\prec0$) means $-P\succeq0$ ($-P\succ0$); otherwise $P$ is indefinite. ("Nonnegative definite" means PSD; always check strict versus non-strict.)

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$. In the plane, the level sets $q=1$ are ellipses (PD), two parallel lines (nonzero singular PSD) or hyperbolas (indefinite); for the zero matrix this level set is empty: see the explorer.

Theorem — Equivalent tests for $P\in\mathbb S^n$
$P\succ0$ $\iff$ (a) all eigenvalues $\gt0$ $\iff$ (b) all leading principal minors $\gt0$ (Sylvester) $\iff$ (c) $P=LL^\top$ with $L$ lower triangular, $L_{jj}\gt0$ (Cholesky) $\iff$ (d) $P=R^\top R$ with $R$ of independent columns.
$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$).

Proof sketch — Sylvester's criterion
"Only if": each leading block $P_k$ is PD (restrict $x$ to the first $k$ coordinates), so $\det P_k=\prod\lambda_i(P_k)\gt0$. "If": induction. Write $P=\begin{bmatrix}P_{n-1} & b\\ b^\top & c\end{bmatrix}$ with $P_{n-1}\succ0$. Then $\det P=\det P_{n-1}\,(c-b^\top P_{n-1}^{-1}b)$ (Section 6), so the Schur complement $c-b^\top P_{n-1}^{-1}b$ is positive, and $P\succ0$ by the Schur-complement lemma of Section 6.
Pitfall — semidefiniteness is not "nonnegative leading minors", and not entrywise
$\begin{bmatrix}0 & 0\\ 0 & -1\end{bmatrix}$ has leading minors $0,0$ but is not PSD ($p_{22}=-1$): for PSD check all principal minors or the eigenvalues. And "$M\preceq0$" constrains quadratic forms, never "every entry $\le0$".

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

Definition — Loewner order
$A\succeq B$ means $A-B\succeq0$: $x^\top Ax\ge x^\top Bx$ in every direction; $A\succ B$ means $A-B\succ0$. It is a partial order: $\mathrm{diag}(1,0)$ and $\mathrm{diag}(0,1)$ are incomparable.

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$).

Fact — Congruence
For any $T$ (square or rectangular), $M\succeq0\Rightarrow T^\top MT\succeq0$, because $x^\top T^\top MTx=(Tx)^\top M(Tx)$: a congruence is a change of variables in the quadratic form. Strict definiteness needs more: for $M\succ0$, $x^\top T^\top MTx=(Tx)^\top M(Tx)\gt0$ for all $x\ne0$ iff $Tx\ne0$, so $T^\top MT\succ0$ iff $T$ has independent columns ($M=I_2$, $T=\mathrm{diag}(1,0)$ gives the singular $\mathrm{diag}(1,0)$). For invertible $T$ it works both ways, for $\succeq$ and $\succ$. For singular or rectangular $T$ the converse fails: $T=\begin{bmatrix}1\\ 0\end{bmatrix}$, $M=\mathrm{diag}(1,-1)$ give $T^\top MT=1\gt0$ although $M$ is indefinite. Complex version: $T^*MT$.

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).

Pitfall — matrix inequalities do not pass through arbitrary functions
$A=\begin{bmatrix}1 & 0\\ 0 & 0\end{bmatrix}\preceq B=\begin{bmatrix}2 & 1\\ 1 & 1\end{bmatrix}$, but $B^2-A^2=\begin{bmatrix}4 & 3\\ 3 & 2\end{bmatrix}$ has determinant $-1$. Safe: $T^\top AT\preceq T^\top BT$, $A+C\preceq B+C$, $A^{1/2}\preceq B^{1/2}$ (for $A\succeq0$), $B^{-1}\preceq A^{-1}$ (for $A\succ0$, shown below); for commuting matrices any increasing scalar function works eigenvalue by eigenvalue.

4.3 Square roots, weighted norms and ellipsoids

Definition — Matrix square root
For $P=Q\Lambda Q^\top\succeq0$, $P^{1/2}=Q\Lambda^{1/2}Q^\top$ is the unique PSD matrix with $(P^{1/2})^2=P$; for $P\succ0$, $P^{-1/2}=Q\Lambda^{-1/2}Q^\top$. Factors $R$ with $R^\top R=P$ (Cholesky, or $UP^{1/2}$ with $U$ orthogonal) exist for every $P\succeq0$ but need not be symmetric ($U=I$, the square root itself, is); conversely $PP^\top\succeq0$ for any $P$, and a thin $P\in\mathbb R^{n\times r}$ yields rank at most $r$.

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$.

Definition — Ellipsoid (two conventions)
For $P\succ0$: $\ \mathcal E(P,c)=\{x:(x-c)^\top P(x-c)\le1\}=\{c+P^{-1/2}u:\|u\|\le1\}$, with semi-axes along the eigenvectors of $P$ of lengths $1/\sqrt{\lambda_i(P)}$ and volume $\mathrm{vol}(\text{unit ball})\cdot\det(P)^{-1/2}$. Tube papers use the shape matrix $S=P^{-1}$: $\{(x-c)^\top S^{-1}(x-c)\le1\}=\{c+S^{1/2}u:\|u\|\le1\}$, semi-axes $\sqrt{\lambda_i(S)}$. The linear-image form also covers singular $S\succeq0$ (flat ellipsoids), where $S^{-1}$ does not exist.

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$.

Worked example — a Lipschitz margin for an ellipsoidal tube
The state lies in $\{(s-z)^\top S^{-1}(s-z)\le1\}$ with $S=\mathrm{diag}(4,1)$, the input deviates by $K(s-z)$ with $K=\begin{bmatrix}1 & 1\end{bmatrix}$. Write $s-z=S^{1/2}u$, $\|u\|\le1$: $\|s-z\|^2=u^\top Su\le\lambda_{\max}(S)=4$ and $\|K(s-z)\|^2\le\lambda_{\max}(S^{1/2}K^\top KS^{1/2})=\lambda_{\max}(KSK^\top)=5$ ($M^\top M$ and $MM^\top$ share nonzero eigenvalues, Section 5). The stacked deviation is at most $\sqrt{4+5}=3$ long, so a function with Lipschitz constant $\ell_G$ changes by at most $3\ell_G$: the form $\ell_G\sqrt{\lambda_{\max}(P)+\lambda_{\max}(KPK^\top)}$ of Module 7. Adding the maxima is conservative; the exact value is $\sqrt{\lambda_{\max}\begin{bmatrix}8 & 2\\ 2 & 2\end{bmatrix}}\approx2.93$.

4.4 Cholesky factorisation and linear solves

Theorem — Cholesky factorisation
Every $P\succ0$ has a unique $P=LL^\top$ with $L$ lower triangular, $L_{jj}\gt0$: $$L_{jj}=\sqrt{P_{jj}-\textstyle\sum_{k\lt j}L_{jk}^2},\qquad L_{ij}=\big(P_{ij}-\textstyle\sum_{k\lt j}L_{ik}L_{jk}\big)/L_{jj}\ \ (i\gt j).$$ In exact arithmetic all square-root arguments are positive iff $P\succ0$, so this is also a definiteness test; cost $\approx n^3/3$.

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.

Algorithm 1: GP posterior with a Cholesky factor (Rasmussen & Williams, Alg. 2.1)
  1. Factor $K+\sigma_n^2I=LL^\top$ (it exists because $\sigma_n^2\gt0$).
  2. $\alpha=L^{-\top}(L^{-1}y)$ by two triangular solves; mean $\mu_t(x)=k(x)^\top\alpha$.
  3. $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).

Caveat — numerical definiteness
Rounding can make a singular PSD matrix fail Cholesky or let one with $\lambda_{\min}=-10^{-14}$ pass. A successful factorisation or a "feasible" solver status is numerical evidence, not a proof; certified work checks a margin ($M-\tau I\succ0$ with $\tau$ above an error bound) or uses exact or interval arithmetic.

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).

Where this is used
PSD order and congruence: $T=\mathrm{diag}(\lambda_i)\succeq0$ in the Module 1 notation, Module 2, Module 12, Module 13 (also $H=PP^\top$), Module 14, Module 15 (PSD lifting). Ellipsoids and square roots: Module 2, $\Sigma_{\theta_e}\succeq\Sigma$ and tube margins in Module 7 and Module 10, $\mathcal E(P,x_*)$ in Module 14, sublevel sets in Module 11. Weighted norms: Module 3, CPO, $u^\top H(x)u$ in Module 10, PID Lagrangians, neural certificates, $\lambda_{\max}(W^\top WM^{-1})$ in Module 12. Cholesky, SOS: the explorers of Module 3, Module 4 and Module 6, Module 5 and its Exercise 5.2, Module 12, SOS in Module 10.

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

Plan. Expand each quadratic form $x^\top Mx$ as a polynomial in $x_1,x_2$, then test it on well-chosen vectors. Recall the definitions: PSD means $x^\top Mx\ge0$ for all $x$; PD means $x^\top Mx\gt0$ for all $x\ne0$; indefinite means both signs occur.

Step 1 — Expand the form of $P$.

$$x^\top Px=\begin{bmatrix}x_1&x_2\end{bmatrix}\begin{bmatrix}2x_1\\0\end{bmatrix}=2x_1^2+0\cdot x_2^2=2x_1^2.$$

A real square is never negative, so $2x_1^2\ge0$ for every $x$: $P$ is PSD.

Step 2 — Show $P$ is not PD, and is singular. The nonzero vector $x=(0,1)$ gives $x^\top Px=2\cdot0^2=0$, which violates the strict inequality required for PD. Moreover $P(0,1)^\top=(0,0)^\top$, so $P$ has a nonzero null vector and $\det P=2\cdot0=0$. Classification: singular positive semidefinite.

Step 3 — Expand the form of $Q$. The off-diagonal entry $3$ appears twice (positions $(1,2)$ and $(2,1)$):

$$x^\top Qx=2x_1^2+3x_1x_2+3x_2x_1+2x_2^2=2x_1^2+6x_1x_2+2x_2^2.$$

Step 4 — Evaluate in two directions.

$$\begin{aligned}x=(1,1):&\quad 2+6+2=10\gt0,\\ x=(1,-1):&\quad 2-6+2=-2\lt0.\end{aligned}$$

The form takes both signs, so $Q$ is indefinite; the vector $(1,-1)$ witnesses the failure of PSD (and hence of PD).

Check. $\det Q=2\cdot2-3\cdot3=-5\lt0$, and the determinant is the product of the two eigenvalues, so they have opposite signs. Indeed $Q(1,1)^\top=5(1,1)^\top$ and $Q(1,-1)^\top=(2-3,3-2)^\top=-1\cdot(1,-1)^\top$, which reproduces the values $5\cdot2=10$ and $-1\cdot2=-2$ found above. For $P$ the eigenvalues are simply $2$ and $0$.

Interpretation. All entries of $Q$ are positive, but definiteness asks about every direction, including mixed-sign ones where the cross term $6x_1x_2$ is negative. A single negative value disproves PSD; a single zero at a nonzero vector disproves PD but not 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

1. Construct the factor. Seek a lower triangular matrix $L=\begin{bmatrix}\ell_{11}&0\\\ell_{21}&\ell_{22}\end{bmatrix}$ with positive diagonal and $LL^\top=P=\begin{bmatrix}4&2\\2&2\end{bmatrix}$. Multiplication gives the three equations $\ell_{11}^2=4$, $\ell_{11}\ell_{21}=2$, and $\ell_{21}^2+\ell_{22}^2=2$. Solving in that order gives $\ell_{11}=2$, $\ell_{21}=1$, and $\ell_{22}=1$. Hence $L=\begin{bmatrix}2&0\\1&1\end{bmatrix}$.

2. Solve $Px=(6,4)^\top$ without forming an inverse. Because $P=LL^\top$, first solve $Ly=(6,4)^\top$: $2y_1=6$ gives $y_1=3$, and $y_1+y_2=4$ gives $y_2=1$. Next solve $L^\top x=y$: the bottom equation is $x_2=1$, and the top is $2x_1+x_2=3$, giving $x_1=1$. Thus $x=(1,1)$; direct multiplication gives $Px=(4+2,2+2)=(6,4)$.

3. Read the determinant from the factor. The determinant of a triangular matrix is the product of its diagonal entries. Therefore $\det P=(\det L)^2=(2\cdot1)^2=4$, and $\log\det P=2(\log2+\log1)=\log4$. The positive pivots also make $L$ invertible, so $x^\top Px=\|L^\top x\|_2^2\gt0$ for every nonzero $x$: the factor verifies positive definiteness.

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

1. Remove the unequal coordinate scales. The constraint is $4x_1^2+x_2^2\le1$. Set $u=(2x_1,x_2)$; then $\|u\|_2\le1$, $x_1=u_1/2$, and $x_2=u_2$. The objective becomes $x_1+2x_2=(1/2,2)^\top u$.

2. Find an upper bound and attain it. With $w=(1/2,2)$, Cauchy–Schwarz gives $w^\top u\le\|w\|_2\|u\|_2\le\sqrt{1/4+4}=\sqrt{17}/2$. Equality holds at $u=w/\|w\|_2=(1,4)/\sqrt{17}$. Transforming back gives $x^\star=(1/(2\sqrt{17}),4/\sqrt{17})$.

3. Check both claims. At this point $4(x_1^\star)^2+(x_2^\star)^2=1/17+16/17=1$, so it is feasible. Its objective is $1/(2\sqrt{17})+8/\sqrt{17}=17/(2\sqrt{17})=\sqrt{17}/2$, meeting the upper bound. The maximum is therefore exactly $\sqrt{17}/2$.

The ellipsoid has coordinate half-widths $1/2$ and $1$. The maximizing direction is proportional to $P^{-1}(1,2)^\top=(1/4,2)^\top$, where $P=\operatorname{diag}(4,1)$. The inverse weights compensate for the constraint's unequal scales; pointing along the Euclidean objective vector would not in general attain the bound.

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.

Theorem — Singular value decomposition
Every $A\in\mathbb R^{m\times n}$ can be written $$A=U\Sigma V^\top=\sum_{i=1}^{r}\sigma_i\,u_iv_i^\top,\qquad Av_i=\sigma_iu_i,\quad A^\top u_i=\sigma_iv_i,$$ with $U\in\mathbb R^{m\times m}$, $V\in\mathbb R^{n\times n}$ orthogonal, $\Sigma$ zero except for the diagonal $\sigma_1\ge\sigma_2\ge\dots\ge0$ (the singular values) and $r=\mathrm{rank}\,A$ the number of nonzero $\sigma_i$; $v_i$ and $u_i$ are the right and left singular vectors.

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]$).

Fact — Singular values versus eigenvalues
$A^\top A=V(\Sigma^\top\Sigma)V^\top$ and $AA^\top=U(\Sigma\Sigma^\top)U^\top$ are PSD with the same nonzero eigenvalues $\sigma_i^2$, so $\sigma_i(A)=\sqrt{\lambda_i(A^\top A)}$. For $A\succeq0$ the SVD is the spectral decomposition; for symmetric $A$, $\sigma_i=|\lambda_i|$; in general only $\rho(A)\le\sigma_1$ and $|\det A|=\prod\sigma_i=\prod|\lambda_i|$ connect them.

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).

Proof sketch — why the SVD exists
$A^\top A\succeq0$ has orthonormal eigenvectors $v_i$ with eigenvalues $\lambda_i\ge0$; set $\sigma_i=\sqrt{\lambda_i}$ and $u_i=Av_i/\sigma_i$ for $\sigma_i\gt0$. Then $u_i^\top u_j=v_i^\top A^\top Av_j/(\sigma_i\sigma_j)=\delta_{ij}$, and $\sigma_i=0$ means $\|Av_i\|^2=\lambda_i=0$. Completing the $u_i$ to an orthonormal basis gives $AV=U\Sigma$.

5.1 Conditioning and the pseudo-inverse

Definition — Condition number
For invertible $A$, $\kappa(A)=\sigma_1/\sigma_n=\|A\|_2\|A^{-1}\|_2$. If $Ax=b$ with $b\ne0$ and $A(x+\Delta x)=b+\Delta b$ then $\|\Delta x\|/\|x\|\le\kappa(A)\,\|\Delta b\|/\|b\|$; floating point loses roughly $\log_{10}\kappa$ digits.

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.

Definition — Moore–Penrose pseudo-inverse
$A^+=\sum_{i=1}^{r}\sigma_i^{-1}v_iu_i^\top$. $AA^+=\sum_{i\le r}u_iu_i^\top$ projects onto $\mathrm{range}(A)$, $A^+A$ onto $\mathrm{range}(A^\top)=\mathrm{null}(A)^\perp$, and $A^+b$ is the minimum-norm least-squares solution of $Ax\approx b$. $A^+=A^{-1}$ if invertible, $(A^\top A)^{-1}A^\top$ for independent columns, $A^\top(AA^\top)^{-1}$ for independent rows; $(A^\top)^+=(A^+)^\top$.

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$.

Pitfall
$A^+$ is the pseudo-inverse, not the positive part $[\,\cdot\,]_+$ of a multiplier update. It is discontinuous at rank changes: $\mathrm{diag}(1,\epsilon)^+=\mathrm{diag}(1,1/\epsilon)$ for $\epsilon\ne0$ but $\mathrm{diag}(1,0)$ at $\epsilon=0$. Redundant policy parameters make Fisher-type matrices rank-deficient, hence natural-gradient flows written with $^+$.

5.2 Power iteration and matrix factors

Algorithm 2: Power iteration for $\sigma_1(A)=\|A\|_2$
  1. Pick a unit $x_0$ (random, so that $v_1^\top x_0\ne0$ almost surely).
  2. 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).

Where this is used
Pseudo-inverses, range conditions and nullspace bases in Module 2; the nearly singular Gram matrix of the SafeOpt explorer; $G_C(\theta)^+$ in Module 9; spectral norms in Module 12 and power iteration in its product-bound section; in Module 13 spectral norms and orthogonal retractions (comparison table), power iteration in spectral normalization and $(A^\top)^+$ in the sandwich layer; $VU^\top=I-RS$ in Module 14 ($I-RS$ itself is not an SVD); frequency-response singular values in Module 2.

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

Plan. Find the singular values from $A^\top A$, build $V$ and $U$ from them, read the norms off $\Sigma$, then map the unit circle.

Step 1 — Singular values. The singular values are the square roots of the eigenvalues of $A^\top A$:

$$A^\top A=\operatorname{diag}(2,-1)\operatorname{diag}(2,-1)=\operatorname{diag}(4,1).$$

Its eigenvalues are $4$ and $1$, so $\sigma_1=\sqrt4=2$ and $\sigma_2=\sqrt1=1$. Square roots are taken nonnegative by definition, so the sign of the eigenvalue $-1$ cannot appear here.

Step 2 — Build $V$ and $U$. The columns of $V$ are orthonormal eigenvectors of $A^\top A$: $v_1=e_1$, $v_2=e_2$, so $V=I$. The columns of $U$ are $u_i=Av_i/\sigma_i$:

$$u_1=\tfrac12\begin{bmatrix}2\\0\end{bmatrix}=\begin{bmatrix}1\\0\end{bmatrix},\qquad u_2=\tfrac11\begin{bmatrix}0\\-1\end{bmatrix}=\begin{bmatrix}0\\-1\end{bmatrix},$$

so $U=\operatorname{diag}(1,-1)$ and $\Sigma=\operatorname{diag}(2,1)$. The sign has been moved into the orthogonal factor $U$.

Step 3 — Verify the factorisation. $U^\top U=\operatorname{diag}(1,1)=I$ and $V^\top V=I$, so both are orthogonal, and

$$U\Sigma V^\top=\operatorname{diag}(1\cdot2,\,(-1)\cdot1)\,I=\operatorname{diag}(2,-1)=A.$$

Step 4 — Norms and condition number.

$$\begin{aligned}\|A\|_2&=\sigma_1=2,\\ \|A\|_F&=\sqrt{\sigma_1^2+\sigma_2^2}=\sqrt{4+1}=\sqrt5,\\ \kappa(A)&=\sigma_1/\sigma_2=2/1=2.\end{aligned}$$

The Frobenius value agrees with the entrywise definition: $\sqrt{2^2+0^2+0^2+(-1)^2}=\sqrt5$.

Step 5 — Image of the unit circle. Write $x=(\cos t,\sin t)$. Then $y=Ax=(2\cos t,-\sin t)$, and

$$\Big(\frac{y_1}{2}\Big)^2+y_2^2=\cos^2t+\sin^2t=1.$$

This is an ellipse with semi-axis $2$ along the horizontal axis and $1$ along the vertical axis, i.e. lengths $\sigma_1$ and $\sigma_2$. The minus sign only reverses the direction in which the ellipse is traced (a reflection), not its shape.

Check. $\|Ae_1\|_2=\|(2,0)\|_2=2=\|A\|_2$, so the largest stretch is attained, and $\|Ae_2\|_2=\|(0,-1)\|_2=1=\sigma_2$.

Interpretation. The eigenvalues $2,-1$ describe signed invariant directions; the singular values $2,1$ describe unsigned stretches. Norms and condition numbers are built from the latter.

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

Plan. Compute $A^+$ from the SVD of the single row, apply it to $b$, describe every solution as $x^\star$ plus a null-space vector, and compare lengths with Pythagoras.

Step 1 — SVD of the row. $AA^\top=1^2+2^2=5$, so $A$ has one singular value $\sigma=\sqrt5$, with $u=1$ and $v=A^\top/\sqrt5=(1,2)^\top/\sqrt5$. Indeed $\sigma uv^\top=\sqrt5\cdot(1,2)/\sqrt5=A$.

Step 2 — Pseudo-inverse. Inverting the nonzero singular value and swapping the factors gives

$$A^+=v\,\sigma^{-1}u^\top=\frac{1}{\sqrt5}\cdot\frac{1}{\sqrt5}\begin{bmatrix}1\\2\end{bmatrix}=\frac15\begin{bmatrix}1\\2\end{bmatrix},$$

which is the formula $A^+=A^\top(AA^\top)^{-1}$ for a matrix with independent rows.

Step 3 — The candidate solution.

$$x^\star=A^+b=\frac15\begin{bmatrix}1\\2\end{bmatrix}\cdot5=\begin{bmatrix}1\\2\end{bmatrix},\qquad Ax^\star=1+2\cdot2=5.$$

Step 4 — All solutions. The equation $x_1+2x_2=5$ has one equation and two unknowns. The null space is spanned by $n=(-2,1)$ since $An=-2+2=0$. Indeed the null space is exactly the multiples of $n$: $y_1+2y_2=0$ means $y_1=-2y_2$, so $y=y_2(-2,1)=y_2\,n$. If $Ax=5$, then $A(x-x^\star)=5-5=0$, so $x-x^\star$ lies in the null space and $x-x^\star=tn$ for some real $t$; conversely every such $x$ solves $Ax=5$:

$$x=x^\star+tn=\begin{bmatrix}1-2t\\2+t\end{bmatrix},\qquad t\in\mathbb R.$$

Step 5 — Compare lengths. Expand the squared norm:

$$\|x^\star+tn\|^2=\|x^\star\|^2+2t\,(x^\star)^\top n+t^2\|n\|^2.$$

Here $(x^\star)^\top n=1(-2)+2(1)=0$, $\|x^\star\|^2=1+4=5$ and $\|n\|^2=4+1=5$, so

$$\|x\|^2=5+5t^2\ge5,$$

with equality only at $t=0$. Hence $x^\star=(1,2)$ is the unique minimum-norm solution, of length $\sqrt5$.

Check. Take $t=1$: $x=(-1,3)$ satisfies $-1+6=5$ and has $\|x\|^2=1+9=10=5+5\cdot1^2$.

Interpretation. $x^\star$ is a multiple of $A^\top$, so it lies in the row space, which is perpendicular to the null space. Any move along the null direction keeps the equation satisfied but adds length. The pseudo-inverse picks this solution by convention; the equation alone does not single it out.

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

Plan. Evaluate the estimates, note why each is only a lower bound on $\sigma_{\max}=3$, show that dividing by a lower bound overshoots, and replace it by a guaranteed upper bound.

Step 1 — True value. $A^\top A=\operatorname{diag}(9,1)$, so $\sigma_{\max}=\sqrt9=3=\|A\|_2$.

Step 2 — Initial estimate. $\|x_0\|_2^2=\tfrac12+\tfrac12=1$, and

$$Ax_0=\frac{1}{\sqrt2}\begin{bmatrix}3\\1\end{bmatrix},\qquad \hat\sigma_0=\sqrt{\frac{9+1}{2}}=\sqrt5\approx2.2361.$$

Because $\|A\|_2=\max_{\|x\|_2=1}\|Ax\|_2$ and $x_0$ is one particular unit vector, $\hat\sigma_0\le3$ automatically.

Step 3 — One power iteration.

$$A^\top Ax_0=\frac{1}{\sqrt2}\begin{bmatrix}9\\1\end{bmatrix},\qquad \|A^\top Ax_0\|_2=\frac{\sqrt{81+1}}{\sqrt2}=\frac{\sqrt{82}}{\sqrt2}.$$

Dividing, the factors $1/\sqrt2$ cancel: $x_1=(9,1)/\sqrt{82}$, a unit vector tilted towards $e_1$.

Step 4 — New estimate.

$$Ax_1=\frac{1}{\sqrt{82}}\begin{bmatrix}27\\1\end{bmatrix},\qquad \hat\sigma_1=\sqrt{\frac{729+1}{82}}=\sqrt{\frac{730}{82}}\approx2.9837.$$

Closer to $3$, but $x_1$ is still a unit vector, so again $\hat\sigma_1\le3$; it is strictly below because $x_1$ is not parallel to $e_1$.

Step 5 — Test the proposed normalisation. $W=A/\hat\sigma_0=\operatorname{diag}(3/\sqrt5,\,1/\sqrt5)$ is diagonal, so its spectral norm is its largest absolute entry:

$$\|W\|_2=\frac{3}{\sqrt5}\approx1.3416\gt1.$$

So no, $\|W\|_2\le1$ fails. In general $\|A/\hat\sigma\|_2=\sigma_{\max}/\hat\sigma\ge1$ whenever $\hat\sigma\le\sigma_{\max}$: dividing by a lower bound can only give a ratio of at least one.

Step 6 — A guaranteed alternative. Divide by an upper bound instead. The Frobenius norm is one: $\|A\|_2^2=\sigma_1^2\le\sigma_1^2+\sigma_2^2=\|A\|_F^2$. Here $\|A\|_F=\sqrt{9+1}=\sqrt{10}\approx3.1623$ and

$$\Big\|\frac{A}{\sqrt{10}}\Big\|_2=\frac{3}{\sqrt{10}}\approx0.9487\le1.$$

In this small example the exact value $3$ is also known, and dividing by it gives norm exactly $1$.

Check. The ordering $\hat\sigma_0\lt\hat\sigma_1\lt\sigma_{\max}\lt\|A\|_F$ reads $2.236\lt2.984\lt3\lt3.162$.

Interpretation. A finite number of power iterations produces lower bounds that converge from below. A certificate such as $\|W\|_2\le1$ needs an upper bound; Frobenius (or the exact value) supplies one, at the price of some conservatism.

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

Theorem — Block elimination
If $A$ is invertible and $S=D-CA^{-1}B$ (the Schur complement of $A$), then $$\begin{bmatrix}A & B\\ C & D\end{bmatrix}=\begin{bmatrix}I & 0\\ CA^{-1} & I\end{bmatrix}\begin{bmatrix}A & 0\\ 0 & S\end{bmatrix}\begin{bmatrix}I & A^{-1}B\\ 0 & I\end{bmatrix},$$ so $\det M=\det A\det S$, $M$ is invertible iff $S$ is, and $M^{-1}=\begin{bmatrix}A^{-1}+A^{-1}BS^{-1}CA^{-1} & -A^{-1}BS^{-1}\\ -S^{-1}CA^{-1} & S^{-1}\end{bmatrix}$.

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$.

Theorem — Schur complement and definiteness (first look; Module 2 does the LMI version)
For symmetric $M=\begin{bmatrix}A & B\\ B^\top & C\end{bmatrix}$ with $C\succ0$: $M\succeq0\iff A-BC^{-1}B^\top\succeq0$, and likewise with $\succ$. With $A\succ0$ instead: $M\succeq0\iff C-B^\top A^{-1}B\succeq0$.

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$.)

Theorem — Generalised Schur complement (singular $C$)
$M\succeq0\iff C\succeq0,\ (I-CC^+)B^\top=0,\ A-BC^+B^\top\succeq0$ (Boyd & Vandenberghe, App. A.5.5, with the other corner as pivot). The range condition (columns of $B^\top$ in $\mathrm{range}(C)$) cannot be dropped: $\begin{bmatrix}a & b\\ b & 0\end{bmatrix}$ has "Schur complement" $a$, yet is PSD only if $b=0$.
Proof sketch — generalised Schur complement
For symmetric $C$, $C^+$ is symmetric and $CC^+=C^+C$ projects onto $\mathrm{range}(C)$. If the range condition holds then $BC^+C=B$, and $y=-C^+B^\top x+w$ (with $C^+CC^+=C^+$) turns the form into $x^\top(A-BC^+B^\top)x+w^\top Cw$. If it fails, some $x$ has $B^\top x\notin\mathrm{range}(C)$, so some $y\in\mathrm{null}(C)$ has $y^\top B^\top x\ne0$, and $x^\top Ax+2s\,x^\top By$ is negative for a suitable scalar $s$.
Fact — Woodbury and push-through identities
$(A+UCV)^{-1}=A^{-1}-A^{-1}U(C^{-1}+VA^{-1}U)^{-1}VA^{-1}$ when the inverses exist; rank one: $(A+uv^\top)^{-1}=A^{-1}-A^{-1}uv^\top A^{-1}/(1+v^\top A^{-1}u)$. For $\Phi\in\mathbb R^{t\times p}$, $\lambda\gt0$: $(\lambda I_p+\Phi^\top\Phi)^{-1}\Phi^\top=\Phi^\top(\lambda I_t+\Phi\Phi^\top)^{-1}$, because $\Phi^\top(\lambda I_t+\Phi\Phi^\top)=(\lambda I_p+\Phi^\top\Phi)\Phi^\top$.

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

Fact — Determinant rules
$\det(AB)=\det A\det B$, $\det A^\top=\det A$, $\det A=\prod_i\lambda_i$; $|\det A|$ is the volume factor of $x\mapsto Ax$; for $A\in\mathbb R^{n\times n}$, $\det(cA)=c^n\det A$. For $P\succ0$: $\det P\gt0$ and $\log\det P=\sum_i\log\lambda_i=2\sum_i\log L_{ii}$ ($P=LL^\top$).

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)$.

Theorem — $\det(I+AB)=\det(I+BA)$ and the matrix determinant lemma
For $A\in\mathbb R^{m\times n}$, $B\in\mathbb R^{n\times m}$: $\det(I_m+AB)=\det(I_n+BA)$ (Sylvester / Weinstein–Aronszajn), and $AB$, $BA$ share their nonzero eigenvalues. With $A=V^{-1}u$, $B=v^\top$: $\ \det(V+uv^\top)=\det V\,(1+v^\top V^{-1}u)$.

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

Fact — Trace
$\mathrm{tr}A=\sum_ia_{ii}=\sum_i\lambda_i(A)$, and $\mathrm{tr}(AB)=\sum_{ij}a_{ij}b_{ji}=\mathrm{tr}(BA)$ for $A\in\mathbb R^{m\times n}$, $B\in\mathbb R^{n\times m}$. Hence cyclic shifts are allowed, $\mathrm{tr}(ABC)=\mathrm{tr}(CAB)$ (other reorderings are not), $\mathrm{tr}(S^{-1}AS)=\mathrm{tr}A$, $x^\top Ax=\mathrm{tr}(Axx^\top)$, and $\mathrm{tr}(AB)=\mathrm{tr}(A^{1/2}BA^{1/2})\ge0$ for $A,B\succeq0$.

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$.

Worked example — why $\tfrac1n\mathrm{tr}\,G\in[0,1]$ for the non-symmetric gain $G=\bar\Sigma(\bar\Sigma+\hat\Sigma)^{-1}$

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.

Where this is used
$\mathrm{blkdiag}$ and trace in Module 2; block inverses, $\det(cA)$, log-determinants and $\det(I+AB)=\det(I+BA)$ in Module 3, the determinant lemma and Fredholm determinant in its information gain, tight frames in its Exercise 3.4; $\det(I_t+\lambda^{-1}K_t)^{1/2}$ in Module 5; total variance in Module 4, $\mathrm{trace}(\Sigma_n^{1/2})$ in Module 11, $\tfrac1{n_S}\mathrm{tr}\,G$ in Module 7 and Module 10; stacked vectors and selection matrices in Module 12 and Module 14; chordal decomposition in Module 12; block-bidiagonal factors in Module 12 and Module 13; generalised Schur complements in Module 2 and Module 13; $\langle M,yy^\top\rangle$ in Module 15.

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

Plan. Partition $M$ as $\begin{bmatrix}B&0\\0&4\end{bmatrix}$ with $B=\begin{bmatrix}2&1\\1&3\end{bmatrix}$, compute $Mz$ row by row and blockwise, then get the trace and the determinant from the blocks.

Step 1 — Product, row by row.

$$Mz=\begin{bmatrix}2\cdot1+1\cdot2+0\cdot3\\1\cdot1+3\cdot2+0\cdot3\\0\cdot1+0\cdot2+4\cdot3\end{bmatrix}=\begin{bmatrix}4\\7\\12\end{bmatrix}.$$

Step 2 — The same product, blockwise. Split $z=(z_a,z_3)$ with $z_a=(1,2)$. Block multiplication follows the same row-times-column rule, and the zero blocks kill the cross terms:

$$Mz=\begin{bmatrix}Bz_a+0\cdot z_3\\0\cdot z_a+4z_3\end{bmatrix}=\begin{bmatrix}(4,7)^\top\\12\end{bmatrix}.$$

Coordinate 3 does not influence coordinates 1–2 and vice versa.

Step 3 — Trace. Add the diagonal entries: $\operatorname{tr}M=2+3+4=9$, which is $\operatorname{tr}B+4=5+4$.

Step 4 — Determinant. Expand along the third row. It has a single nonzero entry, $4$ at position $(3,3)$, whose cofactor sign is $(-1)^{3+3}=+1$ and whose minor is $\det B$:

$$\det M=4\cdot\det\begin{bmatrix}2&1\\1&3\end{bmatrix}=4\,(2\cdot3-1\cdot1)=4\cdot5=20.$$

This is the block-diagonal rule $\det\begin{bmatrix}B&0\\0&C\end{bmatrix}=\det B\det C$ in its simplest case.

Check. The eigenvalues of $M$ are those of $B$, namely $(5\pm\sqrt5)/2$, together with $4$. Their sum is $5+4=9=\operatorname{tr}M$ and their product is $\tfrac{25-5}{4}\cdot4=5\cdot4=20=\det M$.

Interpretation. A block-diagonal matrix is two independent systems side by side: trace adds across blocks, determinant multiplies across blocks.

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

1. Complete the square. For $z=(x,y)$ the quadratic form is $ax^2+4xy+3y^2$. Since $3(y+2x/3)^2=3y^2+4xy+(4/3)x^2$, subtraction gives

$$z^\top M(a)z=(a-4/3)x^2+3(y+2x/3)^2.$$

2. Classify PSD. If $a\ge4/3$, both terms are nonnegative for every $z$, proving PSD. Conversely, choose $y=-2x/3$ so the second square vanishes. For $x\ne0$ the remaining value is negative when $a\lt4/3$. Thus PSD holds exactly for $a\ge4/3$.

3. Classify PD and the boundary. If $a\gt4/3$ and $x\ne0$, the first term is positive. If $x=0$ but $z\ne0$, then $y\ne0$ and the second term is positive. This proves PD. At $a=4/3$, the nonzero vector $z=(3,-2)$ makes both terms zero, and direct multiplication gives $M(4/3)z=(4-4,6-6)=(0,0)$. The boundary is singular PSD, not PD. For $a\lt4/3$ this same vector gives the negative value $9(a-4/3)$.

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

1. Compute the quantities used by both update formulas. For $V=\operatorname{diag}(2,1)$, $V^{-1}=\operatorname{diag}(1/2,1)$. Thus $v=V^{-1}u=(1/2,2)$ and $u^\top v=1/2+4=9/2$. The denominator $1+u^\top v=11/2$ is positive, so the rank-one inverse formula applies.

2. Update the determinant. The determinant lemma gives $\det(V+uu^\top)=\det V(1+u^\top V^{-1}u)=2(11/2)=11$. The increase in log determinant is $\log11-\log2=\log(11/2)\approx1.70475$, using natural logarithms.

3. Update the inverse entry by entry. Sherman–Morrison gives $V^{-1}-vv^\top/(11/2)$. Here $vv^\top=\begin{bmatrix}1/4&1\\1&4\end{bmatrix}$. Its entries are $1/2-(2/11)(1/4)=5/11$, $0-(2/11)(1)=-2/11$, and $1-(2/11)(4)=3/11$. Therefore

$$(V+uu^\top)^{-1}=\frac1{11}\begin{bmatrix}5&-2\\-2&3\end{bmatrix}.$$

4. Verify independently. Adding $uu^\top$ gives $V+uu^\top=\begin{bmatrix}3&2\\2&5\end{bmatrix}$, whose direct determinant is $15-4=11$. Multiplication by the proposed inverse gives $\frac1{11}\begin{bmatrix}15-4&-6+6\\10-10&-4+15\end{bmatrix}=I$. Both update results pass direct checks.

7. Orthogonal, Skew-Symmetric & Structured Matrices

7.1 Orthogonal matrices, reflections and projections

Definition — Orthogonal matrix
$Q\in\mathbb R^{n\times n}$ is orthogonal if $Q^\top Q=I$ ($Q^{-1}=Q^\top$, orthonormal columns), equivalently $\|Qx\|=\|x\|$ for all $x$. All its singular values are $1$, $\|Q\|_2=\kappa(Q)=1$, $\det Q=\pm1$, and every eigenvalue has modulus $1$; $\det Q=1$ for rotations such as $R(\theta)$, $-1$ for reflections. A tall $Q$ with $Q^\top Q=I_n$ is still an isometry, but $QQ^\top$ is only a projector.

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

Definition — Skew-symmetric matrix
$A^\top=-A$. Then $x^\top Ax=0$ for all $x$, the eigenvalues are $0$ or $\pm i\omega$, and $x^\top(I+A)x=\|x\|^2$, so $I+A$ is invertible. Every square $M$ is $\tfrac12(M+M^\top)+\tfrac12(M-M^\top)$ (symmetric plus skew), and $W-W^\top$ is skew for any $W$: a free parameterisation.
Theorem — Cayley transform (preview of Module 13)
For skew-symmetric $A$, $Q=(I-A)(I+A)^{-1}$ is orthogonal with $\det Q=1$ and no eigenvalue $-1$.

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.

Definition — Toeplitz and circulant matrices
A Toeplitz matrix is constant along diagonals, $T_{ts}=h_{t-s}$: the convolution (FIR filter) $y_t=\sum_{j=0}^{k-1}h_jx_{t-j}$ on a length-$N$ signal with zero initial values is $y=T_Nx$, lower triangular and banded. A circulant is the wrap-around (periodic) version; the discrete Fourier transform diagonalises every circulant, with eigenvalues $\hat h_k=\sum_jh_je^{-2\pi ijk/N}$.

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

Definition — Kronecker product and vec
$A\otimes B=[a_{ij}B]$. Rules: $(A\otimes B)(C\otimes D)=AC\otimes BD$, $(A\otimes B)^\top=A^\top\otimes B^\top$; the eigenvalues of $A\otimes B$ are the products $\lambda_i(A)\lambda_j(B)$, so $A,B\succeq0\Rightarrow A\otimes B\succeq0$. With $\mathrm{vec}$ stacking columns, $\mathrm{vec}(AXB)=(B^\top\otimes A)\mathrm{vec}(X)$.

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.

Where this is used
Unrolled Toeplitz convolutions in Module 12; Householder reflections, GroupSort and $\mathrm{diag}(\lambda)\otimes I_{n_g}$ in Module 12; Cayley transforms, commuting polynomials in $A$, $\tilde W-\tilde W^*$ and connected components in Module 13, orthogonal-manifold optimisation in its comparison table, $I_N\otimes Q$ in its CNN section; $I\otimes\mathrm{diag}(\mu)$ in Module 14 and banded block-Toeplitz multipliers in its Zames–Falb section; FIR filters in Primer D, convolution layers in Primer E.

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

Plan. Check $Q^\top Q=I$, deduce length preservation, test on $(3,4)$, then use the determinant to decide between rotation and reflection.

Step 1 — Orthogonality. $Q$ is diagonal, so $Q^\top=Q$, and

$$Q^\top Q=\operatorname{diag}(1\cdot1,\,(-1)(-1))=\operatorname{diag}(1,1)=I.$$

Step 2 — Length preservation for every $x$. Write the squared length as a product and insert Step 1:

$$\|Qx\|_2^2=(Qx)^\top(Qx)=x^\top Q^\top Qx=x^\top x=\|x\|_2^2.$$

Step 3 — The example.

$$Q\begin{bmatrix}3\\4\end{bmatrix}=\begin{bmatrix}1\cdot3\\-1\cdot4\end{bmatrix}=\begin{bmatrix}3\\-4\end{bmatrix},\qquad \sqrt{3^2+(-4)^2}=\sqrt{25}=5,$$

equal to $\|(3,4)\|_2=\sqrt{9+16}=5$, as Step 2 guarantees.

Step 4 — Rotation or reflection? Taking determinants in $Q^\top Q=I$ gives $(\det Q)^2=1$, so an orthogonal matrix has $\det Q=\pm1$. Every plane rotation $\begin{bmatrix}c&-s\\s&c\end{bmatrix}$ with $c^2+s^2=1$ has determinant $c^2+s^2=+1$. Here $\det Q=1\cdot(-1)-0\cdot0=-1$, so $Q$ is not a rotation. It fixes $e_1$ ($Qe_1=e_1$) and flips $e_2$ ($Qe_2=-e_2$): a reflection across the horizontal axis.

Check. Reflecting twice must return every vector: $Q^2=\operatorname{diag}(1,1)=I$.

Interpretation. Orthogonal matrices preserve lengths and angles, but they include reflections ($\det=-1$) as well as rotations ($\det=+1$).

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

Plan. Verify the two defining properties of an orthogonal projection ($P^2=P$ and $P^\top=P$), compute the error for $(3,4)$, then test the different condition $P^\top P=I$.

Step 1 — What $P$ does. $Px=\operatorname{diag}(1,0)(x_1,x_2)^\top=(x_1,0)^\top$: it keeps the horizontal component and deletes the vertical one. Its range is the horizontal axis, and it fixes that axis: $P(a,0)^\top=(a,0)^\top$.

Step 2 — Projection and orthogonality properties.

$$P^2=\operatorname{diag}(1^2,0^2)=\operatorname{diag}(1,0)=P,\qquad P^\top=P.$$

$P^2=P$ says projecting twice changes nothing. Symmetry makes the residual perpendicular to the projection for every $x$:

$$(Px)^\top(x-Px)=x^\top P^\top(I-P)x=x^\top(P-P^2)x=0.$$

Hence $P$ is the orthogonal projection onto the horizontal axis.

Step 3 — Error for $x=(3,4)$. $Px=(3,0)$ and the error is $e=x-Px=(0,4)$, with length $4$. Check perpendicularity and Pythagoras:

$$\begin{aligned}(Px)^\top e&=3\cdot0+0\cdot4=0,\\ \|Px\|^2+\|e\|^2&=9+16=25=\|x\|^2.\end{aligned}$$

Step 4 — Is $P$ an orthogonal matrix? That would require $P^\top P=I$. But $P^\top P=P^2=P=\operatorname{diag}(1,0)\ne I$. Concretely $P(0,1)^\top=(0,0)^\top$ turns a unit vector into a zero vector, so lengths are not preserved, and $\det P=0$ makes $P$ singular. So no.

Step 5 — Its operator norm. $\|Px\|_2^2=x_1^2\le x_1^2+x_2^2=\|x\|_2^2$, with equality at $(1,0)$. Hence $\|P\|_2=1$, even though $P$ is not orthogonal.

Check. The error length $4$ is the distance from $(3,4)$ to the horizontal axis, which is the vertical coordinate, as expected.

Interpretation. "Orthogonal projection" means the residual is orthogonal to the range; "orthogonal matrix" means all lengths are preserved. The two share a word, not a property: an orthogonal projection other than $I$ is never an orthogonal matrix.

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

1. Calculate this Cayley transform. For $A=\begin{bmatrix}0&-1\\1&0\end{bmatrix}$, the determinant of $I+A=\begin{bmatrix}1&-1\\1&1\end{bmatrix}$ is $2$, so $(I+A)^{-1}=\frac12\begin{bmatrix}1&1\\-1&1\end{bmatrix}$. Multiplying gives

$$Q=(I-A)(I+A)^{-1}=\frac12\begin{bmatrix}1&1\\-1&1\end{bmatrix}\begin{bmatrix}1&1\\-1&1\end{bmatrix}=\begin{bmatrix}0&1\\-1&0\end{bmatrix}.$$

Its columns are perpendicular unit vectors, hence $Q^\top Q=I$. Also $\det Q=1$ and $Q(1,0)^\top=(0,-1)^\top$, so it is a clockwise $90$ degree rotation.

2. Explain why $I+A$ is invertible for any real skew-symmetric $A$. Transposing the real scalar $w^\top Aw$ gives $w^\top A^\top w=-w^\top Aw$, so $w^\top Aw=0$. If $(I+A)w=0$, multiplying on the left by $w^\top$ gives $\|w\|_2^2+w^\top Aw=0$, and therefore $w=0$. A finite square matrix with trivial nullspace is invertible.

3. Explain the missing rotation. Suppose $Qv=-v$ and put $w=(I+A)^{-1}v$, so $v=(I+A)w$. Substitution gives $(I-A)w=-(I+A)w$, or $w-Aw=-w-Aw$. Cancelling the $Aw$ terms leaves $2w=0$, hence $v=0$. Thus no nonzero vector can have eigenvalue $-1$ for a Cayley transform with a finite real skew parameter. In particular $-I$ cannot be represented this way. In the two-dimensional example, $-I_2$ can arise as a limit by taking $A_t=tA$ and letting $t$ tend to infinity; no finite parameter attains it.

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.

Definition — $L^2$ inner product, orthonormal basis
$L^2(\mu)$ consists of the functions $f:D\to\mathbb R$ with $\int_Df^2\,d\mu\lt\infty$, where $d\mu=dx$ or a probability distribution; functions that differ only on a set of $\mu$-measure zero (zero length, zero probability) are identified. Its inner product is $\langle f,g\rangle_{L^2}=\int_Df(x)g(x)\,d\mu(x)$ (the continuous $\sum_if(x_i)g(x_i)$), with $\|f\|_{L^2}=\sqrt{\langle f,f\rangle}$; the identification is what makes $\langle f,f\rangle=0$ force $f=0$ (a function equal to $1$ at one point and $0$ elsewhere has norm $0$ for $d\mu=dx$). An orthonormal basis $(e_j)$ has $\langle e_i,e_j\rangle=\delta_{ij}$ and is complete (only $f=0$ is orthogonal to every $e_j$); then $f=\sum_jc_je_j$ with $c_j=\langle f,e_j\rangle$, the series converging in the $L^2$ norm (not necessarily at every point), and Parseval's identity $\|f\|^2=\sum_jc_j^2$ holds. The sup norm $\|f\|_\infty=\sup_x|f(x)|$ of bounded functions (the essential supremum for classes) generally does not come from an inner product: already on two independent coordinates it fails the parallelogram identity. (A one-dimensional space is an exception.)

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

Definition and theorem — Kernels and their Gram matrices
A feature map $\varphi:D\to\mathcal H$ has kernel $k(x,x')=\langle\varphi(x),\varphi(x')\rangle$ and Gram matrix $K_{ij}=k(x_i,x_j)$. Every Gram matrix is PSD: $\alpha^\top K\alpha=\|\sum_i\alpha_i\varphi(x_i)\|^2\ge0$. Conversely (Moore–Aronszajn), a symmetric $k$ with all Gram matrices PSD is the kernel of some feature map, e.g. $\varphi(x)=k(x,\cdot)$ in its RKHS.

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)

Definition — RKHS and its norm
The RKHS $\mathcal H_k$ is the Hilbert space of functions on $D$ that contains every $k(x,\cdot)$ and has the reproducing property $f(x)=\langle f,k(x,\cdot)\rangle_k$. It is the completion of the combinations $f=\sum_i\alpha_ik(x_i,\cdot)$, with $\|f\|_k^2=\alpha^\top K\alpha$. By Cauchy–Schwarz $|f(x)|\le\|f\|_k\sqrt{k(x,x)}$ at every $x$. If $\sup_xk(x,x)\le\kappa^2\lt\infty$ (the SE kernel has $\kappa=\sigma_f$), the RKHS ball $\{\|f\|_k\le B\}$ is therefore uniformly bounded, $\sup_x|f(x)|\le B\kappa$; without such a bound it need not be (for $k(x,x')=xx'$ on $\mathbb R$ the unit ball contains $f(x)=x$).

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).

Theorem — Mercer representation (statement)
Let $k$ be a continuous PSD kernel on a compact $D$ (Primer 0) and $\mu$ a finite measure with positive mass on every nonempty open set. The integral operator $(T_kf)(x)=\int k(x,y)f(y)\,d\mu(y)$ (the continuous analogue of $K$ times a vector) has $L^2(\mu)$-orthonormal eigenfunctions $e_j$ with positive eigenvalues $\lambda_1\ge\lambda_2\ge\dots$ (finitely many, or tending to $0$), and $k(x,y)=\sum_j\lambda_je_j(x)e_j(y)$. Moreover $f=\sum_ja_je_j\in\mathcal H_k$ iff $\sum_ja_j^2/\lambda_j\lt\infty$, and then $\|f\|_k^2=\sum_ja_j^2/\lambda_j$; $\{\sqrt{\lambda_j}e_j\}$ is an orthonormal basis of $\mathcal H_k$.

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.

Where this is used
Kernels and $K_t$ in Module 1 and RKHS norm bounds in its three traditions; reproducing property, completion, projection, bounded evaluation and the Fourier norm in Module 3, the design operator in GP regression, eigenvalue decay in the information gain; the RKHS orthonormal basis and Mercer coefficients in Module 5, product and Wiener kernels in its time-varying section; MMD tests in Module 7.

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

Plan. In $L^2([0,1])$ the inner product is $\langle f,g\rangle=\int_0^1f(x)g(x)\,dx$ and $\|f\|=\sqrt{\langle f,f\rangle}$; evaluate the integrals, then use linearity to choose $c$.

Step 1 — Inner product.

$$\langle f,g\rangle=\int_0^11\cdot x\,dx=\Big[\frac{x^2}{2}\Big]_0^1=\frac12.$$

Step 2 — Norms.

$$\begin{aligned}\|f\|^2&=\int_0^11\,dx=1,&\|f\|&=1,\\ \|g\|^2&=\int_0^1x^2\,dx=\Big[\frac{x^3}{3}\Big]_0^1=\frac13,&\|g\|&=\frac1{\sqrt3}\approx0.577.\end{aligned}$$

Step 3 — Choose $c$. The integral is linear, so the inner product is linear in its second argument:

$$\langle f,g-cf\rangle=\langle f,g\rangle-c\langle f,f\rangle=\frac12-c\cdot1.$$

Perpendicular means this is zero, so $c=1/2$, and $g-cf$ is the function $x-\tfrac12$. This is the vector projection formula $c=\langle f,g\rangle/\langle f,f\rangle$.

Step 4 — Verify and apply Pythagoras. Directly, $\int_0^1(x-\tfrac12)\,dx=\tfrac12-\tfrac12=0$. The squared length of the remainder is

$$\int_0^1\Big(x^2-x+\frac14\Big)dx=\frac13-\frac12+\frac14=\frac{4-6+3}{12}=\frac1{12},$$

and the two perpendicular pieces of $g=cf+(g-cf)$ recombine as

$$\|cf\|^2+\|g-cf\|^2=\frac14+\frac1{12}=\frac{3+1}{12}=\frac13=\|g\|^2.$$

Check. Cauchy–Schwarz requires $|\langle f,g\rangle|\le\|f\|\|g\|$: indeed $0.5\le1\cdot0.577$.

Interpretation. $c=1/2$ is the mean of $g$ on $[0,1]$; subtracting it leaves the zero-mean part $x-\tfrac12$. The projection algebra for vectors carries over unchanged once sums are replaced by integrals.

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

Plan. Compute the kernel from the features, fill the Gram matrix, and rewrite $\alpha^\top K\alpha$ as the squared length of one feature vector.

Step 1 — The kernel. $k(x,x^\prime)=\varphi(x)^\top\varphi(x^\prime)=1\cdot1+x\cdot x^\prime=1+xx^\prime$.

Step 2 — Gram matrix at $x_1=0$, $x_2=1$. Entry $(i,j)$ is $k(x_i,x_j)$:

$$K=\begin{bmatrix}k(0,0)&k(0,1)\\k(1,0)&k(1,1)\end{bmatrix}=\begin{bmatrix}1+0&1+0\\1+0&1+1\end{bmatrix}=\begin{bmatrix}1&1\\1&2\end{bmatrix}.$$

Step 3 — Sum of squares. Because each entry is an inner product, the double sum collapses into one squared length:

$$\alpha^\top K\alpha=\sum_{i,j}\alpha_i\alpha_j\varphi(x_i)^\top\varphi(x_j)=\Big\|\sum_i\alpha_i\varphi(x_i)\Big\|_2^2.$$

With $\varphi(0)=(1,0)$ and $\varphi(1)=(1,1)$ the weighted sum is $\alpha_1(1,0)+\alpha_2(1,1)=(\alpha_1+\alpha_2,\alpha_2)$, so

$$\alpha^\top K\alpha=(\alpha_1+\alpha_2)^2+\alpha_2^2\ge0.$$

Cross-check by expanding both sides: $\alpha^\top K\alpha=\alpha_1^2+2\alpha_1\alpha_2+2\alpha_2^2$ and $(\alpha_1+\alpha_2)^2+\alpha_2^2=\alpha_1^2+2\alpha_1\alpha_2+\alpha_2^2+\alpha_2^2$, the same polynomial. So $K$ is PSD.

Step 4 — Is it PD? A sum of two squares is zero only if both are zero: $\alpha_2=0$, and then $\alpha_1+\alpha_2=0$ forces $\alpha_1=0$. So $\alpha^\top K\alpha\gt0$ for every $\alpha\ne0$, and $K$ is PD. The reason is that $\varphi(0)$ and $\varphi(1)$ are linearly independent.

Check. Sylvester's criterion from Section 4 (all leading principal minors positive): $K_{11}=1\gt0$ and $\det K=1\cdot2-1\cdot1=1\gt0$. The eigenvalues are $(3\pm\sqrt5)/2\approx2.618,\ 0.382$, both positive.

Interpretation. Kernel matrices are PSD because they are Gram matrices of feature vectors, not because their entries look positive. They are PD exactly when the features at the chosen inputs are independent.

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

Plan. Use the explicit feature description of the RKHS to fit the data, recompute the norm with $y^\top K^{-1}y$, reconcile the two via the representer form, and finally bound $|f(x)|$ with the reproducing property.

Step 1 — Fit in feature coordinates. Since $\varphi(x)=(1,x)$ has independent components, functions in the RKHS are $f(x)=w^\top\varphi(x)=w_1+w_2x$ with $\|f\|_k^2=w_1^2+w_2^2$. The data give

$$\begin{aligned}f(0)&=w_1=1,\\ f(1)&=w_1+w_2=3\ \Rightarrow\ w_2=2.\end{aligned}$$

So $f(x)=1+2x$ and $\|f\|_k^2=1^2+2^2=5$.

Step 2 — Invert the Gram matrix. From Exercise A.8b, $K=\begin{bmatrix}1&1\\1&2\end{bmatrix}$ with $\det K=1$. The $2\times2$ inverse formula (swap the diagonal, negate the off-diagonal, divide by the determinant) gives

$$K^{-1}=\begin{bmatrix}2&-1\\-1&1\end{bmatrix},\qquad KK^{-1}=\begin{bmatrix}2-1&-1+1\\2-2&-1+2\end{bmatrix}=I.$$

Step 3 — Norm from the data. With $y=(1,3)$,

$$\begin{aligned}\alpha&=K^{-1}y=(2-3,\,-1+3)=(-1,2),\\ y^\top K^{-1}y&=y^\top\alpha=1(-1)+3(2)=5.\end{aligned}$$

Step 4 — Why both routes agree. The representer form is $f=\sum_i\alpha_ik(x_i,\cdot)$:

$$f(x)=-k(0,x)+2k(1,x)=-1+2(1+x)=1+2x,$$

the same function. Its weight vector is $w=-\varphi(0)+2\varphi(1)=-(1,0)+2(1,1)=(1,2)$, and $\|w\|^2=\alpha^\top K\alpha=\alpha^\top y=y^\top K^{-1}y$ because $K\alpha=y$. These are one norm calculation in two coordinate systems.

Step 5 — Pointwise bound. The reproducing property $f(x)=\langle f,k(x,\cdot)\rangle_k$ and Cauchy–Schwarz give

$$|f(x)|\le\|f\|_k\sqrt{k(x,x)}=\sqrt5\,\sqrt{1+x^2}.$$

The right side grows like $\sqrt5\,|x|$, because the kernel diagonal $k(x,x)=1+x^2$ is unbounded on $\mathbb R$. The function itself is unbounded too: $f(x)=1+2x\to\infty$. So no finite constant bounds $|f|$ on all of $\mathbb R$, even though $\|f\|_k=\sqrt5$ is finite.

Step 6 — Restrict the domain. On $[-1,1]$, $k(x,x)\le1+1=2$, so $|f(x)|\le\sqrt5\sqrt2=\sqrt{10}\approx3.162$ uniformly.

Check. On $[-1,1]$ the actual maximum is $|f(1)|=3\le3.162$. The bound is tight where $\varphi(x)$ is parallel to $w=(1,2)$, i.e. at $x=2$: $f(2)=5$ and $\sqrt5\sqrt{1+4}=5$. At $x=10$: $f(10)=21\le\sqrt5\sqrt{101}\approx22.47$.

Interpretation. An RKHS norm bound turns into a uniform bound only when $\sup_xk(x,x)$ is finite on the domain of interest. With an unbounded kernel diagonal, the domain must be restricted first.

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.

Quadratic Forms, Eigenvectors & the SVD

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.

Learning objectives
  • 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.

Worked example — Reconstruct displacements and carry the sensor bound

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:

$$\hat z-z=\frac12\begin{bmatrix}\eta_1+\eta_2\\\eta_1-\eta_2\end{bmatrix},\qquad \|\hat z-z\|_2=\frac{\|\eta\|_2}{\sqrt2}\le0.1\ \text{mm}.$$

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.

Worked example — Transfer to nearly redundant sensors

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:

$$\sigma_{\max,\min}=\frac{2.1\pm\sqrt{4.01}}2,\qquad \sigma_{\min}\approx0.04875,\qquad \kappa_2(H)\approx42.08.$$

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.

Common mistake — treating a convention as information

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.

Review the relevant tools

Show hint

Add the readings, then carry the two sensor errors through the same operation.

Show worked solution

1. Reconstruct the central estimate. The calibrated model is $y=Hz+\eta$ with $H=\begin{bmatrix}1&1\\1&-1\end{bmatrix}$ and readings $y=(3,-1)^\top$ millimetres. Adding the two error-free reconstruction equations gives $2\hat z_1=3+(-1)=2$; subtracting gives $2\hat z_2=3-(-1)=4$. Thus $\hat z=(1,2)^\top$ millimetres.

2. Propagate the sensor errors. Since $H^{-1}=H/2$, $\hat z-z=H\eta/2$. The first coordinate is $\hat z_1-z_1=(\eta_1+\eta_2)/2$. If each $|\eta_i|\le E$, the triangle inequality gives $|\hat z_1-z_1|\le(|\eta_1|+|\eta_2|)/2\le E$. Consequently the true displacement lies in $[1-E,1+E]$ millimetres. Equal extreme sensor errors attain both endpoints: for example $\eta_1=\eta_2=-E$ gives $z_1=1+E$.

3. Compare the entire interval with the assembly limit. With $E=0.1$, the largest compatible $z_1$ is $1.1\gt1.05$ millimetres, so the limit cannot be certified. With $E=0.04$, every compatible value obeys $z_1\le1.04\le1.05$ millimetres, so the limit is certified. These conclusions use the stated calibration and additive-error bounds. The central estimate $1$ alone does not test every displacement consistent with the readings.

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$?

Review the relevant tools

Show hint

Parameterize the line around (3,3), then impose nonnegativity on both coordinates.

Show worked solution

1. Parameterize the measurements. The equation $z_1+z_2=6$ leaves one free coordinate. Write $z_1=3+t$; substitution forces $z_2=3-t$. Every real $t$ gives a solution, and every solution has this form.

2. Minimize the length. Squaring the Euclidean norm gives $(3+t)^2+(3-t)^2=9+6t+t^2+9-6t+t^2=18+2t^2$. This is at least $18$, with equality only for $t=0$. Thus $(3,3)$ millimetres is the unique minimum-length solution. It is a choice among measurement-compatible states, not an additional measurement of the true state.

3. Apply physical nonnegativity. The two inequalities become $3+t\ge0$ and $3-t\ge0$, respectively $t\ge-3$ and $t\le3$. Hence $t\in[-3,3]$ and $z_1=3+t$ ranges over $[0,6]$ millimetres.

4. Test certification. The state $(5,1)$ has nonnegative coordinates and sums to $6$, yet $z_1=5\gt4$. It is a counterexample under both the unrestricted measurement model and its nonnegative restriction. The minimum-length estimate satisfies $z_1\le4$, but selecting that estimate does not certify the unknown physical displacement. An additional justified restriction or measurement must rule out 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$.

Review the relevant tools

Show hint

In normalized coordinates the measurement row is (2,1), with output in millimetres. Apply Cauchy–Schwarz and examine equality.

Show worked solution

1. Put the physical model into dimensionless coordinates. Substitute $p=(2\,\mathrm{mm})z_1$ and $v=(0.5\,\mathrm{mm/s})z_2$ into $y=p+(2\,\mathrm{s})v$. Seconds cancel in the second term, giving $y=(2z_1+z_2)\,\mathrm{mm}$. Therefore $\Delta y=(2\Delta z_1+\Delta z_2)\,\mathrm{mm}$.

2. Bound the ball and attain the bound. With $w=(2,1)$, Cauchy–Schwarz gives $|w^\top\Delta z|\le\|w\|_2\|\Delta z\|_2\le0.1\sqrt{2^2+1^2}=0.1\sqrt5$. Thus the largest possible absolute prediction error is $0.1\sqrt5\,\mathrm{mm}\approx0.223607\,\mathrm{mm}$. Choose $\Delta z=0.1(2,1)/\sqrt5$. Its squared length is $0.01(4+1)/5=0.01$, and its output is $0.1(4+1)/\sqrt5=0.1\sqrt5$ millimetres. Negating the direction attains the negative extreme.

3. Compare separate coordinate bounds. Replacing the ball by $|\Delta z_i|\le0.1$ gives $|\Delta y|\le2(0.1)+0.1=0.3$ millimetres. The box attains this at $(0.1,0.1)$, whose Euclidean length is $0.1\sqrt2\gt0.1$. It is therefore a valid but larger uncertainty set. The normalization scales define the geometry of the original ball; adding raw squared positions and velocities would mix incompatible units.

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$.

Review the relevant tools

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

1. Form the normal equations. Equal-weight least squares minimizes $\|y-Hz\|_2^2$. Differentiating with respect to $z$ gives $H^\top Hz=H^\top y$. Taking column dot products produces

$$H^\top H=\begin{bmatrix}1+1+0&1+1.1+0\\1+1.1+0&1+1.21+1\end{bmatrix}=\begin{bmatrix}2&2.1\\2.1&3.21\end{bmatrix},\qquad H^\top y=\begin{bmatrix}6+6.2\\6+1.1(6.2)+2.1\end{bmatrix}=\begin{bmatrix}12.2\\14.92\end{bmatrix}.$$

2. Solve by elimination. The equations are $2\hat z_1+2.1\hat z_2=12.2$ and $2.1\hat z_1+3.21\hat z_2=14.92$. Subtract $2.1$ times the first equation from $2$ times the second. The first-coordinate terms cancel, leaving $(6.42-4.41)\hat z_2=29.84-25.62$, so $2.01\hat z_2=4.22$. Hence $\hat z_2=422/201\approx2.09950249$. Back-substitution gives $\hat z_1=[12.2-2.1(422/201)]/2=261/67\approx3.89552239$ millimetres.

3. Check residual orthogonality exactly. Use the convention $r=y-H\hat z$. With denominator $201$, $\hat z=(783,422)/201$. Therefore $r_1=6-1205/201=1/201$, $r_2=6.2-[783+(11/10)422]/201=-1/201$, and $r_3=2.1-422/201=1/2010$, all in millimetres. The column products are $r_1+r_2=0$ and $r_1+1.1r_2+r_3=(10-11+1)/2010=0$, proving $H^\top r=0$ without rounding error.

4. Explain uniqueness. If $H\delta=0$, the third row forces $\delta_2=0$ and the first then forces $\delta_1=0$. Thus $H$ has independent columns. For any proposed change $\delta$, orthogonality gives $\|y-H(\hat z+\delta)\|_2^2=\|r-H\delta\|_2^2=\|r\|_2^2+\|H\delta\|_2^2$. This is strictly greater for every nonzero $\delta$, establishing the unique global minimum.

5. Compare with the teaching state. The state $(4,2)$ predicts $(6,6.2,2)$, so the recorded perturbation is $(0,0,0.1)$ millimetres. The estimate error is $\hat z-(4,2)=(-21,20)/201=(-7/67,20/201)$ millimetres. Its norm is $\sqrt{21^2+20^2}/201=29/201\approx0.144279$ millimetres. Least squares distributes the discrepancy across the readings; this particular perturbation 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

Exercise A.1 — Norms, Hölder and certified radii

Let $w=(1,-2,2)$. (a) Compute $\|w\|_1,\|w\|_2,\|w\|_\infty$ and check $\|w\|_\infty\le\|w\|_2\le\|w\|_1\le\sqrt3\|w\|_2$. (b) Find $\max w^\top\delta$ over $\|\delta\|_p\le0.1$ for $p=\infty,2,1$, with a maximiser. (c) A classifier on $784$-pixel images has $\ell_2$ certified radius $1.0$. Which $\ell_\infty$ radius does this certify, and which $\ell_2$ radius would certify $\ell_\infty$ radius $0.1$?

Show answer

(a) Compute the three norms. Absolute values give $\|w\|_1=1+2+2=5$ and $\|w\|_\infty=2$. Squaring gives $\|w\|_2=\sqrt{1+4+4}=3$. Thus $2\le3\le5\le3\sqrt3\approx5.196$, as required.

(b) Box constraint, $p=\infty$. Each $|\delta_i|\le0.1$, so $w^\top\delta=\delta_1-2\delta_2+2\delta_3\le|\delta_1|+2|\delta_2|+2|\delta_3|\le0.5$. The corner $(0.1,-0.1,0.1)$ is feasible and has objective $0.1+0.2+0.2=0.5$.

Euclidean constraint, $p=2$. Cauchy–Schwarz gives $w^\top\delta\le\|w\|_2\|\delta\|_2\le0.3$. Set $\delta=0.1w/3=(1,-2,2)/30$. Its norm is $3/30=0.1$, and $w^\top\delta=(1+4+4)/30=0.3$.

Sum-of-magnitudes constraint, $p=1$. Each coefficient of $w$ has magnitude at most $2$, so $w^\top\delta\le2\sum_i|\delta_i|\le0.2$. Both $(0,-0.1,0)$ and $(0,0,0.1)$ have 1-norm $0.1$ and objective $0.2$. Each case supplies both an upper bound and attainment, which proves the maximum rather than just proposing a direction.

(c) Convert the image certificate. For $784$ coordinates, $\|\delta\|_2^2=\sum_i\delta_i^2\le784\|\delta\|_\infty^2$, so $\|\delta\|_2\le28\|\delta\|_\infty$. Every perturbation with $\|\delta\|_\infty\le1/28$ therefore lies in the certified Euclidean radius-$1$ ball. The inherited infinity-norm radius is exactly $1/28\approx0.035714$; the rounded value $0.036$ would be slightly too large. Conversely an infinity-norm radius-$0.1$ box is contained in a Euclidean radius-$2.8$ ball. A Euclidean certificate of radius $2.8$ would thus suffice. These are conversions justified by containment; the classifier could have additional robustness beyond the stated certificate.

Exercise A.2 — Six norms of one matrix

For $B=\begin{bmatrix}1 & -2\\ 3 & 4\end{bmatrix}$ compute $\|B\|_1$, $\|B\|_\infty$, $\|B\|_F$, $\|B\|_{2\to\infty}$, $\|B\|_{1\to\infty}$ and $\|B\|_2$. Check $\|B\|_2\le\min\{\|B\|_F,\sqrt{\|B\|_1\|B\|_\infty}\}$ and $\rho(B)\le\|B\|_2$.

Show answer

1. Compute the entry-based norms. The absolute column sums are $1+3=4$ and $2+4=6$, so $\|B\|_1=6$. The absolute row sums are $1+2=3$ and $3+4=7$, so $\|B\|_\infty=7$. Squaring all entries gives $\|B\|_F=\sqrt{1+4+9+16}=\sqrt{30}$.

2. Compute the two mixed norms. For a Euclidean unit input, Cauchy–Schwarz bounds each output coordinate by its row's Euclidean length. The row lengths are $\sqrt5$ and $5$, so $\|B\|_{2\to\infty}\le5$. At $x=(3/5,4/5)$ the second output is $3(3/5)+4(4/5)=5$, proving equality. For an input with $\|x\|_1\le1$, every output magnitude is at most $4\|x\|_1$ because the largest entry magnitude is $4$. The input $(0,1)$ gives output $(-2,4)$ and attains $4$. Hence $\|B\|_{1\to\infty}=4$.

3. Compute the spectral norm from a symmetric matrix. Multiplication gives $B^\top B=\begin{bmatrix}10&10\\10&20\end{bmatrix}$. Its characteristic equation is $(10-\lambda)(20-\lambda)-100=\lambda^2-30\lambda+100=0$. The roots are $[30\pm\sqrt{900-400}]/2=15\pm5\sqrt5$. Singular values are their positive square roots, so $\|B\|_2=\sqrt{15+5\sqrt5}\approx5.117$ and $\sigma_2=\sqrt{15-5\sqrt5}\approx1.954$. Their product is $\sqrt{225-125}=10=|\det B|$.

4. Check the requested bounds. The two upper bounds are $\sqrt{30}\approx5.477$ and $\sqrt{6\cdot7}=\sqrt{42}\approx6.481$, both above $5.117$. For $B$ itself, $\det(B-\lambda I)=(1-\lambda)(4-\lambda)+6=\lambda^2-5\lambda+10$. The roots are $(5\pm i\sqrt{15})/2$, whose magnitudes are $\sqrt{25/4+15/4}=\sqrt{10}\approx3.162$. Thus $\rho(B)=\sqrt{10}\le\|B\|_2$. The symmetric spectral theorem was used for $B^\top B$; $B$ is nonsymmetric and its eigenvalue magnitudes need not equal its singular values.

Exercise A.3 — Three definiteness tests on one family

Let $P(a)=\begin{bmatrix}1 & 2 & 0\\ 2 & 5 & 2\\ 0 & 2 & a\end{bmatrix}$. (a) Run Cholesky symbolically: for which $a$ is $P(a)\succ0$? (b) Confirm with leading minors. (c) Is $P(4)$ PSD? (d) For $a=5$ solve $Px=(1,4,5)$ by triangular solves and give $\log\det P(5)$.

Show answer

(a) Match a lower triangular factor. Start with $P(a)=LL^\top$ and positive diagonal pivots. Entry $(1,1)$ gives $\ell_{11}=1$; entries $(2,1)$ and $(3,1)$ then give $\ell_{21}=2$ and $\ell_{31}=0$. Entry $(2,2)$ gives $\ell_{22}^2=5-2^2=1$, so $\ell_{22}=1$. Entry $(3,2)$ gives $\ell_{31}\ell_{21}+\ell_{32}\ell_{22}=2$, hence $\ell_{32}=2$. Finally $\ell_{33}^2=a-0^2-2^2=a-4$. All pivots are positive exactly when $a\gt4$, proving positive definiteness in that range.

(b) Check leading minors. The first two are $1$ and $1\cdot5-2\cdot2=1$. Expansion along the first row gives $\det P(a)=(5a-4)-2(2a)=a-4$. Sylvester's criterion for a real symmetric matrix therefore gives the same condition $a\gt4$.

(c) Check the boundary directly. At $a=4$ the factor $L=\begin{bmatrix}1&0&0\\2&1&0\\0&2&0\end{bmatrix}$ still satisfies $P(4)=LL^\top$. Thus $z^\top P(4)z=\|L^\top z\|_2^2\ge0$. For $z=(4,-2,1)$, $L^\top z=(4-4,-2+2,0)=(0,0,0)$, so this nonzero vector is in the nullspace. The matrix is PSD but singular. If $a\lt4$, the same vector gives quadratic value $a-4\lt0$ and disproves PSD.

(d) Solve for $a=5$. Now $\ell_{33}=1$. In $Ly=(1,4,5)^\top$, the rows give $y_1=1$, $2y_1+y_2=4$ so $y_2=2$, and $2y_2+y_3=5$ so $y_3=1$. Backward substitution in $L^\top x=y$ gives $x_3=1$, $x_2+2x_3=2$ so $x_2=0$, and $x_1+2x_2=1$ so $x_1=1$. Direct multiplication confirms $P(5)(1,0,1)^\top=(1,4,5)^\top$. All three diagonal pivots are $1$, so $\det P(5)=(1\cdot1\cdot1)^2=1$ and $\log\det P(5)=0$.

Exercise A.4 — Reading an ellipsoid

$\mathcal E=\{x:x^\top Px\le1\}$, $P=\begin{bmatrix}5 & -4\\ -4 & 5\end{bmatrix}$. (a) Semi-axes and area? (b) Farthest points from $0$? (c) Half-width of the shadow on the $x_1$-axis versus the slice $x_2=0$? (d) Is $(0.5,0.5)\in\mathcal E$? (e) Write $\mathcal E=\{Ru:\|u\|\le1\}$ with symmetric $R$.

Show answer

(a) Read the axes in an orthonormal eigenbasis. Multiplication gives $P(1,-1)^\top=9(1,-1)^\top$ and $P(1,1)^\top=(1,1)^\top$. Normalize to $q_1=(1,-1)/\sqrt2$ and $q_2=(1,1)/\sqrt2$. Writing $x=\xi_1q_1+\xi_2q_2$ turns the constraint into $9\xi_1^2+\xi_2^2\le1$, or $\xi_1^2/(1/3)^2+\xi_2^2/1^2\le1$. Thus the semi-axes are $1/3$ and $1$, and the area is $\pi(1/3)(1)=\pi/3$.

(b) Find the farthest points. Orthonormality gives $\|x\|_2^2=\xi_1^2+\xi_2^2\le9\xi_1^2+\xi_2^2\le1$. Equality requires $\xi_1=0$ and $\xi_2^2=1$, so the farthest points are $\pm q_2$, both at distance $1$.

(c) Distinguish the shadow from the slice. For a fixed $x_1$, the shadow allows any $x_2$ satisfying the constraint. Complete the square:

$$5x_1^2-8x_1x_2+5x_2^2=5(x_2-4x_1/5)^2+\frac95x_1^2.$$

The minimum over $x_2$ occurs at $x_2=4x_1/5$, so a feasible $x_2$ exists exactly when $(9/5)x_1^2\le1$. The shadow half-width is $\sqrt5/3\approx0.745356$. In the slice $x_2=0$, the condition instead is $5x_1^2\le1$, giving half-width $1/\sqrt5\approx0.447214$. The ellipse's tilt lets its shadow extend beyond that slice.

(d) Test the point. At $(0.5,0.5)$ the quadratic value is $5(0.25)-8(0.25)+5(0.25)=1.25-2+1.25=0.5\le1$, so the point is inside.

(e) Construct the symmetric map from a ball. Scale the $q_1$ direction by $1/3$ and the $q_2$ direction by $1$. This gives

$$R=\frac13q_1q_1^\top+q_2q_2^\top=\frac13\begin{bmatrix}2&1\\1&2\end{bmatrix},\qquad R^2=\frac19\begin{bmatrix}5&4\\4&5\end{bmatrix}=P^{-1}.$$

In the same eigenbasis, $RPR=I$, so $x=Ru$ has $x^\top Px=\|u\|_2^2$. Conversely $R$ is invertible and $u=R^{-1}x$ has this same equality. Both directions prove $\mathcal E=\{Ru:\|u\|_2\le1\}$, rather than only showing inclusion.

Exercise A.5 — Pseudo-inverse and a range condition

Let $C=\begin{bmatrix}1 & 2\\ 2 & 4\end{bmatrix}$, $b=(1,0)$. (a) SVD, rank and $C^+$? (b) Compute $x=C^+b$ and show $b-Cx\perp\mathrm{range}(C)$. (c) Is $b\in\mathrm{range}(C)$? (d) For which $a\in\mathbb R$, $\beta\in\mathbb R^2$ is $M=\begin{bmatrix}a & \beta^\top\\ \beta & C\end{bmatrix}\succeq0$?

Show answer

(a) Factor the rank-one matrix. Let $u=(1,2)/\sqrt5$ and $v=(-2,1)/\sqrt5$. They are perpendicular unit vectors, and $C=5uu^\top$. Thus an SVD is $U=V=[u\ v]$, $\Sigma=\operatorname{diag}(5,0)$. Exactly one singular value is nonzero, so the rank is $1$. Invert the nonzero singular value and leave the zero one at zero: $C^+=(1/5)uu^\top=C/25$.

(b) Compute and check the residual. For $b=(1,0)$, $x=C^+b=(1,2)/25$. Then $Cx=(1/5,2/5)$ and $b-Cx=(4/5,-2/5)$. The range of $C$ is the line spanned by $(1,2)$, and the residual's dot product with that direction is $4/5+2(-2/5)=0$. Therefore the residual is perpendicular to the whole range.

(c) Decide range membership. If $(1,0)=q(1,2)$, the first coordinate forces $q=1$ while the second forces $q=0$, a contradiction. Hence $b$ is not in the range, consistent with the nonzero residual.

(d) Prove the range condition before taking a Schur complement. Write a vector for the block form as $(t,z)$, with $z\in\mathbb R^2$. Its value is $at^2+2t\beta^\top z+z^\top Cz$. The null vector $n=(2,-1)$ satisfies $Cn=0$. Taking $t=1$ and $z=sn$ leaves $a+2s\beta^\top n$. If $\beta^\top n\ne0$, choosing $s$ with a large opposite sign makes this negative. PSD therefore requires $2\beta_1-\beta_2=0$, or $\beta=q(1,2)$.

Under that condition let $h=z_1+2z_2$. Then $z^\top Cz=h^2$ and $\beta^\top z=qh$, so the block form becomes

$$at^2+2qth+h^2=(h+qt)^2+(a-q^2)t^2.$$

It is nonnegative for all $t,z$ when $a\ge q^2$. Conversely, $t=1$ and any $z$ with $h=-q$ make the first square zero, so PSD requires $a\ge q^2$. Hence the exact answer is $\beta=q(1,2)$ and $a\ge q^2$. This also agrees with $C^+\beta=(q/5,2q/5)$ and $\beta^\top C^+\beta=q^2$. For the forbidden choice $\beta=(1,0)$, the test vector $(1,s(2,-1))$ gives $a+4s$, negative whenever $s\lt-a/4$, no matter how $a$ is chosen.

Exercise A.6 — A log-determinant built one point at a time

A kernel gives $K=\begin{bmatrix}1 & 0.5\\ 0.5 & 1\end{bmatrix}$ at two inputs; $\lambda=0.5$. (a) Compute $\det(I+K/\lambda)$. (b) Compute it as a product: the first point contributes $1+k(x_1,x_1)/\lambda$, the second $1+\sigma_1^2(x_2)/\lambda$ with $\sigma_1^2(x_2)=k(x_2,x_2)-k(x_2,x_1)^2/(k(x_1,x_1)+\lambda)$. (c) Evaluate $\tfrac12\log\det(I+K/\lambda)$. (d) Why must (a) and (b) agree?

Show answer

(a) Compute the determinant directly. Dividing each kernel entry by $\lambda=1/2$ and adding the identity gives $I+K/\lambda=\begin{bmatrix}3&1\\1&3\end{bmatrix}$. Its determinant is $3\cdot3-1\cdot1=8$.

(b) Add the observations sequentially. The first factor is $1+k(x_1,x_1)/\lambda=1+1/(1/2)=3$. Before observing the second point, its variance is

$$\sigma_1^2(x_2)=1-\frac{(1/2)^2}{1+1/2}=1-\frac{1/4}{3/2}=1-\frac16=\frac56.$$

The second factor is $1+(5/6)/(1/2)=1+5/3=8/3$. Multiplying gives $3(8/3)=8$, the same determinant.

(c) Take the logarithm. The quantity is $(1/2)\log8\approx1.03972$ nats. The unit is nats because the logarithm is natural; bits would require base two.

(d) Explain why the two computations agree. Write $a=k(x_1,x_1)+\lambda$ and $b=k(x_2,x_1)$. The determinant of $K+\lambda I$ factors as $a[k(x_2,x_2)+\lambda-b^2/a]=a[\lambda+\sigma_1^2(x_2)]$. Since $I+K/\lambda=(K+\lambda I)/\lambda$ is two-dimensional, its determinant divides this expression by $\lambda^2$. The result is precisely $(1+k(x_1,x_1)/\lambda)(1+\sigma_1^2(x_2)/\lambda)$. In larger finite Gram matrices, block elimination applies the same Schur-complement factor at each added observation, so the determinant ratios telescope into the sequential product. Positive $\lambda$ keeps these elimination blocks invertible.

Exercise A.7 — A generalised eigenvalue behind a layer-wise Lipschitz bound

Let $W=\begin{bmatrix}1 & 1\end{bmatrix}$, $M=\mathrm{diag}(1,2)$. (a) Show that $W^\top WM^{-1}$ is not symmetric but has real nonnegative eigenvalues; compute them. (b) Find the largest $F\ge0$ with $M-FW^\top W\succeq0$ and check it with the $2\times2$ test. (c) Where is $(x_1+x_2)^2/(x_1^2+2x_2^2)$ maximal?

Show answer

(a) Compute the eigenvalues and explain their sign. Here $W^\top W=\begin{bmatrix}1&1\\1&1\end{bmatrix}$ and $M^{-1}=\operatorname{diag}(1,1/2)$, so $A=W^\top WM^{-1}=\begin{bmatrix}1&1/2\\1&1/2\end{bmatrix}$ is not symmetric. Its trace is $3/2$ and determinant is zero; the characteristic polynomial is $\lambda^2-(3/2)\lambda=\lambda(\lambda-3/2)$. Thus its eigenvalues are $0$ and $3/2$.

For a structural explanation, put $g=M^{-1/2}W^\top=(1,1/\sqrt2)^\top$. Then $S=M^{-1/2}W^\top WM^{-1/2}=gg^\top$ is symmetric PSD, and $A=M^{1/2}SM^{-1/2}$ is similar to $S$. Similar matrices have the same eigenvalues; $gg^\top$ has eigenvalue $\|g\|_2^2=3/2$ along $g$ and zero perpendicular to $g$.

(b) Find the largest feasible $F$. Congruence by the invertible $M^{-1/2}$ preserves PSD and turns $M-FW^\top W$ into $I-Fgg^\top$. Its eigenvalues are $1-(3/2)F$ and $1$, so for $F\ge0$ it is PSD exactly when $F\le2/3$. The largest feasible value is $F=2/3$. Directly,

$$M-FW^\top W=\begin{bmatrix}1-F&-F\\-F&2-F\end{bmatrix},\qquad\det= (1-F)(2-F)-F^2=2-3F.$$

For $0\le F\le2/3$ both diagonal entries are nonnegative and the determinant is nonnegative, satisfying the symmetric $2$ by $2$ PSD test. At $F=2/3$ the diagonal entries are $1/3$ and $4/3$ and the determinant is zero. Above it the negative determinant rules out PSD.

(c) Find where the ratio is maximal. The ratio is defined for $x\ne0$. Set $u=M^{1/2}x$, so $x^\top Mx=\|u\|_2^2$ and $Wx=g^\top u$. Cauchy–Schwarz gives $(g^\top u)^2/\|u\|_2^2\le\|g\|_2^2=3/2$. Equality holds precisely when $u$ is a nonzero multiple of $g$, hence when $x$ is a nonzero multiple of $M^{-1}W^\top=(1,1/2)^\top$. At that vector the numerator is $(3/2)^2=9/4$ and denominator is $1+2(1/2)^2=3/2$, giving ratio $3/2$.

The reciprocal optimum $1/F=3/2$ is the squared gain from the input norm $\|x\|_M=\sqrt{x^\top Mx}$ to the scalar output norm, giving gain $\sqrt{3/2}$. The ordinary Euclidean norm of this row is instead $\sqrt2$. Reporting the input metric is essential when using this generalized-eigenvalue step in the Module 12 layer-wise calculation.

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

ResourceTypeRead it for
Introduction to Linear Algebra (Strang), 6th ed.Textbook, Wellesley-Cambridge 2023Refreshing the first course: eigenvalues, positive definiteness, SVD.
Essence of Linear Algebra (Sanderson, 3Blue1Brown)Video series, 2016Pictures: linear maps, determinants as volume, eigenvectors.
Linear Algebra Done Right (Axler), 4th ed.Textbook, Springer 2024, open accessInner-product spaces, adjoints, spectral theorem, positive operators, SVD, with proofs.
Introduction to Applied Linear Algebra (Boyd, Vandenberghe)Textbook, Cambridge 2018, free PDFNorms, distances, least squares and pseudo-inverses, computationally.
Convex Optimization (Boyd, Vandenberghe), App. ATextbook, Cambridge 2004, free PDFDual 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 2012Norms, Hermitian and positive definite matrices, Loewner order, inertia.
The Matrix Cookbook (Petersen, Pedersen)Reference, version Nov. 2012Identities: Woodbury, determinant lemma, trace, Kronecker.
Gaussian Processes for Machine Learning (Rasmussen, Williams)Textbook, MIT Press 2006, free PDFAlgorithm 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 2018RKHS, feature maps, Mercer expansions: the bridge to Module 3.

Flashcards