Chapter 1: The Geometry of Data Compression — Centering, Projections, and Orthogonal Shadows
Principal Component Analysis (PCA) begins with a concrete engineering question: how do you compress a high-dimensional cloud of observations onto a lower-dimensional subspace while losing as little geometric structure as possible? Before a single matrix determinant or eigenvalue ever enters the picture, PCA is fundamentally a shadow-casting problem in Euclidean space.
When we approach PCA from the top down, we start with raw data points, shift their center of gravity to the origin, project every point perpendicularly onto a candidate axis , and measure the distortion caused by flattening the cloud. Understanding these three geometric operations—centering, orthogonal projection, and perpendicular residuals—unlocks the entire logic of dimensionality reduction.
In this Article
- 1. The Top-Down Problem: Compressing 2D Data onto a 1D Line
- 2. Step 1: Mean-Centering Shifts the Origin to the Cloud Centroid
- 3. Step 2: Casting Perpendicular Shadows with Unit Vectors
- 4. Step 3: Orthogonal Reconstruction Error vs. Regression Residuals
- 5. Complete Worked Numerical Example
- 6. Spatial Analogy and Where It Breaks Down
- 7. Critical Misconceptions and Edge Cases
- 8. Active Recall Check and Key Takeaways
1. The Top-Down Problem: Compressing 2D Data onto a 1D Line
Suppose you record two correlated measurements—say height and arm span —for individuals. Each person is represented as a column vector in . Because height and arm span grow together, the scatter plot forms a tilted elliptical cloud rather than a uniform square.
If storage or downstream modeling requires compressing those two numbers per person into a single summary score , we must choose a straight line passing through the center of the cloud and replace each 2D point with its closest point on that line.
x2 (Arm Span, Centered)
^
| * x_i (True 2D Data Point)
| / \
| / \ e_i (Perpendicular Error)
| / v
| * / (o) x_hat_i = (x_i . u) u [Shadow on Line]
| / /
-------+----------0------+-----------------> x1 (Height, Centered)
| / /
| (o) / / <-- Candidate Line spanned by unit vector u
| ^ /
| \/
| *
2. Step 1: Mean-Centering Shifts the Origin to the Cloud Centroid
A linear subspace (a line or plane in linear algebra) must pass through the coordinate origin . If our raw data cloud is centered around centimeters, any line forced through would primarily point from the origin toward the average human size rather than capturing person-to-person variation.
To isolate internal variation, we compute the sample mean vector and subtract it from every observation:
This translation preserves every pairwise distance and angle between observations while placing the centroid of the cloud directly at .
3. Step 2: Casting Perpendicular Shadows with Unit Vectors
Once the cloud is centered at , any candidate line through the origin is defined by a unit direction vector satisfying . Restricting to unit length ensures that acts purely as a directional compass without stretching or shrinking our measurement scale.
Core Projection Formulas: For any centered observation and unit vector (with ):
- Scalar Score (1D Coordinate along the line):
- Reconstructed Point (2D/3D Shadow on the line):
4. Step 3: Orthogonal Reconstruction Error vs. Regression Residuals
When we approximate by its shadow , the residual vector is , and its Euclidean length is the orthogonal reconstruction error .
| Property | Ordinary Least Squares (OLS Regression) | Principal Component Analysis (PCA) |
|---|---|---|
| Variable Roles | Asymmetric: is noise-free predictor, is response | Symmetric: all features treated equally |
| Error Direction | Vertical distance parallel to the axis | Perpendicular (orthogonal) distance to the line |
| Rotation Invariance | Not rotation-invariant; swapping axes changes the line | Fully rotation-invariant; geometry depends only on point cloud |
5. Complete Worked Numerical Example
Consider a raw 2D dataset of points: and .
- Center the data: The mean vector is . Subtracting gives and .
- Project onto a candidate axis: Let us test the horizontal unit axis . The 1D score for is .
- Reconstruct and measure error: The shadow on the horizontal axis is . The residual vector is , giving squared error .
- Compare with the optimal axis: If instead we choose , then , the reconstructed point is , and the reconstruction error drops to !
6. Spatial Analogy and Where It Breaks Down
Think of the 2D data cloud as a constellation of glowing fireflies frozen in a dark room, and the unit vector as a straight metal rod passing through the center of the swarm. Projecting each point onto is like connecting each firefly to the rod with the shortest possible perpendicular elastic spring; the best rod orientation minimizes the total elastic energy stored in all springs.
Where the analogy breaks down: Physical springs exert mechanical forces that pull the rod according to torque around a pivot, whereas in PCA every spring length is squared () precisely so that orthogonal components decouple cleanly via the Pythagorean theorem across arbitrary dimensions .
7. Critical Misconceptions and Edge Cases
Common Trap — Using Non-Unit Vectors in : If you use an unnormalized vector such as (where ), the formula stretches every shadow by a factor of ! For a non-unit vector , you must divide by : . Normalizing upfront eliminates the denominator.
8. Active Recall Check and Key Takeaways
Quick Check: Test Your Understanding
Question: A centered 2D point is , and our candidate axis is at with unit vector . What is the scalar projection , the 2D shadow , and the squared orthogonal error ?
Answer: First, compute the dot product: . Next, multiply by to get the 2D shadow: . Finally, the residual vector is , so the squared error is .
- Mean-centering places the dataset's center of mass at the origin so linear subspaces capture internal spread rather than distance from the origin.
- Unit direction vectors () allow scalar projections to be written simply as and vector reconstructions as .
- Orthogonal residuals treat all features symmetrically, distinguishing PCA from vertical least-squares regression.
- Canonical References: Explore Jonathan Shlens' Tutorial on Principal Component Analysis (arXiv:1404.1100) and the Wikipedia Reference on Principal Component Analysis.
Take a Quiz Based on This Article
Test your understanding with AI-generated questions tailored to this content
Adaptive Learning with SynLearn
Explore this article through guided practice that adapts to your answers