PCA principal component analysis explained
Suppose you scatter a handful of millet on a desk. If the grains do not spread in a round patch but lie in a long streak, anyone can point at a glance to the direction of widest spread. That is exactly the question principal component analysis (PCA) asks: in a cloud of data, which direction is most spread out? That direction is the first principal component (PC1), and the direction of second-widest spread, perpendicular to it, is PC2. Remarkably, these two directions are the eigenvectors of the data's covariance matrix, and the spread along each, its variance, is exactly the eigenvalue. The eigen idea from "Eigenvectors Are the Directions That Don't Turn" is used here, unchanged, for the spread of data.
Drag the handle to swing the point cloud around and the whole cloud tilts along with the handle. Whatever the angle, the gold ellipse enclosing the points (the covariance drawn at 1-sigma) turns along with the cloud. The longest axis inside that ellipse (green) is PC1, and the short axis perpendicular to it (orange) is PC2. The lengths of the two axes are the square roots of the variance in each direction, that is, the standard deviations, and the two variances are shown below. However you turn the cloud, PC1 always points exactly along the widest spread. These axes are precisely the eigenvectors of the covariance matrix computed from the points.
This time, change only the cloud's angle with the slider. Two axes, PC1 (green) and PC2 (orange), always follow. PC1 is the direction of greatest variance, and PC2 is the second direction, exactly perpendicular to it. Wherever you set the slider, the two axes keep 90 degrees between them, because the eigenvectors of a symmetric covariance matrix are always mutually orthogonal. So the principal components split the data cleanly into non-overlapping directions. Information on one axis does not leak into the other.
You can measure for yourself why PC1 is special. Turn a direction line with the slider and every point is projected perpendicularly onto that line, leaving a footprint. How widely those footprints spread along the line is the variance in that direction, and its value appears below as a bar and a number. Turn the line this way and that: the variance peaks when the line lies along PC1 and sinks to its minimum when it lies along PC2. Near the maximum, the line, the footprints, and the bar turn green. That is why PC1 is also defined as the direction that maximizes variance. The most spread-out direction is the direction where the most information survives.
Now for the real use: dimension reduction. Keep only one axis, PC1 or PC2, with the toggle, and the points are pressed flat onto that axis, while the discarded perpendicular direction appears as red dashed tails, the reconstruction error. The readout is the variance of the discarded axis, the amount of information lost. Keeping only PC1 gives the shortest tails, because you threw away the least spread-out direction and so lost the least. Shrinking 2D to 1D while keeping the loss as small as possible: that is how PCA compresses data.
Finally, a tool for asking how many dimensions you really need. Stretch the cloud with the slider from round to very elongated, and the two bars show the ratios of the eigenvalues: on top λ1/(λ1+λ2), below λ2/(λ1+λ2). When the cloud is round, the two bars are close to 50 to 50, so keeping only one axis loses half. As it grows more elongated, the PC1 bar approaches 100 percent and PC2 drops to nearly 0. Then keeping a single axis preserves almost all the information. This explained-variance ratio is the yardstick for judging how many dimensions the data can safely be reduced to.