# A Tutorial on Principal Component Analysis

Principal component analysis finds the directions that carry most of the variance in data

Jonathon Shlens · arXiv · 2014-4-3

- **Problem** Recorded measurements are often redundant and noisy, so the underlying dynamics stay hidden. Naive camera coordinates mix the motion along arbitrary axes, and the useful direction is hard to see.
- **Method** PCA rotates the naive basis toward directions of largest variance. It takes the eigenvectors of the covariance matrix as the new basis, so the new coordinates are uncorrelated and ranked by variance.
- **Results** The authors show that the eigenvectors of the covariance matrix give principal components with a diagonal covariance. The spring example is illustrative only, with no measured comparison against other methods.

## Why raw measurements hide the dynamics

Picture an experimenter who films a ball on an ideal spring with three cameras, each reporting a two-dimensional position. Stacking the six image coordinates gives one six-dimensional sample, and ten minutes at 120 Hz yields 72000 samples. The motion truly runs along one axis, yet the camera angles are arbitrary and the real axes are unknown, so the recordings look tangled.

Air, imperfect cameras and friction add noise that hides the dynamics further.

What the experimenter needs is a way to find the one direction that carries the motion. PCA is offered as that method, because it re-expresses the measurements so that the important dimension stands out. The toy spring problem is therefore a test of whether that re-expression recovers the x direction.

## PCA as a linear change of basis

The key idea is to write every sample as a linear combination of new basis vectors chosen to suit the data. The starting point is the naive basis of the cameras, which is the identity and mirrors how the data were recorded rather than any deeper structure. So PCA asks whether another basis, built linearly from the original one, expresses the data better.

Let X be an m by n matrix whose columns are samples, so in the toy case m is 6 and n is 72000. A matrix Y is then related to X by a linear transform P, which the authors write as PX = Y. \\\[ PX = Y \\\] Each entry of a column of Y is a dot product of one row of P with one sample, so the rows of P serve as basis vectors.

Linearity alone does not pin down P, so further assumptions are needed to choose it. Those assumptions are what the next sections build up.

## Variance as signal and covariance as redundancy

Large variance along a direction is treated as signal, and spread that departs from the trend is treated as noise. The signal-to-noise ratio compares the two variances, and a high value marks a precise measurement. The authors assume that directions with the largest variance carry the dynamics of interest. In the spring example, the best-fit line through camera A's cloud points along the motion, so rotating the naive basis onto that line recovers it.

Two recordings that are strongly correlated are redundant, because one can be computed from the other. Covariance quantifies this linear relationship, and the authors define it as an average product of zero-mean measurements. For many measurement types they collect the samples into a matrix and define the covariance matrix as follows. \\\[ C\_X = \\frac{1}{n} X X^{T} \\\] A footnote notes that practice uses a 1/(n-1) normalization instead.

The diagonal of this matrix holds the variances of each measurement type, and the off-diagonal entries hold their covariances. PCA therefore wants a transformed covariance that is diagonal, so the new coordinates are uncorrelated and ranked by variance. Requiring orthonormal basis vectors makes this search tractable, while a greedy search would pick one direction at a time.

An analytical solution to the search exists, so the greedy procedure is not needed.

## Solving with eigenvectors of the covariance

The idea is that a symmetric matrix is diagonalized by the matrix of its orthonormal eigenvectors. So PCA can pick P from the eigenvectors of the covariance matrix, which is symmetric.

Substituting Y = PX into the covariance of Y gives a formula in terms of P and C\_X. \\\[ C\_Y = P C\_X P^{T} \\\] Choosing P as the transpose of the eigenvector matrix E, and using the fact that P's inverse equals its transpose, makes C\_Y equal to a diagonal matrix D.

In practice this means subtracting the mean of each measurement type and then computing the eigenvectors of C\_X. The ith diagonal value of C\_Y is then the variance of X along the ith principal component. The authors provide a Matlab function, pca1, that follows this covariance route, although they note it is explanatory rather than efficient.

## The SVD route to the same answer

The authors derive SVD from the matrix X^T X, whose eigenvectors v give singular values as square roots of their eigenvalues. Each left vector is then u equal to X v divided by its singular value, which yields the scalar relation below. \\\[ X\\hat{v}\_i = \\sigma\_i \\hat{u}\_i \\\]

Stacking these scalar relations gives XV = UΣ, and multiplying by V transpose yields X = UΣV^T.

Rewriting the decomposition as U^T X = Z shows that U^T is a change of basis, and its rows span the column space of X. The same argument applied to X^T gives V as the basis of the row space.

For PCA, the authors define Y as one over the square root of n times X transpose, so that Y^T Y equals the covariance matrix. \\\[ Y^{T} Y = C\_X \\\] The columns of V from the SVD of Y are therefore the eigenvectors of C\_X, which are the principal components. The matching Matlab function pca2 follows this SVD route.

## What the evidence does and doesn't show

The paper has no benchmark tables, so its support is the algebraic derivation, the appendix proofs and the spring illustration. The main experiment-like check is the spring example, which is described in prose rather than with measured numbers.

The authors describe the spring case as one in which most variation falls along a single dimension, even though six dimensions are recorded. That is an illustrative claim about the toy setup, not a measured comparison against another method.

