Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.PCA that ignores gross errors
A matrix of measurements may be mostly simple (low-rank: a few patterns explain it) except for a sprinkling of wildly wrong entries: sensor glitches, occlusions, a moving object in a still scene. PCA tries to fit those glitches and gets pulled off course. Robust PCA splits the matrix into two pieces:
- a low-rank part, the simple structure;
- a sparse part, the few entries that are badly off, however large.
It finds both at once.
Video from a fixed camera is a low-rank background plus sparse moving objects, so robust PCA separates them. Sensor arrays with intermittent faults, telemetry with spikes, and corrupted image collections are all low-rank-plus-sparse. Robust PCA cleans the structure and flags the bad entries in one go.
- 1. Robust PCA writes a matrix as…
- 2. The sparse part captures…
- 3. In the demo, the moving object ends up in…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.The two shrinkage operators by hand
Soft thresholding (the ℓ₁ proximal step) shrinks every entry toward zero by τ. With τ = 1, [[3, −0.5], [−4, 1]] becomes [[2, 0], [−3, 0]].
Singular value thresholding (the nuclear-norm proximal step) shrinks singular values instead. With τ = 1, diag(5, 2, 0.5) becomes diag(4, 1, 0), so the rank drops from 3 to 2.
Norms.
- Nuclear norm ‖X‖_* = sum of singular values. diag(3, −2) has 5; [[1, 1], [1, 1]] has singular values 2 and 0, so 2.
- ℓ₁ norm = sum of absolute entries.
The objective. ‖L‖_* + λ‖S‖₁. For L = diag(3, 0) and S with entries 2 and −1: 3 + λ·3, which is 4.5 for λ = 0.5.
Default λ. Use 1/√(max(m, n)): 0.05 for a 100 × 400 matrix, 0.125 for 64 × 64.
The steps in plain English (inexact augmented Lagrangian):
- Start with L = S = 0, a dual matrix Y, and a penalty μ.
- L ← singular value thresholding of (M − S + Y/μ) at level 1/μ.
- S ← soft thresholding of (M − L + Y/μ) at level λ/μ.
- Y ← Y + μ(M − L − S); increase μ. Repeat until ‖M − L − S‖ is tiny relative to ‖M‖.
- 1. Soft threshold of −0.4 with τ = 0.5?
- 2. SVT of singular values (3, 1, 0.2) with τ = 0.5 gives rank…
- 3. Default λ for a 400 × 400 matrix?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.Why convex relaxation works, and when it fails
From hard to convex. “Lowest rank plus fewest non-zeros” is combinatorial. Replacing rank by the nuclear norm and the count by the ℓ₁ norm gives a convex program, principal component pursuit (PCP):
minimise ‖L‖_* + λ‖S‖₁ subject to L + S = M.
The recovery theorem (Candès et al., 2011). Suppose
- L₀ is incoherent (its singular vectors are spread out, not concentrated on a few rows or columns);
- the support of S₀ is random;
- rank(L₀) ≤ ρ_r·n/(log n)² and the corrupted fraction is at most a constant ρ_s.
Then PCP with λ = 1/√n recovers L₀ and S₀ exactly, with high probability, whatever the magnitudes of the corruptions. That last point is what plain PCA cannot do.
Exercise 1, a 60 × 60 rank-3 matrix with 10% of entries corrupted by values up to ±10:
- PCP recovered L with relative error 1.6 × 10⁻⁷, exactly rank 3, and identified every corrupted entry;
- rank-3 PCA of the corrupted matrix had error 0.36.
Where it breaks. Higher rank or denser corruption leave too little uncorrupted, low-rank evidence. In exercise 2, recovery was exact for rank ≤ 5 with up to 10% corruption, degraded steadily beyond that, and was never exact at rank 20 (a third of the dimension).
Noise. PCP assumes M = L + S exactly. Small dense noise violates this and gets spread over both parts, as the demo shows. Stable PCP (Zhou et al., 2010) adds a Frobenius-norm noise term: minimise ‖L‖_* + λ‖S‖₁ subject to ‖M − L − S‖_F ≤ δ.
Cost. Each iteration needs an SVD, O(mn·min(m, n)), or a partial SVD of the leading singular values. That is fine for moderate matrices; online and partial-SVD variants exist for video.
# Principal component pursuit (inexact ALM), as in exercise 1
L, S, iters = pcp(M, lam=1 / np.sqrt(max(M.shape)))
# Background subtraction: M has one vectorised frame per column; L = background, S = foreground- 1. PCP replaces rank by…
- 2. Exact recovery requires the low-rank part to be…
- 3. Dense small noise is handled by…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Why incoherence? If L₀ were itself sparse (say a single non-zero entry), no method could tell L from S. Incoherence, meaning singular vectors with small maximum entries (about √(r/n)), rules out low-rank matrices that look sparse. Randomness of S’s support rules out sparse matrices that look low-rank (such as a corrupted entire column).
Why λ = 1/√n? It balances the two norms for generic matrices. The dual certificate construction in the proof works for this universal choice, with no tuning needed in theory. In practice λ is often scaled by a factor between 0.5 and 2.
Related problems.
- Matrix completion recovers L from a subset of its entries (missing data rather than corrupted data).
- Outlier pursuit (Xu, Caramanis and Sanghavi) handles entire corrupted columns, using an ℓ₁,₂ norm on S.
- Robust subspace tracking (GRASTA) handles streams.
Interview questions.
- Robust PCA or outlier removal followed by PCA? Robust PCA when corruption is scattered entry-wise across many rows (each row has a few bad entries, so whole-row deletion would discard most data). Outlier pursuit when whole samples are bad.
- How do you check a robust PCA result? Examine the singular value spectrum of L (is there a clear rank?), the pattern of S (does it look like plausible faults, objects or glitches?), and the stability of both under small changes in λ.
- 1. Incoherence rules out low-rank matrices that are…
- 2. Entire corrupted columns call for…
- 3. Recovering a low-rank matrix from missing entries is…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Where does exact recovery stop?
History.
- J. Wright, A. Ganesh, S. Rao, Y. Peng and Y. Ma (2009) and E. Candès, X. Li, Y. Ma and J. Wright (2011) introduced and analysed principal component pursuit.
- V. Chandrasekaran et al. (2011) gave rank–sparsity incoherence conditions.
- Z. Lin, M. Chen and Y. Ma (2010) developed the inexact augmented Lagrangian solver.
- Z. Zhou et al. (2010) proposed stable PCP for noise.
Exercise 2. 60 × 60 matrices, 2 per cell, corruptions uniform in ±10. Each cell shows the relative error of the recovered low-rank part, PCP first, then rank-r PCA.
| rank | 5% corrupt | 10% | 20% | 30% | 40% |
|---|---|---|---|---|---|
| 2 | 5e-8, 0.25 | 1.5e-7, 0.37 | 0.007, 0.50 | 0.067, 0.71 | 0.47, 0.83 |
| 5 | 9e-8, 0.21 | 1.4e-7, 0.38 | 0.028, 0.49 | 0.18, 0.62 | 0.47, 0.75 |
| 10 | 0.020, 0.23 | 0.041, 0.33 | 0.14, 0.49 | 0.36, 0.66 | 0.51, 0.75 |
| 20 | 0.12, 0.21 | 0.21, 0.30 | 0.34, 0.47 | 0.47, 0.61 | 0.52, 0.68 |
- There is a sharp exact-recovery region: low rank and light corruption, where errors were at machine-precision level.
- Beyond it, recovery degrades gradually, not suddenly. It was still better than PCA in every cell; even at rank 20 with 40% corruption, 0.52 against 0.68.
- PCA’s error grew with the corruption fraction regardless of rank, because squared error lets large corruptions dominate.
Robust PCA in AI, robotics and aerospace
- Background subtraction in fixed-camera surveillance and on stationary robots: background in L, movers in S.
- Sensor-array fault isolation: a low-rank healthy structure plus sparse faulty readings.
- Cleaning image collections, for example removing shadows and specularities from face or terrain imagery.
References
- E. J. Candès, X. Li, Y. Ma, J. Wright (2011). “Robust principal component analysis?” Journal of the ACM 58(3).
- V. Chandrasekaran, S. Sanghavi, P. A. Parrilo, A. S. Willsky (2011). “Rank-sparsity incoherence for matrix decomposition.” SIAM Journal on Optimization 21(2).
- Z. Lin, M. Chen, Y. Ma (2010). “The augmented Lagrange multiplier method for exact recovery of corrupted low-rank matrices.” arXiv:1009.5055.
- Z. Zhou, X. Li, J. Wright, E. Candès, Y. Ma (2010). “Stable principal component pursuit.” Proc. ISIT.
- T. Bouwmans, E. H. Zahzah (2014). “Robust PCA via principal component pursuit: a review for a comparative evaluation in video surveillance.” Computer Vision and Image Understanding 122.