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 $\max_{\|u\|\le u_{\max}}b^\top u=u_{\max}\|b\|$. A logit difference is $(e_y-e_j)^\top f$ with $\|e_y-e_j\|=\sqrt2$, so an $L$-Lipschitz $f$ moves the margin by at most $\sqrt2L\|\delta\|$ (the $\sqrt2$ of Module 12's certified radius). For $H\succ0$, $u^\top H^{-1}v$ is an inner product, and for CPO's $q=g^\top H^{-1}g$, $r=g^\top H^{-1}b$, $s=b^\top H^{-1}b$ Cauchy–Schwarz reads $qs\ge r^2$.

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
For $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 states its Lipschitz constants in the 1-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, $\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
To certify the $\ell_\infty$ ball of radius $\varepsilon$ you need an $\ell_2$ certificate of radius $\sqrt n\,\varepsilon$, not $\varepsilon$. All norms on $\mathbb R^n$ are equivalent up to such constants; in infinite dimensions they are not (Section 8).

Covering numbers. A cube of side $s$ lies in the $\ell_2$ ball of radius $s\sqrt d/2$ about its centre. Cutting $[0,1]^d$ into $m^d$ cubes with $m=\lceil\sqrt d/(2\tau)\rceil$ covers it by $m^d$ balls of radius $\tau$; their centres form a $\tau$-net, and the fewest balls that suffice is the covering number $M(\tau,[0,1]^d)$. For $\tau=0.1$: $64$ balls in $d=2$, about $1.1\times10^{12}$ in $d=10$. If an $L$-Lipschitz function has margin $m_0$ at every net point, its margin is at least $m_0-L\tau$ everywhere (Primer B).

1.5 Metrics, balls and distances to sets

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. A signed distance to a closed set equals $\mathrm{dist}(x,C)$ on one side of the boundary and $-\mathrm{dist}(x,\text{complement})$ on the other; which side is positive is a declared convention (reachability modules put the safe side positive). It vanishes on the boundary, so "$\ell\gt0$" and "$\ell\ge0$" differ exactly there. The Hausdorff distance $d_H(A,B)=\max\{\sup_{a\in A}\mathrm{dist}(a,B),\sup_{b\in B}\mathrm{dist}(b,A)\}$ compares nonempty compact sets, e.g. $d_H([0,1],[0,2])=1$.

Isometric embeddings. $E:D\to\mathbb R^m$ is isometric if $\|E(x)-E(x')\|=d(x,x')$; e.g. a line $E(t)=x_0+tu$ with $\|u\|=1$. A kernel that depends only on distance, $k=\kappa(d(x,x'))$, is unchanged under such a map; a learned nonlinear embedding is generally not isometric and changes which points count as close.

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

Dot product: $x^\top y=2(1)+(-1)(2)+2(0)=0$. Both vectors are nonzero, so a zero dot product means perpendicular in the standard Euclidean inner product.

Lengths: $\|x\|_1=2+1+2=5$; $\|x\|_2=\sqrt{4+1+4}=3$; $\|x\|_\infty=2$. The negative coordinate contributes positively to each length.

Check: $2\le3\le5\le3\sqrt3$, as the norm-comparison inequalities require. The norm is a size, whereas the dot product also captures direction.

Exercise A.1b — Medium: Find the worst perturbation in two balls

For $w=(3,-4)$, maximise $w^\top\delta$ subject first to $\|\delta\|_\infty\le0.2$ and then to $\|\delta\|_2\le0.2$. Give a maximiser in each case and verify it.

Review: Vectors, norms and worst-case directions

Show hint

For a box choose each sign separately. For the Euclidean ball align $\delta$ with $w$.

Show worked solution

Box upper bound: $3\delta_1-4\delta_2\le3|\delta_1|+4|\delta_2|\le7(0.2)=1.4$. Taking $\delta=(0.2,-0.2)$ is feasible and attains $0.6+0.8=1.4$.

Euclidean upper bound: Cauchy–Schwarz gives $w^\top\delta\le\|w\|_2\|\delta\|_2=5(0.2)=1$. Take $\delta=0.2w/5=(0.12,-0.16)$. Its norm is $\sqrt{0.0144+0.0256}=0.2$, and the objective is $0.36+0.64=1$.

Interpret: the box includes its corners, whose Euclidean lengths exceed $0.2$. The larger maximum is consistent with the larger feasible region; using the same numerical radius in two norms does not describe the same perturbations.

Exercise A.1c — Hard: Prove that distance cannot change too fast

Let $C$ be a nonempty closed subset of $\mathbb R^n$. Prove $|\operatorname{dist}(x,C)-\operatorname{dist}(y,C)|\le\|x-y\|$. Compute the distance from $(3,4)$ to the closed unit disc, and bound its change after a displacement of Euclidean length at most $0.1$.

Review: Vectors, norms and worst-case directions

Show hint

Choose a closest point in $C$ to $y$, apply the triangle inequality, then interchange $x$ and $y$. A nearest point exists for a closed nonempty set in finite dimensions.

Show worked solution

One direction: let $c_y\in C$ minimise distance to $y$. Then $\operatorname{dist}(x,C)\le\|x-c_y\|\le\|x-y\|+\|y-c_y\|=\|x-y\|+\operatorname{dist}(y,C)$.

Symmetry: exchanging $x$ and $y$ bounds the opposite difference. Combining the two inequalities proves the absolute-value bound. The argument also works without closedness using points within any positive tolerance of the infimum.

Disc: $\|(3,4)\|_2=5$. For any $c$ with $\|c\|\le1$, reverse triangle gives $\|(3,4)-c\|\ge5-1=4$. The radial point $c=(3/5,4/5)$ attains it, so the distance is $4$.

Perturbation: the proved inequality puts the new distance in $[3.9,4.1]$. This is a guarantee for every displacement of length at most $0.1$, independent of its direction.

2. Matrix Norms & Operator Norms

A matrix is a map $x\mapsto Ax$; its most useful size is the largest factor by which it stretches a vector, i.e. the Lipschitz constant of the map.

Definition — Induced (operator) norm
For $A\in\mathbb R^{m\times n}$ with 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
$\|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$, and 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. $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

Column sums: $1+0=1$ and $2+3=5$, so $\|A\|_1=5$. Row sums: $1+2=3$ and $0+3=3$, so $\|A\|_\infty=3$.

Frobenius: square every entry and add: $\|A\|_F=\sqrt{1+4+0+9}=\sqrt{14}$. This counts the entries as one long vector; it is a different norm from the two induced norms.

Attainment: $\|x\|_1=1$ and $Ax=(-2,3)$ has 1-norm $5$. Thus $\|Ax\|_1\le5\|x\|_1$ is tight here. Negative entries must be replaced by absolute values when summing columns.

Exercise A.2b — Medium: Compare a product bound with the actual product

Let $A=\operatorname{diag}(3,1/2)$ and $B=\operatorname{diag}(1/2,3)$. Compute their spectral norms, $AB$, and $\|AB\|_2$. Explain the gap from $\|A\|_2\|B\|_2$.

Review: Matrices as maps and norm bounds

Show hint

A diagonal matrix stretches each coordinate separately. Its spectral norm is the largest absolute diagonal entry.

Show worked solution

Individual stretches: $\|A\|_2=\|B\|_2=3$, hence the product theorem gives $\|AB\|_2\le9$.

Actual composition: multiply corresponding diagonal entries to obtain $AB=\operatorname{diag}(3/2,3/2)=(3/2)I$. Therefore $\|ABx\|_2=(3/2)\|x\|_2$ for every $x$, and $\|AB\|_2=1.5$.

Reason for the gap: B stretches the second coordinate most, but A shrinks that coordinate by $1/2$. The two largest individual stretches do not align through the composition. Submultiplicativity gives a valid upper bound, with no promise of equality.

Exercise A.2c — Hard: Bound a truncated matrix geometric series

For $A=\operatorname{diag}(1/2,1/4)$, compute $(I-A)^{-1}$. Let $S_T=\sum_{k=0}^{T-1}A^k$. Find the exact spectral norm of $(I-A)^{-1}-S_T$ and the smallest $T$ making it at most $0.01$.

Review: Matrices as maps and norm bounds

Show hint

Apply the scalar geometric-tail formula to each diagonal entry, then take the larger tail.

Show worked solution

Inverse: $I-A=\operatorname{diag}(1/2,3/4)$, so $(I-A)^{-1}=\operatorname{diag}(2,4/3)$. The Neumann-series hypothesis holds because $\|A\|_2=1/2\lt1$.

Remainder: summing each diagonal series leaves $\operatorname{diag}(2(1/2)^T,(4/3)(1/4)^T)$. For $T\ge0$ the first entry is at least the second, because their ratio is $(3/2)2^T\ge1$. Thus the exact norm is $2^{1-T}$.

Threshold: require $2^{1-T}\le0.01$, equivalently $2^T\ge200$. Since $2^7=128$ and $2^8=256$, the smallest integer is $T=8$. The remainders are $0.015625$ at $T=7$ and $0.0078125$ at $T=8$.

Check the indexing: eight terms means powers $A^0$ through $A^7$; the first omitted term is $A^8$. Here the general norm tail bound is attained by the first coordinate.

3. Symmetric Matrices & the Spectral Theorem

In a first course eigenvalues can be complex (a rotation has no real ones) and eigenvectors can be missing (the shear $\begin{bmatrix}1 & 1\\ 0 & 1\end{bmatrix}$ has one direction). Symmetric matrices, $A=A^\top$, have neither problem, and every certificate matrix in the modules is symmetric.

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 $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: a symmetric matrix is a pure stretch along perpendicular axes (here by $3$ along the diagonal, by $1$ across it), with no rotation or shear.

Functions of a symmetric matrix. $f(A)=Qf(\Lambda)Q^\top=\sum_if(\lambda_i)q_iq_i^\top$ agrees with powers, polynomials and $A^{-1}$ (all $\lambda_i\ne0$), gives $(A+\eta I)^{-1}=\sum_i(\lambda_i+\eta)^{-1}q_iq_i^\top$ (all $\lambda_i+\eta\ne0$) and square roots (Section 4). Functions of one $A$ share its eigenvectors, so comparing them reduces to comparing scalars eigenvalue by eigenvalue: for $K\succeq0$ and $\eta\gt0$, $K(K+\eta I)^{-1}$ has eigenvalues $\lambda_i/(\lambda_i+\eta)\in[0,1)$.

Theorem — Rayleigh quotient
For $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

First direction: $A(1,1)^\top=(4,4)^\top=4(1,1)^\top$, so $Aq_+=4q_+$. Second: $A(1,-1)^\top=(2,-2)^\top=2(1,-1)^\top$, so $Aq_-=2q_-$.

Normalisation: each original vector has squared length $2$, so dividing by $\sqrt2$ makes length $1$. Their dot product is $(1-1)/2=0$. Thus they are orthonormal.

Decomposition: $A=4q_+q_+^\top+2q_-q_-^\top$. Multiplying the outer products gives $\tfrac42\begin{bmatrix}1&1\\1&1\end{bmatrix}+\tfrac22\begin{bmatrix}1&-1\\-1&1\end{bmatrix}=A$. These are stretches along perpendicular axes.

Exercise A.3b — Medium: Use the Rayleigh bound and recognise equality

For the matrix of the Easy exercise and $x=(1,2)$, compute $x^\top Ax$ and the Rayleigh quotient. Check the eigenvalue bounds, then give directions attaining both bounds.

Review: Eigenvectors, quadratic forms and spectral limits

Show hint

The Rayleigh quotient divides the quadratic form by $x^\top x$, so you need not normalise $x$ explicitly.

Show worked solution

Multiply: $Ax=(5,7)$ and $x^\top Ax=1(5)+2(7)=19$. Also $x^\top x=1+4=5$, so the quotient is $19/5=3.8$.

Bounds: the extreme eigenvalues are $2$ and $4$, hence $2\|x\|^2\le x^\top Ax\le4\|x\|^2$. Numerically $10\le19\le20$, or $2\le3.8\le4$ after division by $5$.

Equality: any nonzero multiple of $(1,-1)$ has quotient $2$, and any nonzero multiple of $(1,1)$ has quotient $4$. The inequality is strict at $(1,2)$ because it has nonzero components in both eigendirections.

Exercise A.3c — Hard: Positive eigenvalues can hide a negative quadratic form

For $N=\begin{bmatrix}1&4\\0&1\end{bmatrix}$, compute its eigenvalues and $x^\top Nx$ at $x=(1,-1)$. Find the symmetric part $S=(N+N^\top)/2$ and its eigenvalues. Explain why the spectral theorem cannot be applied to N.

Review: Eigenvectors, quadratic forms and spectral limits

Show hint

For an upper triangular matrix, the eigenvalues are on the diagonal. A real quadratic form uses only the symmetric part.

Show worked solution

Eigenvalues of N: $\det(N-\lambda I)=(1-\lambda)^2$, so both are $1$. However $Nx=(-3,-1)$ and $x^\top Nx=-3+1=-2$.

Symmetric part: $S=\begin{bmatrix}1&2\\2&1\end{bmatrix}$. Its eigenvalues are $3$ along $(1,1)$ and $-1$ along $(1,-1)$. The negative form at $x$ is $-1\cdot\|x\|^2=-2$.

Why this happens: writing $N=S+K$ with $K^\top=-K$ gives $x^\top Kx=-(x^\top Kx)$ after transposing the scalar, so this term is zero. Thus $x^\top Nx=x^\top Sx$.

Assumption audit: N is not symmetric. Its positive eigenvalues do not imply nonnegative quadratic forms or an orthonormal eigenbasis. The positivity tests stated for symmetric matrices must be applied to S here.

4. Positive (Semi)Definite Matrices & Quadratic Forms

A quadratic form is $q(x)=x^\top Px=\sum_{ij}p_{ij}x_ix_j$; only the symmetric part of $P$ matters, so take $P\in\mathbb S^n$. In the plane, if $p_{11}\gt0$, completing the square gives $$q(x)=p_{11}\Big(x_1+\frac{p_{12}}{p_{11}}x_2\Big)^2+\Big(p_{22}-\frac{p_{12}^2}{p_{11}}\Big)x_2^2,$$ so $q\gt0$ for all $x\ne0$ iff $p_{11}\gt0$ and $p_{11}p_{22}-p_{12}^2\gt0$. The second coefficient is our first Schur complement (Section 6).

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$. The level sets $q=1$ are ellipses (PD), parallel lines (singular PSD) or hyperbolas (indefinite): 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

P: $x^\top Px=2x_1^2\ge0$, so P is PSD. At nonzero $x=(0,1)$ the form is $0$, so P is not PD and is singular.

Q: at $x=(1,1)$, the form is $2+6+2=10\gt0$. At $x=(1,-1)$, it is $2-6+2=-2\lt0$. Since both signs occur, Q is indefinite.

Interpret: all entries of Q are positive, but definiteness asks about every direction, including mixed-sign directions. A single negative value disproves PSD; a single zero at a nonzero vector disproves PD but does not by itself disprove PSD.

Exercise A.4b — Medium: Solve with a Cholesky factor

Factor $P=\begin{bmatrix}4&2\\2&2\end{bmatrix}=LL^\top$ with L lower triangular and positive diagonal. Use two triangular solves to solve $Px=(6,4)^\top$, and compute $\log\det P$.

Review: Definiteness, factors and ellipsoid support

Show hint

Set $L_{11}=\sqrt4$, then obtain $L_{21}$ from the off-diagonal entry and $L_{22}$ from the remaining diagonal.

Show worked solution

Factor: $L_{11}=2$, $L_{21}=2/2=1$, and $L_{22}=\sqrt{2-1^2}=1$, giving $L=\begin{bmatrix}2&0\\1&1\end{bmatrix}$. Positive pivots establish that P is PD.

Forward solve: $Ly=(6,4)^\top$ gives $2y_1=6$, hence $y_1=3$, followed by $y_1+y_2=4$, hence $y_2=1$.

Backward solve: $L^\top x=y$ gives $x_2=1$ and $2x_1+x_2=3$, so $x=(1,1)$. Direct check: $Px=(6,4)^\top$.

Log determinant: $\det P=(\det L)^2=(2\cdot1)^2=4$, so $\log\det P=2(\log2+\log1)=\log4$. No matrix inverse was needed.

Exercise A.4c — Hard: Maximise a linear margin over an ellipsoid

Let $P=\operatorname{diag}(4,1)$ and $\mathcal E=\{x:x^\top Px\le1\}$. Find $\max_{x\in\mathcal E}(x_1+2x_2)$, a maximiser, and the two semi-axis lengths. Derive the maximum rather than only citing the formula.

Review: Definiteness, factors and ellipsoid support

Show hint

Change variables to $u=P^{1/2}x$. The constraint becomes a unit ball and the objective becomes an inner product.

Show worked solution

Coordinates: $u=(2x_1,x_2)$, so $\|u\|_2\le1$ and $x_1+2x_2=(1/2,2)^\top u$. The coefficient vector has norm $\sqrt{1/4+4}=\sqrt{17}/2$.

Upper bound and attainment: Cauchy–Schwarz gives objective at most $\sqrt{17}/2$. Equality holds at $u=(1,4)/\sqrt{17}$, which has unit norm.

Transform back: $x^\star=(1/(2\sqrt{17}),4/\sqrt{17})$. Feasibility check: $4(x_1^\star)^2+(x_2^\star)^2=1/17+16/17=1$. The objective is $1/(2\sqrt{17})+8/\sqrt{17}=\sqrt{17}/2$.

Geometry: $4x_1^2+x_2^2\le1$ has semi-axis lengths $1/2$ and $1$. The maximiser points along $P^{-1}(1,2)^\top$, not generally along the Euclidean vector $(1,2)$.

5. The Singular Value Decomposition

Eigenvalues can be complex and say little about stretching. The SVD exists for every matrix, rectangular or not, and describes exactly how it stretches.

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

SVD: choose $U=\operatorname{diag}(1,-1)$, $\Sigma=\operatorname{diag}(2,1)$ and $V=I$. Both U and V are orthogonal and their product gives $A$.

Stretches: $A^\top A=\operatorname{diag}(4,1)$, whose eigenvalues have square roots $2$ and $1$. Thus $\|A\|_2=2$, $\|A\|_F=\sqrt{4+1}=\sqrt5$, and $\kappa(A)=2/1=2$.

Geometry: the unit circle becomes an ellipse with semi-axis lengths $2$ and $1$. The second coordinate is reflected, but its length is preserved. The eigenvalues $2,-1$ describe signed invariant directions; the singular values $2,1$ describe unsigned stretches.

Exercise A.5b — Medium: Solve an underdetermined system with minimum length

Let $A=\begin{bmatrix}1&2\end{bmatrix}$ and $b=5$. Compute $A^+$, find $x^\star=A^+b$, and prove it is the minimum Euclidean norm solution of $Ax=5$.

Review: Singular values, least squares and power iteration

Show hint

For a nonzero row, $A^+=A^\top/(AA^\top)$. All other solutions differ by a vector in the null space.

Show worked solution

Pseudo-inverse: $AA^\top=1^2+2^2=5$, so $A^+=(1,2)^\top/5$. Therefore $x^\star=(1,2)$ and $Ax^\star=1+4=5$.

All solutions: the null direction is $n=(-2,1)$ because $An=-2+2=0$. Every solution is $x=x^\star+tn$, $t\in\mathbb R$, since a single independent equation in two variables leaves one free coordinate.

Minimal norm: $(x^\star)^\top n=-2+2=0$, so $\|x\|^2=\|x^\star\|^2+t^2\|n\|^2=5+5t^2\ge5$, with equality only at $t=0$. Hence $A^+b$ is the unique minimum-norm solution, even though the equation has infinitely many solutions.

Exercise A.5c — Hard: A power estimate cannot certify normalisation

Let $A=\operatorname{diag}(3,1)$ and $x_0=(1,1)/\sqrt2$. Compute $\hat\sigma_0=\|Ax_0\|_2$, one power iterate $x_1=A^\top Ax_0/\|A^\top Ax_0\|_2$, and $\hat\sigma_1$. If W is A divided by $\hat\sigma_0$, is $\|W\|_2\le1$? Give a simple guaranteed alternative.

Review: Singular values, least squares and power iteration

Show hint

The largest singular value is $3$. A power estimate evaluates one unit direction and therefore provides a lower bound.

Show worked solution

Initial estimate: $Ax_0=(3,1)/\sqrt2$, so $\hat\sigma_0=\sqrt{(9+1)/2}=\sqrt5\approx2.2361$, below $3$.

One iteration: $A^\top A=\operatorname{diag}(9,1)$, hence $x_1=(9,1)/\sqrt{82}$. Then $Ax_1=(27,1)/\sqrt{82}$ and $\hat\sigma_1=\sqrt{730/82}\approx2.9837$. It is closer, but still below $3$.

Failed certificate: $\|A/\hat\sigma_0\|_2=3/\sqrt5\approx1.3416\gt1$. A lower bound in the denominator does not give the claimed upper bound on the resulting norm.

Guaranteed choices: here the exact value $3$ is known, so division by $3$ gives norm $1$. More generally division by $\|A\|_F=\sqrt{10}$ gives norm at most $1$, since spectral norm never exceeds Frobenius norm. A finite power estimate alone supplies no such guarantee.

6. Block Matrices, Determinants, Trace & log det

6.1 Blocks, stacked vectors and sparsity

Partition into blocks of compatible sizes and multiply blocks like numbers, keeping their order: $\begin{bmatrix}A & B\\ C & D\end{bmatrix}\begin{bmatrix}x\\ u\end{bmatrix}=\begin{bmatrix}Ax+Bu\\ Cx+Du\end{bmatrix}$ (a state-space model in one matrix), and $\begin{bmatrix}x\\ y\end{bmatrix}^\top\begin{bmatrix}A & B\\ B^\top & C\end{bmatrix}\begin{bmatrix}x\\ y\end{bmatrix}=x^\top Ax+2x^\top By+y^\top Cy$. $\mathrm{blkdiag}(M_1,\dots,M_k)\succeq0$ iff every $M_i\succeq0$, which is how several LMIs become one. A selection matrix $E_i=[0\ \cdots\ I\ \cdots\ 0]$ extracts block $i$ of a stacked vector, $E_iz=z_i$, and $E_i^\top z_i$ zero-pads it back. Blocks are often named by the variables they couple ($P_{x,u}$: rows of $x$, columns of $u$); zero blocks are left blank.

Sparsity. If $L$ is block-bidiagonal (blocks only on the diagonal and first subdiagonal), $(LL^\top)_{ij}=\sum_kL_{ik}L_{jk}^\top$ vanishes unless $|i-j|\le1$: $LL^\top$ is block-tridiagonal. Conversely the block Cholesky factor of a PD block-tridiagonal matrix is block-bidiagonal (no fill-in), so layer-wise LMIs are cheap to factor. More generally, a symmetric sparsity pattern is a graph (edge $\{i,j\}$ if entry $ij$ may be nonzero); if it is chordal (every cycle of length $\ge4$ has a chord), a PSD matrix with that pattern is a sum of PSD matrices each supported on one clique (Vandenberghe & Andersen 2014, Thm. 9.2), so a large LMI splits into small ones. A tridiagonal pattern is a path; its cliques are consecutive pairs.

6.2 Block elimination and the Schur complement

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

Product: row-by-column multiplication gives $Mz=(2(1)+1(2),\ 1(1)+3(2),\ 4(3))=(4,7,12)$. The zero off-block entries mean there is no coupling to coordinate 3.

Trace: add diagonal entries: $\operatorname{tr}M=2+3+4=9$.

Determinant: M is block diagonal, so its determinant is the product of block determinants. The first block has determinant $2(3)-1(1)=5$; multiply by $4$ to obtain $\det M=20$. Trace adds blocks, while determinant multiplies them.

Exercise A.6b — Medium: Find the parameter range of a Schur complement

For which real a is $M(a)=\begin{bmatrix}a&2\\2&3\end{bmatrix}$ PSD? For which is it PD? Show a null vector at the boundary using a completed square.

Review: Block algebra, Schur complements and updates

Show hint

Use the strictly positive lower-right corner $3$ as the pivot.

Show worked solution

Complete the square: for $z=(x,y)$, $z^\top M(a)z=ax^2+4xy+3y^2=(a-4/3)x^2+3(y+2x/3)^2$. Expanding the right side verifies the cross term and the cancelled $4x^2/3$.

PSD: the second term is always nonnegative and can be made zero by $y=-2x/3$. Therefore the form is nonnegative for all z exactly when $a-4/3\ge0$, or $a\ge4/3$.

PD and boundary: both squared directions are strictly controlled when $a\gt4/3$, so M is PD. At $a=4/3$, take $z=(3,-2)$: the square vanishes and $M z=0$. Thus the boundary matrix is PSD and singular. For $a\lt4/3$ the same direction gives a negative form.

Exercise A.6c — Hard: Update an inverse and a log determinant

Let $V=\operatorname{diag}(2,1)$ and $u=(1,2)$. Compute $\det(V+uu^\top)$ and the increase in $\log\det V$ using the determinant lemma. Compute $(V+uu^\top)^{-1}$ using the rank-one inverse formula, then verify by multiplication.

Review: Block algebra, Schur complements and updates

Show hint

First compute $V^{-1}u$ and the scalar $u^\top V^{-1}u$; both identities reuse them.

Show worked solution

Shared quantities: $V^{-1}=\operatorname{diag}(1/2,1)$, $v=V^{-1}u=(1/2,2)$, and $u^\top v=1/2+4=9/2$.

Determinant: the lemma gives $\det(V+uu^\top)=2(1+9/2)=11$. Thus the log-determinant increase is $\log11-\log2=\log(11/2)\approx1.70475$.

Inverse: subtract $vv^\top/(1+u^\top v)$ from $V^{-1}$ to get $\operatorname{diag}(1/2,1)-\tfrac2{11}\begin{bmatrix}1/4&1\\1&4\end{bmatrix}=\tfrac1{11}\begin{bmatrix}5&-2\\-2&3\end{bmatrix}$.

Independent check: $V+uu^\top=\begin{bmatrix}3&2\\2&5\end{bmatrix}$. Multiplying it by the proposed inverse gives $\tfrac1{11}\begin{bmatrix}15-4&-6+6\\10-10&-4+15\end{bmatrix}=I$. Its direct determinant is $15-4=11$, agreeing with the update.

7. Orthogonal, Skew-Symmetric & Structured Matrices

7.1 Orthogonal matrices, reflections and projections

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

Orthogonality: Q equals its transpose and $Q^\top Q=\operatorname{diag}(1,1)=I$. Therefore $\|Qx\|_2^2=x^\top Q^\top Qx=\|x\|_2^2$ for every x.

Example: $Q(3,4)^\top=(3,-4)^\top$ and its length is $\sqrt{9+16}=5$, equal to the original length.

Orientation: $\det Q=-1$. Q fixes the horizontal axis and reverses the vertical coordinate, so it is a reflection across the horizontal axis. Orthogonal does not mean rotation only.

Exercise A.7b — Medium: Projection is different from an orthogonal matrix

Let $P=\operatorname{diag}(1,0)$. Show that it is an orthogonal projection onto the horizontal axis. Is P itself an orthogonal matrix? Find the projection error of $x=(3,4)$.

Review: Orthogonal maps, projections and Cayley transforms

Show hint

A projection matrix satisfies $P^2=P$; an orthogonal projection is also symmetric. An orthogonal matrix must satisfy $P^\top P=I$.

Show worked solution

Projection: $Px=(x_1,0)$ keeps exactly the horizontal component. P is symmetric and $P^2=P$, so projecting twice has the same effect as projecting once.

Error: for $(3,4)$ the projection is $(3,0)$ and the residual is $(0,4)$. Their dot product is $0$, explaining the word orthogonal in orthogonal projection. Pythagoras gives $3^2+4^2=5^2$.

Different property: $P^\top P=P\ne I$, so P is not an orthogonal matrix. It loses the vertical component and is singular; an orthogonal matrix preserves every length and is invertible. Its operator norm is still $1$, since it never increases length and preserves horizontal vectors.

Exercise A.7c — Hard: Derive a Cayley rotation and its missing case

For $A=\begin{bmatrix}0&-1\\1&0\end{bmatrix}$ compute $Q=(I-A)(I+A)^{-1}$ and verify orthogonality. Prove that the Cayley transform of any real skew-symmetric A cannot have a nonzero vector v with $Qv=-v$.

Review: Orthogonal maps, projections and Cayley transforms

Show hint

For the proof set $w=(I+A)^{-1}v$, so that the eigenvector equation becomes $(I-A)w=-(I+A)w$.

Show worked solution

Inverse: $I+A=\begin{bmatrix}1&-1\\1&1\end{bmatrix}$ has determinant $2$, hence inverse $\tfrac12\begin{bmatrix}1&1\\-1&1\end{bmatrix}$.

Product: $I-A=\begin{bmatrix}1&1\\-1&1\end{bmatrix}$, so Q is $\tfrac12\begin{bmatrix}0&2\\-2&0\end{bmatrix}=\begin{bmatrix}0&1\\-1&0\end{bmatrix}$. Direct multiplication gives $Q^\top Q=I$ and determinant $1$: a clockwise quarter-turn.

General exclusion: $I+A$ is invertible for skew-symmetric A, because $(I+A)w=0$ would give $0=w^\top(I+A)w=\|w\|^2$, forcing $w=0$. If $Qv=-v$, define w as in the hint. Then $w-Aw=-w-Aw$, so $2w=0$ and v is also zero.

Consequence: no Cayley transform of a finite skew-symmetric matrix has eigenvalue $-1$. The orthogonal matrix $-I$ is therefore outside this parameterisation; this is a restriction of the parameterisation, not of orthogonal matrices in general.

8. Functions as Vectors: Inner Product & Hilbert Spaces

Functions $f:D\to\mathbb R$ add and scale pointwise, so they are vectors. On a finite $D=\{x_1,\dots,x_n\}$, $f$ is the vector $(f(x_1),\dots,f(x_n))$; on an interval there are infinitely many independent functions ($1,x,x^2,\dots$). Kernel methods (Modules 3–6) do linear algebra in such infinite-dimensional spaces.

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

Inner product: $\langle f,g\rangle=\int_0^1x\,dx=1/2$. Norms: $\|f\|^2=\int_0^1 1\,dx=1$ and $\|g\|^2=\int_0^1x^2\,dx=1/3$, so the norms are $1$ and $1/\sqrt3$.

Remove the constant component: $\langle f,g-cf\rangle=1/2-c$. Setting it to zero gives $c=1/2$. Thus $x-1/2$ is perpendicular to the constant function.

Check Pythagoras: $\int_0^1(x-1/2)^2dx=1/3-1/2+1/4=1/12$. The squared norm splits as $1/3=(1/2)^2+1/12$. The same projection algebra used for vectors now works for functions.

Exercise A.8b — Medium: Build a kernel matrix from explicit features

Let $\varphi(x)=(1,x)$ and $k(x,x^\prime)=\varphi(x)^\top\varphi(x^\prime)$. Compute k and its Gram matrix at inputs $0,1$. Verify PSD by writing $\alpha^\top K\alpha$ as a sum of squares. Is K PD?

Review: Functions as vectors, kernels and RKHS norms

Show hint

Write $\alpha_1\varphi(0)+\alpha_2\varphi(1)$ and square its length.

Show worked solution

Kernel: $k(x,x^\prime)=1+xx^\prime$. At inputs $0,1$, the values give $K=\begin{bmatrix}1&1\\1&2\end{bmatrix}$.

Gram identity: the weighted feature sum is $\alpha_1(1,0)+\alpha_2(1,1)=(\alpha_1+\alpha_2,\alpha_2)$. Its squared norm is $(\alpha_1+\alpha_2)^2+\alpha_2^2=\alpha^\top K\alpha\ge0$, proving PSD for all coefficients.

Strictness: the sum of squares vanishes only if $\alpha_2=0$ and then $\alpha_1=0$, so K is PD. Equivalently its features are independent, and its determinant is $2-1=1\gt0$. Kernels are PSD because of their feature inner products, not merely because their entries look positive.

Exercise A.8c — Hard: Interpolate and interpret an RKHS norm

For $k(x,x^\prime)=1+xx^\prime$ on $\mathbb R$, fit $f(0)=1$ and $f(1)=3$ with a function in its RKHS. Compute its squared RKHS norm using both the feature coefficients and $y^\top K^{-1}y$. Why does this finite norm not give a finite uniform bound on all real x?

Review: Functions as vectors, kernels and RKHS norms

Show hint

The feature map is $(1,x)$, so functions are $f(x)=w_1+w_2x$ with squared norm $w_1^2+w_2^2$. Also $k(x,x)=1+x^2$.

Show worked solution

Fit: the first condition gives $w_1=1$; the second gives $w_1+w_2=3$, hence $w_2=2$. Therefore $f(x)=1+2x$ and $\|f\|_k^2=1^2+2^2=5$.

Matrix check: $K=\begin{bmatrix}1&1\\1&2\end{bmatrix}$ has inverse $\begin{bmatrix}2&-1\\-1&1\end{bmatrix}$. For $y=(1,3)$, $K^{-1}y=(-1,2)$ and $y^\top K^{-1}y=-1+6=5$. These are the same norm calculation in two coordinate systems.

Representer check: $f(x)=-k(0,x)+2k(1,x)=-1+2(1+x)=1+2x$, so the coefficient solution indeed lies in the RKHS.

Domain matters: reproducing-property Cauchy–Schwarz gives $|f(x)|\le\sqrt5\sqrt{1+x^2}$, whose right side grows with x. The kernel diagonal is unbounded on $\mathbb R$, and f itself is unbounded there. On $[-1,1]$ the same theorem gives the valid uniform bound $\sqrt{10}$; a finite RKHS norm alone does not supply a domain-independent bound.

Interactive: Quadratic Forms, Eigenvectors & the SVD

Set the entries of $A=\begin{bmatrix}a_{11} & a_{12}\\ a_{21} & a_{22}\end{bmatrix}$. Left: $A$ maps the unit circle (grey) to an ellipse (blue); dashed teal: right singular vectors $v_1,v_2$; blue: their images $\sigma_iu_i$; purple: real eigen-directions; orange: the power iterate $x_k$ and $Ax_k$. Right: level sets $x^\top Sx=c$, $S=\tfrac12(A+A^\top)$, for $c=\pm\tfrac12,\pm1,\pm2$ (blue positive, orange negative, $c=1$ thick). The readouts use closed-form formulas evaluated in floating-point arithmetic (the determinant and eigenvalue discriminant come from the integer slider ticks, so singular matrices are recognised exactly); the level-set curves are approximated numerically on a grid.

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

Adding gives $2\hat z_1=2$, so $\hat z_1=1$; subtraction gives $2\hat z_2=4$, so $\hat z_2=2$. The first estimate error is $(\eta_1+\eta_2)/2$, bounded in magnitude by the individual sensor bound, with equality when the two errors have equal extreme signs.

At error bound $0.1$, the true first displacement may be as large as $1.1$, so the limit is not certified. At bound $0.04$, it is at most $1.04$, so the test passes. The sign convention for estimate-minus-true error does not change these symmetric intervals. Both conclusions assume the calibration matrix and additive bounds apply; the central estimate alone discards information needed for the limit test.

Exercise A.B2 — Medium: Separate minimum length from identification

Only one error-free channel remains: $z_1+z_2=6$ millimetres. Find all real solutions and the minimum-Euclidean-length solution. If physical information additionally says $z_1,z_2\ge0$, find the full range of $z_1$. Does either calculation certify a limit $z_1\le4$?

Review the relevant tools

Show hint

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

Show worked solution

Every solution is $(3+t,3-t)$ for real $t$. Its squared norm is $18+2t^2$, minimized uniquely at $t=0$. Thus the pseudoinverse convention returns $(3,3)$, but the entire line fits the measurement.

Nonnegativity requires $-3\le t\le3$, so $z_1\in[0,6]$. The feasible point $(5,1)$ violates the proposed limit while fitting the reading and nonnegativity assumptions. The minimum-length estimate satisfies the limit, but this does not certify the unknown physical displacement. An additional measurement or a justified prior restriction is required to remove the counterexample.

Exercise A.B3 — Medium: Normalize quantities before taking a norm

A prediction is $y=p+(2\ \mathrm{s})v$, where position $p$ is in millimetres and velocity $v$ in millimetres per second. Define dimensionless coordinates by $p=(2\ \mathrm{mm})z_1$ and $v=(0.5\ \mathrm{mm/s})z_2$. If the normalized state error obeys $\|\Delta z\|_2\le0.1$, derive the largest possible prediction error and an attaining direction. Compare with separately bounding both normalized coordinates by $0.1$.

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

Substitution gives $y=(2z_1+z_2)$ millimetres. Therefore $|\Delta y|=|(2,1)^\top\Delta z|\le\sqrt5\|\Delta z\|_2\le0.1\sqrt5$ millimetres, approximately $0.223607$. The bound is attained at $\Delta z=0.1(2,1)^\top/\sqrt5$; its normalized length is exactly $0.1$.

The separate-coordinate bounds give $|\Delta y|\le2(0.1)+0.1=0.3$ millimetres. This is valid but looser: it includes the corner $(0.1,0.1)$, which lies outside the original radius-$0.1$ ball. Adding raw position and velocity squares without scales would not define this dimensionless geometry. The chosen scales are part of the uncertainty model and must be reported.

Exercise A.B4 — Hard: Audit a third sensor using residual orthogonality

Add a direct second-displacement sensor to the near-redundant design: $H=\begin{bmatrix}1&1\\1&1.1\\0&1\end{bmatrix}$ and $y=(6,6.2,2.1)^\top$ millimetres. Find the equal-weight least-squares estimate by solving its normal equations. Check residual orthogonality, explain uniqueness, and compare with the underlying teaching state $(4,2)$ when only the third reading was perturbed by $0.1$.

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

The normal equations have matrix $G=H^\top H=\begin{bmatrix}2&2.1\\2.1&3.21\end{bmatrix}$ and right side $(12.2,14.92)^\top$. Eliminating the first variable gives $2.01\hat z_2=4.22$, so $\hat z_2=422/201\approx2.09950249$ and $\hat z_1=261/67\approx3.89552239$ millimetres.

Using $r=y-H\hat z$, the residual is $(1/201,-1/201,1/2010)^\top$ millimetres. Its products with the two columns are $r_1+r_2=0$ and $r_1+1.1r_2+r_3=0$. Thus $H^\top r=0$, verifying least-squares stationarity. Since the first and third rows already distinguish both unknowns, the columns are independent and $G$ is positive definite; the stationary point is the unique global minimum.

The estimate error relative to $(4,2)$ is $(-7/67,20/201)^\top$ millimetres, with length $29/201\approx0.144279$. The third channel has not simply been treated as exact: its discrepancy is distributed among all three residuals according to the equal-weight criterion. This example checks a particular perturbation; it does not establish a worst-case comparison between arbitrary sensor designs.

Read the geometry behind the answer

The measurement rows determine what can be distinguished. Their column rank decides uniqueness; their weakest singular direction decides sensitivity; the error set and its units decide what a reconstruction can certify. Least squares then explains what happens when measurements disagree. None of these questions is answered merely by successfully multiplying an inverse into a vector.

For recall, sketch the solution line of one sum measurement and explain what a second difference measurement changes. Reproduce the near-redundant calculation without an inverse. Explain why a residual can be zero while sensitivity is poor, and why a minimum-length estimate can satisfy a limit that the unknown true state violates. Finally, identify where deterministic sensor bounds entered the assembly decision.

Primer B turns least squares into a general optimization model and adds constraints to estimation or command selection. Gaussian-process regression in Module 3 uses related linear solves with a probabilistic interpretation. The present bounds were deterministic; assigning a probability to them requires the explicit assumptions developed in Primer C.

Exercises

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) $\|w\|_1=5$, $\|w\|_2=3$, $\|w\|_\infty=2$, and $2\le3\le5\le3\sqrt3\approx5.20$. (b) The maximum is $0.1$ times the dual norm: $p=\infty$: $0.1\|w\|_1=0.5$ at $\delta=(0.1,-0.1,0.1)$; $p=2$: $0.1\|w\|_2=0.3$ at $\delta=0.1w/3$; $p=1$: $0.1\|w\|_\infty=0.2$ at $\delta=(0,-0.1,0)$ or $(0,0,0.1)$. (c) $\{\|\delta\|_\infty\le\varepsilon\}\subseteq\{\|\delta\|_2\le28\varepsilon\}$ ($\sqrt{784}=28$): radius $1.0$ certifies $1/28\approx0.036$ in $\ell_\infty$, and $\ell_\infty$ radius $0.1$ needs $\ell_2$ radius $2.8$.

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

Column sums $4,6$: $\|B\|_1=6$; row sums $3,7$: $\|B\|_\infty=7$; $\|B\|_F=\sqrt{30}\approx5.477$; largest row length $\max\{\sqrt5,5\}=5$; largest entry $4$. $B^\top B=\begin{bmatrix}10 & 10\\ 10 & 20\end{bmatrix}$ has eigenvalues $15\pm5\sqrt5\approx26.18,\ 3.82$, so $\|B\|_2\approx5.117$, $\sigma_2\approx1.954$ (check $\sigma_1\sigma_2=10=|\det B|$), below $5.477$ and $\sqrt{42}\approx6.48$. The eigenvalues of $B$ solve $\lambda^2-5\lambda+10=0$: $\tfrac{5\pm i\sqrt{15}}2\approx2.5\pm1.936i$, $|\lambda|=\sqrt{10}\approx3.16\le5.117$.

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) $L_{11}=1$, $L_{21}=2$, $L_{31}=0$, $L_{22}=\sqrt{5-4}=1$, $L_{32}=2$, $L_{33}^2=a-4$: PD iff $a\gt4$. (b) Leading minors $1$, $1$, $\det P(a)=(5a-4)-4a=a-4$. (c) At $a=4$ the last pivot is $0$ and $P(4)=LL^\top$ (with $L_{33}=0$) is a Gram form: PSD but singular, with null vector $(4,-2,1)$ from $L^\top x=0$. (d) With $L=\begin{bmatrix}1 & 0 & 0\\ 2 & 1 & 0\\ 0 & 2 & 1\end{bmatrix}$: forward $y=(1,2,1)$, backward $x=(1,0,1)$; check $P(5)x=(1,4,5)$. $\log\det P(5)=2\sum\log L_{jj}=0$, i.e. $\det=1=a-4$.

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) Eigenvalue $9$ on $q_1=(1,-1)/\sqrt2$, $1$ on $q_2=(1,1)/\sqrt2$: semi-axes $1/3$ and $1$, area $\pi/\sqrt{\det P}=\pi/3\approx1.047$. (b) $\pm q_2$, at distance $1/\sqrt{\lambda_{\min}}=1$. (c) $P^{-1}=\tfrac19\begin{bmatrix}5 & 4\\ 4 & 5\end{bmatrix}$: shadow $\sqrt{5/9}\approx0.745$; slice $5x_1^2\le1$: $1/\sqrt5\approx0.447$, much thinner because the ellipse is tilted. (d) $1.25-2+1.25=0.5\le1$: inside. (e) $R=P^{-1/2}=\tfrac13q_1q_1^\top+q_2q_2^\top=\tfrac13\begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}$, and $R^2=P^{-1}$.

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) $C=5uu^\top$, $u=(1,2)/\sqrt5$: $\sigma=(5,0)$, rank $1$, $C^+=\tfrac15uu^\top=\tfrac1{25}C$. (b) $x=(0.04,0.08)$, $Cx=(0.2,0.4)$, residual $(0.8,-0.4)$, and $(0.8,-0.4)\cdot(1,2)=0$. (c) $(I-CC^+)b=b-uu^\top b=(0.8,-0.4)\ne0$: no. (d) Generalised Schur complement: the range condition forces $\beta=s(1,2)$; then $C^+\beta=(0.2s,0.4s)$ and $\beta^\top C^+\beta=s^2$, so $M\succeq0$ iff $\beta=s(1,2)$ and $a\ge s^2$. For $\beta=(1,0)$ no $a$ works: with $(2,-1)\in\mathrm{null}(C)$ the form at $(x_1,t(2,-1))$ is $ax_1^2+4tx_1$, negative for suitable $t$.

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) $\det\begin{bmatrix}3 & 1\\ 1 & 3\end{bmatrix}=8$. (b) $1+1/0.5=3$; $\sigma_1^2(x_2)=1-0.25/1.5=5/6$ and $1+(5/6)/0.5=8/3$; product $8$. (c) $\tfrac12\log8\approx1.040$ nats. (d) $\det(I_t+K_t/\lambda)=\lambda^{-p}\det V_t$ with $V_t=\lambda I+\sum_{i\le t}\varphi(x_i)\varphi(x_i)^\top$ (Sylvester's identity) and $\lambda^{-p}\det V_0=1$; the determinant lemma gives $\det V_t/\det V_{t-1}=1+\varphi_t^\top V_{t-1}^{-1}\varphi_t=1+\sigma_{t-1}^2(x_t)/\lambda$ (variance identity, Section 6). The product telescopes.

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) $W^\top WM^{-1}=\begin{bmatrix}1 & 1/2\\ 1 & 1/2\end{bmatrix}$: trace $1.5$, determinant $0$, eigenvalues $1.5$ and $0$. It is similar to $M^{-1/2}W^\top WM^{-1/2}=gg^\top$, $g=(1,1/\sqrt2)$, with eigenvalues $\|g\|^2=1.5$ and $0$. (b) $M-FW^\top W\succeq0\iff F\lambda_{\max}(W^\top WM^{-1})\le1\iff F\le2/3$. Check: $\begin{bmatrix}1-F & -F\\ -F & 2-F\end{bmatrix}$ has determinant $2-3F\ge0$ iff $F\le2/3$ (diagonal $\ge0$ for $F\le1$). (c) At $x\propto M^{-1}W^\top=(1,\tfrac12)$, value $1.5$. This is the one-layer case of $L^2=1/F=\lambda_{\max}(W_l^\top W_lM_l^{-1})$ in Module 12.

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