Appendix A proves that an orthogonal matrix's inverse equals its transpose, and that symmetric matrices diagonalize by orthonormal eigenvectors. These proofs support the eigenvector and SVD derivations rather than any empirical result.

The authors state that under mean squared error PCA gives the optimal reduced representation, and they say this can be proved. The text does not give that proof.

## Limits of PCA

PCA removes only second-order dependencies, so higher-order structure in the data is left in place. Because PCA takes no parameters to tune, it ignores how the data were recorded.

A person tracked on a ferris wheel can be described by one angle, yet PCA would not recover that variable. Data with non-Gaussian distributions and non-orthogonal axes also make the high-variance axes point the wrong way.

Kernel PCA applies a nonlinearity first, which requires prior knowledge of a suitable naive basis. Independent component analysis instead requires statistical independence, which succeeds in many domains but can be hard to compute. The paper does not run either alternative.

## Paper info

- **Authors**: Jonathon Shlens
- **Venue**: arXiv · Preprint
- **First published**: 2014-4-3
- **Added**: 2026-11-12
- **Updated**: 2014-4-3
- **Version**: v1
- **arXiv**: 1404.1100
- **Category**: cs.LG · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1404.1100v1) · [PDF ↗](https://arxiv.org/pdf/1404.1100v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Jonathon Shlens (2014). A Tutorial on Principal Component Analysis. arXiv:1404.1100v1. https://arxiv.org/abs/1404.1100v1

**BibTeX**

```
@misc{shlens2014tutorial,
  title = {{A Tutorial on Principal Component Analysis}},
  author = {Jonathon Shlens},
  year = {2014},
  eprint = {1404.1100},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1404.1100v1}
}
```

## Other paper commentary

- [Estimation and Inference of Heterogeneous Treatment Effects using Random Forests](https://refivu.com/en/papers/ee58e924-ae1d-4d66-9ec5-6c7d18a8692c-estimation-and-inference-of-heterogeneous-treatment-effects.md)
- [Popular Ensemble Methods: An Empirical Study](https://refivu.com/en/papers/5090a4a5-58f8-4919-88f2-f93e9b4007cb-popular-ensemble-methods-an-empirical-study.md)
- [A Survey on Multi-Task Learning](https://refivu.com/en/papers/98bc12a0-4d8a-482c-a7f3-4cb8b097be35-a-survey-on-multi-task-learning.md)
- [A Survey on Deep Transfer Learning](https://refivu.com/en/papers/70d5585b-a29e-478d-99ba-9a1b29ac99c1-a-survey-on-deep-transfer-learning.md)
- [Scalable and accurate deep learning for electronic health records](https://refivu.com/en/papers/80cf3810-6b7d-4305-b76c-de501726decd-scalable-and-accurate-deep-learning-for-electronic-health.md)
- [A Comparative Analysis of XGBoost](https://refivu.com/en/papers/e2cd85b1-68fe-463c-be8d-ad73613040b8-a-comparative-analysis-of-xgboost.md)
- [Embedding Entities and Relations for Learning and Inference in Knowledge Bases](https://refivu.com/en/papers/d1a4fc27-43e3-48ba-b0b6-d1a50a552670-embedding-entities-and-relations-for-learning-and-inference.md)
- [PointRCNN: 3D Object Proposal Generation and Detection from Point Cloud](https://refivu.com/en/papers/fd8426c6-d509-42eb-acc7-0541fd5f7fdd-pointrcnn-3d-object-proposal-generation-and-detection-from.md)
- [SphereFace: Deep Hypersphere Embedding for Face Recognition](https://refivu.com/en/papers/f6744cc0-1f38-4983-a7df-1f878512f241-sphereface-deep-hypersphere-embedding-for-face-recognition.md)
- [Performance Measures and a Data Set for Multi-Target, Multi-Camera Tracking](https://refivu.com/en/papers/9fda5f2a-866b-4d9c-a173-3e82bc5e8e0e-performance-measures-and-a-data-set-for-multi.md)
- [VGGFace2: A dataset for recognising faces across pose and age](https://refivu.com/en/papers/71a96842-a08d-49a9-b6a5-7cdbf9f76e4f-vggface2-a-dataset-for-recognising-faces-across-pose.md)
- [A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks](https://refivu.com/en/papers/22cf25fe-084f-44ca-aecf-bc06457c3a2c-a-baseline-for-detecting-misclassified-and-out-of.md)

## Terms in this paper

- [mean squared error](https://refivu.com/en/terms/e8df98e6d7b7-mean-squared-error)
- [Principal component analysis](https://refivu.com/en/terms/5e8334d817e7-principal-component-analysis)
- [independent component analysis](https://refivu.com/en/terms/6d4dccf8a165-independent-component-analysis)
- [signal-to-noise ratio](https://refivu.com/en/terms/9b3a8b590fb6-signal-to-noise-ratio)
- [singular value decomposition](https://refivu.com/en/terms/b3f15c76a7e2-singular-value-decomposition)
- [variance](https://refivu.com/en/terms/181e9562b0e0-variance)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/6c1b9168-7aa0-40d4-97a5-859e8217739b-a-tutorial-on-principal-component-analysis)
