b2KIT

PCA Dimensionality Reduction Visualizer

Perform Principal Component Analysis on 2D/3D data. Visualize eigenvectors, variance explained, and projected data.

Tested tool guide Tested browser tools Checked August 16, 2026

What PCA Dimensionality Reduction Visualizer does, with a checked example

This tool centers a set of 2D or 3D points on their mean, builds the covariance matrix, and solves for its eigenvectors and eigenvalues to find the directions along which the data spreads out most. Those eigenvectors are drawn as axes through the centroid, ranked by the percentage of total variance each explains, and the original points are re-expressed as coordinates along them. The thing people get wrong most often: eigenvector direction is arbitrary (pointing one way or its exact opposite is equally valid), and if points are nearly collinear, one component can end up explaining almost all the variance while the other explains almost none.

Worked example

A concrete input and expected output from the current implementation.

Input

(0,0), (1,1), (2,2), (3,3)

Expected output

Mean (1.5, 1.5). Eigenvalues: 10/3 (~3.333) and 0. PC1 direction (0.7071, 0.7071) explains 100% of variance; PC2 direction (0.7071, -0.7071) explains 0%. Projected PC1 scores: -2.121, -0.707, 0.707, 2.121.

All four points sit exactly on the line y = x, so every bit of spread lies along the (1,1) direction and none is left over for the perpendicular direction, which is why one eigenvalue is 10/3 and the other is exactly 0.

How the result is produced

1

Centering and eigendecomposition

The tool subtracts each column's mean from the raw coordinates, then builds the covariance matrix from the centered values. For 2D input it solves the resulting quadratic directly for eigenvalues and eigenvectors; for 3D it uses a numerical eigensolver. Eigenvalues are sorted largest to smallest and labeled PC1, PC2, (PC3) - this fixes the ranking but not the sign of each eigenvector.

2

Variance explained and projection

Each eigenvalue is divided by the sum of all eigenvalues to give the percentage of variance explained, shown next to its axis on the plot. The tool also projects every centered point onto each eigenvector by dot product, giving the reduced-dimension coordinates you would keep if you dropped the smaller components.

Good uses

  • checking how much of a small dataset's spread lies along one direction before deciding whether reducing it to fewer dimensions loses much information
  • visually confirming a hand-computed covariance matrix, eigenvalue, or eigenvector answer from a linear algebra or statistics course
  • showing students geometrically what an eigenvector of a covariance matrix looks like relative to the scattered data points it came from

Limits and checks

  • eigenvector sign is arbitrary: the tool may draw PC1 pointing opposite to a textbook's answer even though the axis and variance explained are identical
  • with only 2 or 3 input dimensions this is a geometric teaching aid, not a real dimensionality-reduction workflow - it won't substitute for PCA run on an actual high-dimensional dataset
  • when spread is nearly equal in every direction (points scattered in a circle or sphere), the reported principal axes are unstable and small changes to the input can swap or rotate them

Common questions

Does it compute PCA on the covariance matrix or the correlation matrix?

It uses the covariance matrix of the centered values, not the correlation matrix, so nothing is rescaled to unit variance before the eigendecomposition. That makes the result scale-sensitive: if your x, y, or z axes are in very different units or ranges, the axis with the larger numeric spread will dominate the eigenvectors purely because of its scale. If that's not what you want, z-score each column yourself before entering the data.

Can I paste in more than three columns of data?

No. The tool plots eigenvectors as arrows on a 2D or 3D chart, so it's built around two or three numeric coordinates per point. For PCA on higher-dimensional data you need a numerical computing tool that doesn't depend on drawing the result geometrically.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools