Matrices Too Large to Hold Still
Suppose a scientist has a table with a billion observations and thousands of measurements per observation. Classical matrix algorithms can be exact and elegant, yet repeatedly scanning or decomposing that table may dominate the work. Randomized numerical linear algebra replaces the original matrix with a smaller random view that preserves the subspace, product, or low-rank structure needed by the downstream calculation.
The everyday analogy is a carefully designed survey. A naive survey samples people uniformly and may miss a small but influential group. A leverage-aware survey gives higher probability to observations that span unusual directions. A projection takes another route: it mixes all rows or columns into fewer randomized combinations, so every original observation can influence the reduced problem.
For a tiny example, let
$$ A=\begin{bmatrix}1&0\\0&1\\1&1\end{bmatrix},\qquad b=\begin{bmatrix}1\\2\\3\end{bmatrix}. $$
Here $b=A(1,2)^\mathsf T$, so the least-squares residual is zero. Keeping only the first two rows still recovers the solution, but keeping two identical or nearly redundant directions need not. The point is not that row sampling always works; it works when the sample or sketch preserves the column space relevant to every candidate residual.
Matrix multiplication sketches approximate $A^\mathsf TB$ without forming every contribution. Leverage scores identify influential rows or columns. Subspace embeddings preserve norms throughout a fixed subspace. Randomized SVD finds an approximate range before computing a small factorization. Frequent Directions is deterministic: it repeatedly shrinks singular values of a compact matrix and gives covariance-error guarantees in a streaming setting.
Randomized matrix algorithms preserve a declared object—such as a subspace, product, regression objective, or rank-$k$ approximation—not the entire matrix entry by entry. Speedups are meaningful only when the sketching cost, passes, numerical precision, and downstream error contract are included.
| Concept | Intuitive meaning | Exact example | Non-example or boundary | Main assumption | Question answered |
|---|---|---|---|---|---|
| Matrix sketch | Smaller linear view of a matrix | $SA$ has fewer rows than $A$ | Arbitrary truncation with no preservation claim | $S$ matches the required theorem | What smaller problem can replace the original? |
| Approximate matrix multiplication | Estimate $A^\mathsf TB$ from samples or projections | $(SA)^\mathsf T(SB)\approx A^\mathsf TB$ | Entrywise equality | Norm, stable-rank, or probability conditions are stated | Can a costly product be approximated? |
| Leverage score | Row influence on a matrix’s column space | $\ell_i=\lVert e_i^\mathsf TU\rVert_2^2$ for orthonormal $U$ spanning $\operatorname{col}(A)$ | Row norm alone in every matrix | Scores refer to the relevant subspace | Which rows deserve higher sampling probability? |
| Subspace embedding | Preserve all vector norms in a fixed column space | $\lVert SAx\rVert_2\approx\lVert Ax\rVert_2$ for every $x$ | Preserving only each column separately | Fixed subspace and suitable sketch dimension | Does the reduced regression keep every residual direction? |
| Randomized SVD | Find a probable approximate range, then factor a small matrix | $Y=A\Omega$, $Q=\operatorname{orth}(Y)$ | SVD of unrelated sampled entries | Oversampling and spectral structure | Can dominant singular directions be found faster? |
| Frequent Directions | Deterministic streaming covariance sketch | $B^\mathsf TB$ approximates $A^\mathsf TA$ | Random row reservoir | Declared sketch size and shrink rule | Can second-order structure be summarized in one pass? |
Matrices Too Large to Hold Still
Let the rows of $A$ be $a_1=(1,0)$, $a_2=(0,1)$, and $a_3=(1,1)$.
- Compute $A^\mathsf TA=a_1^\mathsf Ta_1+a_2^\mathsf Ta_2+a_3^\mathsf Ta_3=\begin{bmatrix}2&1\\1&2\end{bmatrix}$.
- Uniformly sample one row. If $a_1$ is selected and rescaled by $\sqrt3$, the product estimate is $3a_1^\mathsf Ta_1=\begin{bmatrix}3&0\\0&0\end{bmatrix}$—unbiased over the random row but poor in this realization.
- Averaging many independent samples reduces variance, while nonuniform sampling can prioritize influential rows and rescale by their sampling probabilities.
- Explain why “unbiased” does not mean one sample is accurate and why rescaling is necessary.
Reflection: row $a_3$ has the largest norm, but leverage depends on the whole column space. What could make row norm and leverage give different sampling priorities?
Subspace Views of Low-Rank Structure
Let $A\in\mathbb R^{m\times n}$ have singular value decomposition $A=U\Sigma V^\mathsf T$. The best rank-$k$ approximation under both spectral and Frobenius norms is $A_k=U_k\Sigma_kV_k^\mathsf T$. Its errors are
$$ \lVert A-A_k\rVert_2=\sigma_{k+1},\qquad \lVert A-A_k\rVert_F^2=\sum_{j>k}\sigma_j^2. $$
A randomized range finder draws a test matrix $\Omega\in\mathbb R^{n\times(k+p)}$, forms $Y=A\Omega$, and computes an orthonormal basis $Q$ for the columns of $Y$. It then works with the small matrix $B=Q^\mathsf TA$. If $Q$ captures the leading left singular subspace, $QB$ approximates $A$. Oversampling $p$ reduces the risk that random test vectors poorly excite an important direction. Power iterations use $(AA^\mathsf T)^qA\Omega$ to amplify spectral gaps, at the cost of passes and possible numerical stabilization needs.
For a full-column-rank matrix $A$, the leverage scores of its rows are the diagonal entries of the projector $UU^\mathsf T$, where $U$ spans $\operatorname{col}(A)$. They satisfy $0\le\ell_i\le1$ and $\sum_i\ell_i=\operatorname{rank}(A)$. Sampling rows proportionally to approximate leverage scores protects rare but geometrically important directions better than uniform sampling when coherence is high.
A $(1\pm\varepsilon)$ subspace embedding $S$ for $\operatorname{col}(A)$ satisfies
$$ (1-\varepsilon)\lVert Ax\rVert_2^2\le\lVert SAx\rVert_2^2\le(1+\varepsilon)\lVert Ax\rVert_2^2 $$
for every $x$. For least squares, the relevant subspace often includes both $A$ and $b$, because residuals are $Ax-b$. Preserving only columns of $A$ individually does not preserve every linear combination.
Frequent Directions processes rows into a fixed-size matrix $B$. When full, it computes an SVD, subtracts a common squared singular-value threshold, and discards the directions shrunk to zero. It never overstates directional energy: for every unit vector $x$, $0\le\lVert Ax\rVert_2^2-\lVert Bx\rVert_2^2$ is bounded in terms of the tail energy and sketch size under the chosen theorem.
flowchart TD
A[Large matrix A] --> B{Target task}
B -->|Low rank| C[Random test matrix Omega]
C --> D[Range sample Y equals A Omega]
D --> E[Orthonormal basis Q]
E --> F[Small matrix Q transpose A]
F --> G[Approximate SVD]
B -->|Regression| H[Embed span of A and b]
H --> I[Solve sketched least squares]
B -->|Row sampling| J[Estimate leverage scores]
J --> K[Sample and rescale influential rows]
B -->|Streaming covariance| L[Frequent Directions]
L --> M[Deterministic shrinkage]
G --> N[Low-rank error guarantee]
I --> O[Residual guarantee]
K --> O
M --> P[Directional covariance guarantee]
classDef navy fill:#17365D,color:#fff,stroke:#17365D;
classDef teal fill:#147D84,color:#fff,stroke:#0D565B;
classDef crimson fill:#C6284D,color:#fff,stroke:#861B35;
classDef purple fill:#6C3BAA,color:#fff,stroke:#472675;
class A,B navy;
class C,D,E,H,J,L purple;
class F,I,K,M teal;
class G,N,O,P crimson;
| Definition or theorem | Exact scope | Required assumptions | What it does not imply | Counterexample or consequence |
|---|---|---|---|---|
| Eckart–Young–Mirsky | Truncated SVD is optimal rank-$k$ approximation in spectral and Frobenius norms | Standard real/complex matrix norms | It is cheap to compute for enormous matrices | Exact SVD may require expensive passes and communication |
| Leverage scores | Diagonal of the projector onto the column space; scores sum to rank | Orthonormal basis for the relevant subspace | Large row norm always means high leverage | A large row aligned with many duplicates may have modest leverage |
| Subspace embedding | Simultaneous norm preservation for every vector in a fixed subspace | Sketch dimension and distribution match subspace rank and error target | Individual column preservation is sufficient | Two preserved columns can have a badly distorted difference |
| Randomized range finder | $Q$ captures the dominant range with high probability or in expectation | Suitable random $\Omega$, oversampling, and spectral assumptions of theorem | Exact top singular vectors for every matrix | Flat spectrum can require more rank or power iterations |
| Power iteration | Amplifies ratio between leading and trailing singular values | Extra passes and stable orthogonalization | Free accuracy improvement | Roundoff can erase weak directions without reorthogonalization |
| Frequent Directions | Deterministic covariance/directional-energy error bound | Correct shrinkage, sketch size, and streaming arithmetic | An unbiased random sample of rows | It deliberately shrinks all retained singular values |
The low-rank problem is fundamentally about a subspace: a basis $Q$ is useful when the residual $(I-QQ^\mathsf T)A$ is small. Randomization is a method for discovering that subspace cheaply; the guarantee must name the norm, target rank, oversampling, probability, and spectral assumptions.
Sampling, Projection and Spectral Error
For approximate matrix multiplication, write $A^\mathsf TB$ as a sum of outer products of corresponding rows. Sample row index $i$ with probability $p_i$, and use the rescaled outer product $a_i^\mathsf Tb_i/p_i$. Its expectation is the full product. Repeating and averaging reduces variance. Probabilities proportional to suitable row-norm products or leverage-like quantities reduce the influence of any one rescaled sample. Unbiasedness alone does not control spectral or Frobenius error.
For regression, suppose $S$ preserves the span of $A$ and $b$. Every residual $Ax-b$ lies in that subspace, so
$$ (1-\varepsilon)\lVert Ax-b\rVert_2^2\le\lVert S(Ax-b)\rVert_2^2\le(1+\varepsilon)\lVert Ax-b\rVert_2^2. $$
If $\widetilde x$ minimizes the sketched residual and $x_\star$ minimizes the original, comparing the two inequalities yields an approximate original objective. The proof uses preservation for all candidate residuals, not only for $x_\star$.
Randomized low-rank analysis decomposes error into the optimal tail $A-A_k$ and failure to capture the leading range. Spectral error focuses on the worst direction and is sensitive to a single missed singular vector; Frobenius error aggregates energy and may remain small when one direction is moderately wrong. Always match the norm to the application.
Frequent Directions offers a deterministic alternative. When a sketch $B$ fills, compute $B=U\Sigma V^\mathsf T$, choose a threshold $\delta$ from a trailing squared singular value, and replace singular values by $\sqrt{\max(\sigma_i^2-\delta,0)}$. The removed energy is charged uniformly across directions, yielding a telescoping covariance-error bound. Changing the threshold or omitting rescaling changes the theorem.
flowchart TD
A[State target: product, regression, or rank k] --> B[Choose sketch family and size]
B --> C{Sampling or projection?}
C -->|Sampling| D[Probabilities cover influential rows or columns]
D --> E[Rescale sampled contributions]
E --> F[Unbiased estimator plus concentration]
C -->|Projection| G[Embed the relevant fixed subspace]
G --> H[Preserve every candidate residual]
H --> I[Compare sketched optimum with original optimum]
B --> J{Streaming deterministic option?}
J -->|Yes| K[Frequent Directions shrinkage]
K --> L[Charge discarded energy across directions]
F --> M[Norm-specific product bound]
I --> N[Regression objective bound]
L --> O[Covariance and low-rank bound]
D -. uniform sampling misses high leverage .-> X[Failure]
G -. embed only individual columns .-> Y[Failure]
classDef navy fill:#17365D,color:#fff,stroke:#17365D;
classDef teal fill:#147D84,color:#fff,stroke:#0D565B;
classDef crimson fill:#C6284D,color:#fff,stroke:#861B35;
classDef purple fill:#6C3BAA,color:#fff,stroke:#472675;
class A,B,C,J navy;
class D,G,K purple;
class E,F,H,I,L teal;
class M,N,O teal;
class X,Y crimson;
Sampling, Projection and Spectral Error
Let $A$ have rows $a_1=(2,0)$ and $a_2=(0,1)$. Then $A^\mathsf TA=\operatorname{diag}(4,1)$.
- Uniformly sample one row, so $p_1=p_2=1/2$, and estimate with $a_i^\mathsf Ta_i/p_i$.
- If row one is chosen, the estimate is $\operatorname{diag}(8,0)$; if row two is chosen, it is $\operatorname{diag}(0,2)$.
- Averaging the two outcomes gives $\operatorname{diag}(4,1)$, so the estimator is unbiased, but either single outcome has large spectral error.
- Sample with probabilities proportional to squared row norms: $p_1=4/5$, $p_2=1/5$. The possible estimates become $\operatorname{diag}(5,0)$ and $\operatorname{diag}(0,5)$. Variance in the dominant first direction is reduced, though one sample remains insufficient for a full spectral approximation.
- Repeat $s$ times and average. State that concentration and sample complexity—not unbiasedness alone—must support the chosen error probability.
Assumption-breaking variation: sample nonuniformly but forget division by $p_i$. Compute the expectation and show that high-probability rows are systematically overweighted.
| Analytical tool | What it establishes | Assumptions | Tightness or limitation | Representative failure case |
|---|---|---|---|---|
| Outer-product expectation | Sampled product estimator is unbiased | Positive probabilities and inverse-probability rescaling | No high-probability error bound by itself | One high-norm row dominates variance |
| Matrix concentration | Spectral deviation of sums of random matrices | Independence or matching dependence control and bounded summands | Constants and intrinsic dimension matter | Heavy-tailed rescaled samples violate bounds |
| Leverage sampling | Protects influential subspace directions | Accurate upper bounds on leverage and enough samples | Computing exact scores may itself be expensive | Uniform sampling misses one rare basis direction |
| Subspace embedding proof | Preserves all regression residuals in a fixed span | Embed span of $A$ and $b$ with declared probability | Objective guarantee need not imply coefficient accuracy under ill-conditioning | Nearly singular $A$ gives unstable coefficients |
| Range-finder residual | Measures missed portion $(I-QQ^\mathsf T)A$ | Random probes, oversampling, and theorem-specific spectrum | Spectral guarantee can be weaker than Frobenius guarantee | One missed singular direction dominates operator norm |
| Frequent Directions charging | Deterministic covariance-loss bound | Exact shrink rule and sufficient sketch rows | Shrinkage is biased downward | Changing the threshold invalidates the telescope |
PCA, Regression and Scientific Data
For an approachable PCA task, randomized range finding can compress a tall matrix of student measurements before an SVD. The leading components summarize variance, but interpreting them as causal traits remains unjustified. Centering, scaling, missing values, and categorical encodings define the matrix and can matter more than the sketch.
For large regression, a subspace embedding reduces billions of rows to a manageable problem. It can preserve the residual objective while coefficients remain sensitive if the design is ill-conditioned. Ridge regularization changes the relevant augmented system and must be included in the sketching analysis.
For scientific data, low-rank structure can reveal latent modes in telescope, climate, genomics, or simulation matrices. A weak spectral gap may make individual singular vectors unstable even when the low-rank subspace and reconstruction error are stable. Domain conclusions should reflect subspace uncertainty, not overinterpret one basis orientation.
Adversarial or misleading cases include rare high-leverage observations, drift after sampling probabilities are estimated, corrupted rows with huge norms, and adaptive workloads that respond to a fixed public sketch. A global Frobenius guarantee can hide one scientifically critical direction; a small regression residual can coexist with biased data collection.
PCA, Regression and Scientific Data: Randomized Numerical Linear Algebra
Consider centered observations
$$ A=\begin{bmatrix}2&0\\-2&0\\0&1\\0&-1\end{bmatrix}. $$
- Compute $A^\mathsf TA=\operatorname{diag}(8,2)$. The first coordinate is the leading principal direction.
- The singular values are $\sqrt8$ and $\sqrt2$. The best rank-one squared Frobenius residual is $2$, while the squared spectral residual is also $2$.
- If a row sample keeps only the last two rows, it concludes incorrectly that the second coordinate is the only active direction. Uniform small samples can miss high-energy structure.
- A randomized range sample that mixes all columns has a probability of exciting both singular directions; oversampling and validation reduce failure risk.
Model selection: exact SVD is preferable for this tiny matrix. Use randomized methods only when data movement or decomposition dominates.
Success criteria: derive the covariance, singular values, rank-one direction, and both residual norms; then state a validation rule comparing $\lVert A-QQ^\mathsf TA\rVert_F$ and $\lVert A-QQ^\mathsf TA\rVert_2$ with the optimal tail.
PCA, Regression and Scientific Data: Randomized Numerical Linear Algebra
A genomics pipeline receives a sparse matrix with $m=80$ million observations and $n=20{,}000$ features. It needs rank-$k=100$ structure and ridge regression, permits two passes over distributed storage, targets Frobenius error within $1.1$ times the best rank-100 error, and requires regression objective inflation below $2\%$.
Design: benchmark a randomized range finder with oversampling $p\in\{20,40\}$ and one stabilized power iteration; use a compatible subspace embedding for the ridge-augmented regression system; and compare with a one-pass Frequent Directions configuration when a second pass is operationally expensive. Version preprocessing, transform seed, precision, and sketch size.
Evidence: exact or high-accuracy baselines on representative subsets; residual Frobenius and spectral norms; principal-angle stability; regression objective and coefficient sensitivity; high-leverage and rare-cohort behavior; pass count, network shuffle, peak memory, and p95 runtime; multiple seeds; missing-data and outlier stress tests; and drift after instrument changes.
Risks: a small Frobenius error can hide one scientific direction, weak spectral gaps make component identities unstable, coefficient accuracy can degrade under ill-conditioning, and biased data remain biased after sketching. Preserve audit samples and report subspace uncertainty rather than treating randomized components as ground truth.
Decision: deploy only if confidence bounds meet both low-rank and regression objectives across critical cohorts and the speedup exceeds sketch construction and validation costs. Otherwise keep the deterministic or hybrid pipeline for sensitive analyses.
Design a Randomized Matrix Workflow
Start from the output guarantee, not the fashionable sketch. Specify the matrix shape and access pattern, target task, rank or subspace dimension, norm, relative or additive error, failure probability, passes, precision, and adversary model. Then select sampling, projection, randomized range finding, or deterministic shrinkage and validate the result on the original objective.
Practice: Design a Randomized Matrix Workflow
Use $A=\begin{bmatrix}2&0\\0&1\\0&1\end{bmatrix}$ and target rank $k=1$.
Tier 1 — Definitions. Define leverage score, subspace embedding, approximate matrix multiplication, randomized range finder, spectral error, Frobenius error, and Frequent Directions. State one quantifier or assumption for each.
Tier 2 — Exact baseline. Compute $A^\mathsf TA=\operatorname{diag}(4,2)$, singular values $2$ and $\sqrt2$, and best rank-one residuals $\lVert A-A_1\rVert_2=\sqrt2$ and $\lVert A-A_1\rVert_F=\sqrt2$.
Tier 3 — Sampling. Derive squared row-norm probabilities $(2/3,1/6,1/6)$. For one sampled row, write the rescaled covariance estimator and verify unbiasedness. Explain why one sample cannot preserve both directions.
Tier 4 — Counterexamples. Construct: uniform sampling that misses a rare high-leverage row; a sketch preserving each column norm but distorting their difference; a flat spectrum where top singular-vector identity is unstable; and a non-rescaled nonuniform sample that is biased.
Tier 5 — Method choice. Choose among leverage sampling, dense or sparse projection, randomized SVD, and Frequent Directions for (a) static regression, (b) two-pass low-rank approximation, and (c) one-pass streaming covariance. Name error norm, passes, and verification.
Tier 6 — Professional artifact. Produce a workflow contract including matrix dimensions and sparsity, preprocessing, task, $k$, oversampling $p$, power iterations, sketch size, $\varepsilon$, $\delta$, norm, pass and communication budget, seed/precision versioning, baseline sample, high-leverage tests, drift metrics, and rollback condition.
Debugging prompts: if regression residual rises, confirm the span includes $b$; if components change across seeds, inspect spectral gaps and oversampling; if sampling variance is large, inspect leverage and rescaling; if Frequent Directions overstates energy, audit shrinkage because the standard guarantee is one-sided; if results differ by machine, inspect precision and orthogonalization.
Stretch goal: compare the same low-rank result under Frobenius and spectral objectives. Show how a method may pass one and fail the other, then justify which norm the application actually needs.
Rubric (10 points): definitions and theorem scopes 2; exact baseline 2; sampling derivation 2; valid counterexamples 2; measurable workflow contract 2. Full credit requires separating objective accuracy, coefficient/vector stability, and domain interpretation.
Decision checklist: define the matrix task, fixed subspace or rank, error norm, probability, passes, precision, and validation objective; handle leverage and conditioning; version randomness and preprocessing; and test residuals on the original data. Unbiased is not concentrated, low Frobenius error is not low spectral error, and an accurate numerical subspace is not a causal explanation. These tools extend dimensionality reduction toward streaming covariance, large-scale regression, low-rank optimization, and graph or scientific matrix analytics.
Next in the Series
In Graph Streaming, we'll explore Summarize massive graphs from edge updates..