Covariance is a geometry
\[ % Number sets \newcommand{\Nat}{\mathbb{N}} \newcommand{\Integer}{\mathbb{Z}} \newcommand{\Real}{\mathbb{R}} \newcommand{\Complex}{\mathbb{C}} % Operators \newcommand{\SNR}{\operatorname{SNR}} \newcommand{\tr}{\operatorname{tr}} \newcommand{\re}{\operatorname{Re}} \newcommand{\im}{\operatorname{Im}} \newcommand{\sign}{\operatorname{sign}} \newcommand{\rect}{\operatorname{rect}} \newcommand{\sinc}{\operatorname{si}} \newcommand{\erf}{\operatorname{erf}} \newcommand{\erfc}{\operatorname{erfc}} \newcommand{\kurt}{\operatorname{kurt}} \newcommand{\diag}{\operatorname{diag}} \newcommand{\MSE}{\operatorname{MSE}} \newcommand{\argmin}{\operatorname*{argmin}} \newcommand{\argmax}{\operatorname*{argmax}} \newcommand{\bias}{\operatorname{bias}} \newcommand{\Bin}{\operatorname{Bin}} % Delimiters \newcommand{\paren}[1]{\left(#1\right)} \newcommand{\bracket}[1]{\left[#1\right]} \newcommand{\set}[1]{\left\{#1\right\}} \newcommand{\abs}[1]{\left\lvert #1 \right\rvert} \newcommand{\norm}[1]{\left\lVert #1 \right\rVert} \newcommand{\ip}[1]{\left\langle #1 \right\rangle} % Notation \newcommand{\dd}{\,\mathrm{d}} \newcommand{\tran}{^{\top}} \newcommand{\conv}{\ast} \newcommand{\conj}{^{*}} \newcommand{\herm}{^{\mathsf{H}}} \newcommand{\opt}{^{\star}} % Expectation and variance % \newcommand{\E}[1]{\mathbb{E}\!\left[#1\right]} \newcommand{\E}[2][]{\mathbb{E}_{#1}\!\left[#2\right]} \newcommand{\Var}[1]{\mathbb{V}\!\left[#1\right]} % Distributions \newcommand{\Gauss}{\mathcal{N}} \newcommand{\Uniform}{\mathcal{U}} \newcommand{\FT}{\mathcal{F}} % Probability \newcommand{\Prob}[1]{\mathbb{P}\!\left(#1\right)} % Misc \newcommand{\bsy}[1]{\boldsymbol{#1}} \newcommand{\calR}{\mathcal{R}} \newcommand{\calC}{\mathcal{C}} \]

Neighboring pixels are not independent: a face is a shape, and the pixels move together. This week is about describing that shape, and about choosing the coordinates in which it is simplest.
The geometry we borrow. Inner products, angles, right angles and projections, for ordinary vectors.
Covariance is that geometry. Two random variables have an angle between them; many have a covariance matrix, which is an ellipsoid.
Choosing the coordinates. Linear maps reshape the ellipsoid; the eigenvectors make it a sphere (whitening) or keep only what matters (the KLT). For a Gaussian vector, that is the whole story.
In the notes Vectors, Inner Products, and Orthogonality · Covariance and Correlation · Sums of Dependent Random Variables · Mean Vector and Covariance Matrix · Proper Complex Random Vectors · Linear Transforms of Random Vectors · Functions of Two Random Variables · Decorrelation, Whitening, and Coloring · Normal Random Vectors
Euclidean inner product \[\ip{\mathbf x,\mathbf y}=\mathbf y\herm\mathbf x=\sum_{k=1}^Nx_k\,y_k\conj,\qquad \norm{\mathbf x}^2=\ip{\mathbf x,\mathbf x}=\sum_k\abs{x_k}^2 .\] It is linear in the first argument and conjugate-symmetric: \[\ip{a\mathbf x+b\mathbf z,\mathbf y}=a\ip{\mathbf x,\mathbf y}+b\ip{\mathbf z,\mathbf y},\qquad \ip{\mathbf y,\mathbf x}=\ip{\mathbf x,\mathbf y}\conj .\]
Complex from the start, because signals demand it. The conjugate is what makes \(\norm{\mathbf x}^2\ge0\), zero only at \(\mathbf 0\): for a signal, it is the energy. Distance is \(\norm{\mathbf x-\mathbf y}\), so “closest” always means the smallest norm of a difference.
\[\abs{\ip{\mathbf x,\mathbf y}}\le\norm{\mathbf x}\,\norm{\mathbf y},\qquad \cos\theta=\frac{\abs{\ip{\mathbf x,\mathbf y}}}{\norm{\mathbf x}\norm{\mathbf y}}\in[0,1] .\]

\(\mathbf x\perp\mathbf y\) when \(\ip{\mathbf x,\mathbf y}=0\). That extreme case is the one this course lives on: orthogonality is the algebraic form of “carrying no information about each other”.
\(\mathbf x\perp\mathbf y\ \Rightarrow\ \norm{\mathbf x+\mathbf y}^2=\norm{\mathbf x}^2+\norm{\mathbf y}^2\). The closest point of a subspace \(\mathcal S\) to \(\mathbf y\) is characterized by a right angle:
Projection theorem \[\norm{\mathbf y-\widehat{\mathbf y}}=\min_{\mathbf s\in\mathcal S}\norm{\mathbf y-\mathbf s} \iff(\mathbf y-\widehat{\mathbf y})\perp\mathcal S .\]

Gram matrix The Gram matrix of \(\mathbf x_1,\dots,\mathbf x_K\) collects all their pairwise inner products, \[[\mathbf R_{\mathbf{xx}}]_{ji}=\ip{\mathbf x_i,\mathbf x_j},\qquad i,j=1,\dots,K .\]
To write the best approximation of \(\mathbf y\) in this basis, \(\widehat{\mathbf y}=\sum_i\alpha_i\mathbf x_i\), demand the right angle \(\ip{\mathbf y-\widehat{\mathbf y},\mathbf x_j}=0\) against every \(\mathbf x_j\): \[\sum_{i=1}^K\alpha_i\ip{\mathbf x_i,\mathbf x_j}=\ip{\mathbf y,\mathbf x_j} \quad\Longleftrightarrow\quad \mathbf R_{\mathbf{xx}}\boldsymbol\alpha=\mathbf r_{\mathbf{xy}},\qquad [\mathbf r_{\mathbf{xy}}]_j=\ip{\mathbf y,\mathbf x_j}.\]
In an orthonormal basis \(\mathbf R_{\mathbf{xx}}=\mathbf I\) and each coefficient is one inner product, \(\alpha_j=\ip{\mathbf y,\mathbf x_j}\). Otherwise the coefficients couple.

The shadows \(\mathbf r_{\mathbf{xy}}\) double-count whatever the basis vectors share; \(\mathbf R_{\mathbf{xx}}^{-1}\) removes the double counting. The more nearly parallel the basis, the worse conditioned \(\mathbf R_{\mathbf{xx}}\) and the larger the coefficients.

With \(\ip{f,g}=\int f\,g\conj\), a function is a vector with a continuum of coordinates. The Fourier basis is orthonormal, so adding a harmonic never changes the earlier coefficients.

The projection depends only on the subspace; the basis only changes how hard it is to compute. Keep that distinction: this week is about choosing good bases.

A zero-mean random variable is such a list, with one coordinate per outcome, weighted by its probability. Weight follows height; income does not. That is an angle.

\(\mathbf R_{\mathbf{xx}}\) and \(\mathbf r_{\mathbf{xy}}\) are inner products, not coordinates: the projection depends on the pairwise angles, whatever the dimension of the vectors.
Projection error The best approximation of \(\mathbf y\) from linearly independent \(\mathbf x_1,\dots,\mathbf x_K\) misses by \[\norm{\mathbf y-\widehat{\mathbf y}}^2=\norm{\mathbf y}^2-\mathbf r_{\mathbf{xy}}\herm\mathbf R_{\mathbf{xx}}^{-1}\mathbf r_{\mathbf{xy}} .\]
Proof. The error is perpendicular to \(\mathcal S\) and \(\widehat{\mathbf y}\in\mathcal S\), so Pythagoras gives \(\norm{\mathbf y}^2=\norm{\widehat{\mathbf y}}^2+\norm{\mathbf y-\widehat{\mathbf y}}^2\). For the first term, \[\norm{\widehat{\mathbf y}}^2=\ip{\widehat{\mathbf y},\mathbf y}-\underbrace{\ip{\widehat{\mathbf y},\mathbf y-\widehat{\mathbf y}}}_{0} =\sum_i\alpha_i\ip{\mathbf x_i,\mathbf y}=\mathbf r_{\mathbf{xy}}\herm\boldsymbol\alpha =\mathbf r_{\mathbf{xy}}\herm\mathbf R_{\mathbf{xx}}^{-1}\mathbf r_{\mathbf{xy}} .\qquad\blacksquare\]
Again only inner products. For the population, \(\norm{\mathbf y}=1\) and \(\mathbf r_{\mathbf{xy}}\herm\mathbf R_{\mathbf{xx}}^{-1}\mathbf r_{\mathbf{xy}}\approx0.80^2\): weight is missed by \(\norm{\mathbf y-\widehat{\mathbf y}}^2\approx0.36\).
Covariance and correlation coefficient \[C_{XY}=\E{(X-m_X)(Y-m_Y)\conj},\qquad \rho_{XY}=\frac{C_{XY}}{\sigma_X\sigma_Y},\qquad R_{XY}=\E{XY\conj}.\]
Uncorrelated and orthogonal \(X,Y\) are uncorrelated when \(C_{XY}=0\), and orthogonal when \(R_{XY}=0\).
Both are inner products, \(\ip{U,V}=\E{UV\conj}\): \(R_{XY}=\ip{X,Y}\) and \(C_{XY}=\ip{X-m_X,\,Y-m_Y}\). So uncorrelated means orthogonal once the means are removed, and \(\Var{X}=C_{XX}\) is a squared length.

Cauchy–Schwarz on the centered variables, \(\ip{U,V}=\E{UV\conj}\): \(\ \abs{C_{XY}}\le\sigma_X\sigma_Y\ \Rightarrow\ \abs{\rho_{XY}}\le1\), with equality exactly when \(Y\) is affine in \(X\). What is \(\rho\) for each of these?



Covariance sees only the straight-line part of the dependence. Zero covariance means “no linear relationship”, not “no relationship”.
Uncorrelated (\(C_{XY}=0\)) and orthogonal (\(R_{XY}=0\)) differ by the means: \(C_{XY}=R_{XY}-m_Xm_Y\conj\).

independent \(\Rightarrow\) uncorrelated \(\overset{\text{zero mean}}{\iff}\) orthogonal, and no arrow reverses in general. This is why the course mostly works with zero-mean variables.
| geometry | random variables (zero mean) |
|---|---|
| inner product \(\ip{\mathbf x,\mathbf y}\) | covariance \(\E{XY\conj}\) |
| squared length | variance |
| \(\cos\theta\) | correlation coefficient \(\rho_{XY}\) |
| orthogonal | uncorrelated |
| Pythagoras | variances of uncorrelated terms add |
| projection onto a subspace | the best guess buildable from those variables |
Nothing on the left knew about randomness, and nothing on the right will need a new proof.
Mean vector and covariance matrix \[\mathbf m_{\mathbf X}=\E{\mathbf X},\qquad \mathbf C_{\mathbf{XX}}=\E{(\mathbf X-\mathbf m_{\mathbf X})(\mathbf X-\mathbf m_{\mathbf X})\herm},\qquad \mathbf R_{\mathbf{XX}}=\E{\mathbf X\mathbf X\herm}.\]
For three components, variances on the diagonal and cross-covariances off it: \[\mathbf C_{\mathbf{XX}}=\begin{bmatrix}\Var{X_1}&C_{X_1X_2}&C_{X_1X_3}\\C_{X_2X_1}&\Var{X_2}&C_{X_2X_3}\\C_{X_3X_1}&C_{X_3X_2}&\Var{X_3}\end{bmatrix} .\]
Each pair appears twice: \(C_{X_jX_i}=C_{X_iX_j}\conj\), so the matrix is Hermitian, \(\mathbf C_{\mathbf{XX}}\herm=\mathbf C_{\mathbf{XX}}\).
Correlation-coefficient matrix \([\boldsymbol\rho_{\mathbf{XX}}]_{ij}=\rho_{X_iX_j}=\dfrac{C_{X_iX_j}}{\sigma_i\sigma_j}\), that is \(\boldsymbol\rho_{\mathbf{XX}}=\boldsymbol\Sigma^{-1}\mathbf C_{\mathbf{XX}}\boldsymbol\Sigma^{-1}\) with \(\boldsymbol\Sigma=\operatorname{diag}(\sigma_1,\dots,\sigma_N)\): ones on the diagonal, cosines off it.
\[\widehat{\mathbf m}_{\mathbf X}=\frac1M\sum_m\mathbf x^{(m)},\qquad \widehat{\mathbf C}_{\mathbf{XX}}=\frac{1}{M-1}\sum_m(\mathbf x^{(m)}-\widehat{\mathbf m}_{\mathbf X})(\mathbf x^{(m)}-\widehat{\mathbf m}_{\mathbf X})\herm:\] a sum of rank-one outer products, Hermitian by construction.
The largest covariance tells you which variable has the biggest units (income, in kEUR), not which relationship is strongest. Normalizing to correlations makes the matrix readable: weight follows height, income follows neither.
Mahalanobis distance \(d_M(\mathbf x)=\sqrt{(\mathbf x-\mathbf m_{\mathbf X})\herm\,\mathbf C_{\mathbf{XX}}^{-1}\,(\mathbf x-\mathbf m_{\mathbf X})}\), for invertible \(\mathbf C_{\mathbf{XX}}\). Its level sets are the covariance ellipsoids; for \(N=1\) it is the \(z\)-score.

The ellipses are \(d_M=1,2\); the red arrows are the eigenvectors, scaled by \(\sqrt{\lambda_i}\). Uncorrelated components: the ellipse is axis-aligned. Correlation tilts it. Decorrelating the data means diagonalizing \(\mathbf C_{\mathbf{XX}}\), an eigenproblem and nothing more.
\(Z=X+jY=Re^{j\Phi}\) is a pair of real variables on one outcome, and its size is measured with a conjugate: \(\E{ZZ\conj}=\E{\abs Z^2}\ge0\).

A unit-amplitude signal with uniform phase, \(Z=e^{j\Phi}\), \(\Phi\sim\Uniform(-\pi,\pi)\): \[\begin{aligned} \E{Z}&=\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{j\varphi}\,d\varphi=0,\\ \E{Z^2}&=\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{j2\varphi}\,d\varphi=0,\\ \E{ZZ\conj}&=\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{j\varphi}e^{-j\varphi}\,d\varphi=1 . \end{aligned}\]
Without the conjugate, the second moment of a phase-rotating signal vanishes however large the signal is. With it, \(\mathbf C_{\mathbf{ZZ}}=\E{(\mathbf Z-\mathbf m)(\mathbf Z-\mathbf m)\herm}\) is Hermitian, exactly as in the real case.
\(\mathbf Z=\mathbf X+j\mathbf Y\) has \(2N\) real degrees of freedom; the missing half is the complementary covariance \(\widetilde{\mathbf C}_{\mathbf{ZZ}}=\E{(\mathbf Z-\mathbf m)(\mathbf Z-\mathbf m)\tran}\). A vector is proper when it vanishes.
Properness is rotational symmetry: no phase is privileged. A uniformly random carrier phase produces it, which makes it the standard model for communication and array signals.

The snapshot is \(\mathbf Z=Ae^{j\Theta}\mathbf v+\mathbf N\) with \(\Theta\) uniform.
The unknown absolute phase is what makes the snapshot proper.
Change of variables For an invertible, differentiable map \(\mathbf Y=g(\mathbf X)\) of a random vector, with Jacobian \(\mathbf J_g=\bracket{\partial g_i/\partial x_j}\): \[f_{\mathbf Y}(\mathbf y)=\frac{f_{\mathbf X}(\mathbf x)}{\abs{\det\mathbf J_g(\mathbf x)}}\bigg|_{\mathbf x=g^{-1}(\mathbf y)}, \qquad\text{linear: }\ f_{\mathbf Y}(\mathbf y)=\frac{f_{\mathbf X}\paren{\mathbf A^{-1}(\mathbf y-\mathbf b)}}{\abs{\det\mathbf A}} .\]

Probability is conserved: where the map stretches area, the density thins by the same factor.

Scaling changes variances and leaves the correlation coefficient alone. A rotation keeps every length and eigenvalue and changes only which direction is which. A shear creates correlation.

Shear, then marginalize: \(\abs{\det\mathbf J}=1\), so no density is rescaled, only moved. For independent terms this is the convolution of densities, the smoothing step of the first week drawn as a map.
Moments under a linear map For \(\mathbf Y=\mathbf A\mathbf X+\mathbf b\): \[\mathbf m_{\mathbf Y}=\mathbf A\mathbf m_{\mathbf X}+\mathbf b,\qquad \mathbf C_{\mathbf{YY}}=\mathbf A\,\mathbf C_{\mathbf{XX}}\,\mathbf A\herm ,\] \[\mathbf R_{\mathbf{YY}}=\mathbf A\mathbf R_{\mathbf{XX}}\mathbf A\herm+\mathbf A\mathbf m_{\mathbf X}\mathbf b\herm +\mathbf b\,\mathbf m_{\mathbf X}\herm\mathbf A\herm+\mathbf b\mathbf b\herm =\mathbf C_{\mathbf{YY}}+\mathbf m_{\mathbf Y}\mathbf m_{\mathbf Y}\herm .\]
One line of proof: linearity of expectation. The offset moves the mean and cannot touch the covariance; it does enter \(\mathbf R_{\mathbf{YY}}\), and for \(\mathbf b=\mathbf 0\) the correlation transforms like the covariance, \(\mathbf R_{\mathbf{YY}}=\mathbf A\mathbf R_{\mathbf{XX}}\mathbf A\herm\). For one row, \(\Var{\mathbf a\herm\mathbf X}=\mathbf a\herm\mathbf C_{\mathbf{XX}}\mathbf a\).
Every filter, beamformer and transform is an \(\mathbf A\), and this is what it does to the second-order description, whatever the distribution.
A linear combination \(\mathbf a\herm\mathbf X\) is a directional marginal, the joint law squashed onto direction \(\mathbf a\). A variance cannot be negative, so \(\Var{\mathbf a\herm\mathbf X}=\mathbf a\herm\mathbf C_{\mathbf{XX}}\mathbf a\ge0\) for every \(\mathbf a\): \(\mathbf C_{\mathbf{XX}}\) is positive semidefinite.


As \(\mathbf a\) turns, the variance swings between the eigenvalues, reached along the eigenvectors; every other direction is trapped between them.
Summing all components is a map with one row, \(S=\sum_kX_k=\mathbf 1\herm\mathbf X\) with \(\mathbf 1=[1,\dots,1]\tran\): \[\Var{S}=\mathbf 1\herm\mathbf C_{\mathbf{XX}}\mathbf 1=\sum_k\sum_lC_{X_kX_l} .\]
Two random vectors: stack them, \(\mathbf X+\mathbf Y=\begin{bmatrix}\mathbf I&\mathbf I\end{bmatrix}\begin{bmatrix}\mathbf X\\\mathbf Y\end{bmatrix}\). The stacked covariance holds the cross-covariances \(\mathbf C_{\mathbf{XY}}=\E{(\mathbf X-\mathbf m_{\mathbf X})(\mathbf Y-\mathbf m_{\mathbf Y})\herm}\): \[\mathbf C_{\mathbf X+\mathbf Y}=\begin{bmatrix}\mathbf I&\mathbf I\end{bmatrix} \begin{bmatrix}\mathbf C_{\mathbf{XX}}&\mathbf C_{\mathbf{XY}}\\\mathbf C_{\mathbf{YX}}&\mathbf C_{\mathbf{YY}}\end{bmatrix} \begin{bmatrix}\mathbf I\\\mathbf I\end{bmatrix} =\mathbf C_{\mathbf{XX}}+\mathbf C_{\mathbf{XY}}+\mathbf C_{\mathbf{YX}}+\mathbf C_{\mathbf{YY}} .\]
Uncorrelated terms, \(\mathbf C_{\mathbf{XY}}=\mathbf 0\): the covariances simply add.
Puzzle: add a second noisy term to the first. Does the variance of the sum always grow?
With \(\mathbf 1=[1,1]\tran\), the quadratic form of the slide before gives \[\Var{X+Y}=\Var{X}+\Var{Y}+2\,C_{XY} .\]

No: a negative covariance subtracts, and the sum can be smaller than either term. Variances add only for uncorrelated terms, and that is Pythagoras.
Average \(N\) observations of variance \(\sigma^2\), with a common correlation \(\rho\) between any two: \(\overline X_N=\frac1N\sum_kX_k\). How effective is the averaging?
The \(N\) diagonal and \(N(N-1)\) off-diagonal terms of the double sum give \[\Var{\overline X_N}=\frac{1}{N^2}\sum_{k,l}C_{X_kX_l}=\frac{\sigma^2}{N}\bracket{1+(N-1)\rho} =\frac{\sigma^2}{N_{\text{eff}}},\qquad N_{\text{eff}}=\frac{N}{1+(N-1)\rho}\ \xrightarrow{N\to\infty}\ \frac1\rho .\]

The array snapshot \(\mathbf Z=Ae^{j\Theta}\mathbf v+\mathbf N\): a source of fixed amplitude \(A\) and uniform phase \(\Theta\), plus white noise \(\mathbf C_{\mathbf{NN}}=\sigma_N^2\mathbf I\) uncorrelated with the source.
The source term has zero mean and covariance \(\E{\abs A^2e^{j\Theta}e^{-j\Theta}}\mathbf v\mathbf v\herm=\abs A^2\mathbf v\mathbf v\herm\); the two terms are uncorrelated, so the covariances add: \[\mathbf C_{\mathbf{ZZ}}=\abs A^2\,\mathbf v\mathbf v\herm+\sigma_N^2\mathbf I .\]
One strong direction lifted above an isotropic noise floor. The rank-one term is where the direction of the source is written.
In \(\mathbf C_{\mathbf{YY}}=\mathbf A\mathbf C_{\mathbf{XX}}\mathbf A\herm\), choose \(\mathbf A\) to make

\[\mathbf C_{\mathbf{XX}}=\mathbf U\boldsymbol\Lambda\mathbf U\herm,\qquad \mathbf U\herm\mathbf U=\mathbf I,\quad \lambda_i\ge0 .\]
Hermitian gives the orthonormal \(\mathbf U\); positive semidefinite gives \(\lambda_i\ge0\). Transform by \(\mathbf U\herm\): \(\mathbf C_{\mathbf{WW}}=\mathbf U\herm\mathbf C_{\mathbf{XX}}\mathbf U=\boldsymbol\Lambda\), diagonal.
\(\mathbf A\) whitens \(\mathbf X\) if \(\mathbf A\mathbf C_{\mathbf{XX}}\mathbf A\herm=\mathbf I\). The eigenvectors solve it on sight: \(\mathbf A_{\text{PCA}}=\boldsymbol\Lambda^{-1/2}\mathbf U\herm\), rotate, then divide each axis by its own standard deviation.
In whitened coordinates the Mahalanobis distance is ordinary Euclidean distance. Whitening is a change of metric, and every \(\mathbf C^{-1}\) that appears later in the course is this change of metric at work.
All whiteners \(\mathbf A\) whitens \(\mathbf X\) if and only if \(\mathbf A=\mathbf Q\,\boldsymbol\Lambda^{-1/2}\mathbf U\herm\) for some unitary \(\mathbf Q\) (for invertible \(\mathbf C_{\mathbf{XX}}=\mathbf U\boldsymbol\Lambda\mathbf U\herm\)).
Proof. \((\Leftarrow)\) Insert \(\mathbf A=\mathbf Q\boldsymbol\Lambda^{-1/2}\mathbf U\herm\): \[\mathbf A\mathbf C_{\mathbf{XX}}\mathbf A\herm =\mathbf Q\boldsymbol\Lambda^{-1/2}\underbrace{\mathbf U\herm\mathbf U}_{\mathbf I}\boldsymbol\Lambda\underbrace{\mathbf U\herm\mathbf U}_{\mathbf I}\boldsymbol\Lambda^{-1/2}\mathbf Q\herm =\mathbf Q\mathbf Q\herm=\mathbf I .\]
\((\Rightarrow)\) Let \(\mathbf A\) whiten and set \(\mathbf Q=\mathbf A\mathbf U\boldsymbol\Lambda^{1/2}\). It is unitary, \[\mathbf Q\mathbf Q\herm=\mathbf A\,\mathbf U\boldsymbol\Lambda\mathbf U\herm\mathbf A\herm=\mathbf A\mathbf C_{\mathbf{XX}}\mathbf A\herm=\mathbf I ,\] and solving for \(\mathbf A\) gives \(\mathbf A=\mathbf Q\boldsymbol\Lambda^{-1/2}\mathbf U\herm\). \(\blacksquare\)
So choosing \(\mathbf Q\) is choosing what else the transform should do.

| whitener | \(\mathbf A\) | what else it buys |
|---|---|---|
| PCA | \(\boldsymbol\Lambda^{-1/2}\mathbf U\herm\) | coordinates ordered by variance |
| ZCA | \(\mathbf U\boldsymbol\Lambda^{-1/2}\mathbf U\herm=\mathbf C^{-1/2}\) | the output changes least from the input |
| Cholesky | \(\mathbf D^{-1/2}\mathbf L^{-1}\), from \(\mathbf C=\mathbf L\mathbf D\mathbf L\herm\) | causal: output \(i\) uses only inputs \(1,\dots,i\) |
To generate a vector with covariance \(\mathbf C\), factor it and push white noise through:
Coloring \[\mathbf C=\mathbf L\mathbf D\mathbf L\herm,\qquad \mathbf X=\mathbf L\mathbf D^{1/2}\mathbf W,\quad \mathbf C_{\mathbf{WW}}=\mathbf I \quad\Longrightarrow\quad\mathbf C_{\mathbf{XX}}=\mathbf L\mathbf D\mathbf L\herm=\mathbf C .\]
Any whitening factor run backwards will do: the symmetric root \(\mathbf C^{1/2}\) or a Cholesky factor. If \(\mathbf W\) is Gaussian, so is \(\mathbf X\).

Every face is \(N=4096\) numbers, and the pixels move together. Can we store far fewer numbers per face?
Subtract the mean face, so \(\E{\mathbf X}=\mathbf 0\). Encode each face by a latent \(\mathbf W\in\mathbb C^K\), \(K\ll N\), and decode linearly, \(\widehat{\mathbf X}_K=\mathbf A\mathbf W\) with \(\mathbf A\in\mathbb C^{N\times K}\): \[\min_{\mathbf A,\ \mathbf W}\ \E{\norm{\mathbf X-\mathbf A\mathbf W}^2} .\]


The three steps of the slide before, in symbols: \[\widehat{\mathbf X}_K=\underbrace{\mathbf U}_{\text{rotate back}}\ \underbrace{\mathbf T}_{\text{truncate}}\ \underbrace{\mathbf U\herm}_{\text{rotate}}\mathbf X, \qquad \mathbf T=\operatorname{diag}(\underbrace{1,\dots,1}_{K},0,\dots,0) .\]
\(\mathbf T\) sets all but the first \(K\) coordinates to zero, so only the first \(K\) columns of \(\mathbf U\) survive, \(\mathbf U\mathbf T\mathbf U\herm=\mathbf U_K\mathbf U_K\herm\) with \(\mathbf U_K=[\mathbf u_1,\dots,\mathbf u_K]\): \[\widehat{\mathbf X}_K=\mathbf U_K\underbrace{\mathbf U_K\herm\mathbf X}_{\mathbf W\in\mathbb C^K} .\]
Karhunen–Loève The encoder \(\mathbf W=\mathbf U_K\herm\mathbf X\) and the decoder \(\mathbf A=\mathbf U_K\) minimize the mean-square error. The latent is uncorrelated and keeps the \(K\) largest variances: padded with zeros, \(\mathbf W=\mathbf T\mathbf U\herm\mathbf X\) has \(\mathbf C_{\mathbf{WW}}=\mathbf T\boldsymbol\Lambda\mathbf T\herm=\mathbf T\boldsymbol\Lambda\). The discarded coordinates \(\mathbf u_i\herm\mathbf X\), \(i>K\), carry the error, with variance \(\lambda_i\) each: \(\E{\norm{\mathbf X-\widehat{\mathbf X}_K}^2}=\sum_{i=K+1}^N\lambda_i\).

Coarse illumination first, fine detail last. A few dozen numbers describe a face of 4096 pixels, because the pixels move together. Nothing about faces was built into the method: the basis was read off the covariance alone.
The coordinates \(\mathbf W=\mathbf U_K\herm(\mathbf X-\mathbf m)\) are uncorrelated with variances \(\lambda_i\). Model them as independent Gaussians, draw a new \(\mathbf w\), and map back: \(\mathbf x_{\text{new}}=\mathbf m+\mathbf U_K\mathbf w\).

Two moments make a generative model: the faces are new and plausible, but blurred and alike, because a Gaussian on \(K=50\) coordinates knows nothing beyond the covariance.
Jointly Gaussian vector \[f_{\mathbf X}(\mathbf x)=\frac{1}{\sqrt{(2\pi)^N\det\mathbf C_{\mathbf{XX}}}} \exp\paren{-\tfrac12\,d_M^2(\mathbf x)} .\]

In one dimension \(d_M\le1\) holds 68% of the mass, in two 39%, in three 20%. In high dimension almost all the mass lies far from the mean, measured in standard deviations: estimation gets harder with dimension.
The Gaussian vector
Proof of the second. With \(\mathbf C_{\mathbf{XX}}=\operatorname{diag}(\sigma_1^2,\dots,\sigma_N^2)\), \[d_M^2(\mathbf x)=(\mathbf x-\mathbf m)\herm\mathbf C_{\mathbf{XX}}^{-1}(\mathbf x-\mathbf m)=\sum_{i=1}^N\frac{(x_i-m_i)^2}{\sigma_i^2},\qquad \det\mathbf C_{\mathbf{XX}}=\prod_{i=1}^N\sigma_i^2,\] \[f_{\mathbf X}(\mathbf x)=\prod_{i=1}^N\frac{1}{\sqrt{2\pi\sigma_i^2}}\exp\paren{-\frac{(x_i-m_i)^2}{2\sigma_i^2}}=\prod_{i=1}^Nf_{X_i}(x_i) .\ \blacksquare\]

Same marginals, same covariance; the dashed curve is the Gaussian of the same variance. Folding the mass of two quadrants into the other two keeps both coordinates standard normal, yet the diagonal projection has no mass near zero.
\[f_{\mathbf Z}(\mathbf z)=\frac{1}{\pi^N\det\mathbf C_{\mathbf{ZZ}}} \exp\paren{-(\mathbf z-\mathbf m)\herm\mathbf C_{\mathbf{ZZ}}^{-1}(\mathbf z-\mathbf m)}\]
The flat phase panel is properness seen directly. This is the standard model for receiver noise.
For iid random vectors with finite covariance, the normalized sum is Gaussian: \(\frac{1}{\sqrt n}\sum_i(\mathbf X_i-\mathbf m)\to\Gauss(\mathbf 0,\mathbf C)\). Proof: apply the scalar central limit theorem to every projection \(\mathbf a\herm\mathbf X\).
The square becomes an ellipse whose contours are set by \(\mathbf C\) alone: the first week’s answer, now for vectors.
This week