PCA geometry

2D Principal Component Calculator

Analyze a two-variable covariance matrix with PCA variance, explained variance, principal angle, correlation, and Mahalanobis distance.

Covariance inputs

Enter the two variances, their covariance and an optional point relative to the mean. The calculator turns the covariance matrix into principal axes.

Principal variance

10.41 units²

The larger eigenvalue of the 2x2 covariance matrix.

Explained variance

80.04 %

Share of total variance captured by the first principal component.

Principal angle

25.1 °

Angle of the main variance axis measured from the X axis.

PCA summary

The explained variance and angle tell you whether most variation lies along one clear direction. Mahalanobis distance shows how unusual the selected point is in that tilted coordinate system.

Secondary variance

2.595 units²

Correlation

0.5

Mahalanobis distance

0.694

Ellipse axis ratio

2.002

Covariance determinant

27

Overview

A 2D principal component calculator turns a two-variable covariance matrix into an interpretable geometric summary. Principal component analysis, or PCA, asks which direction contains the most variation. With two variables, the answer can be shown through a principal variance, a secondary variance, an angle and an explained-variance percentage. This is useful in statistics, data visualization, measurement uncertainty, quality control, engineering tolerances and any workflow where two related quantities move together.

The calculator also reports correlation, covariance determinant, ellipse axis ratio and Mahalanobis distance for a selected point. Together these values explain not only how wide the data cloud is, but also how it is tilted. When covariance is positive, high X values tend to appear with high Y values and the main axis leans upward. When covariance is negative, the axis leans downward. When covariance is near zero, the axes align more closely with the original variables.

How to use it

Enter the variance of X, variance of Y and covariance between X and Y. Use consistent units because variances and covariance use squared units. Add the sample size behind the covariance estimate for context. If you want to evaluate a point, enter its X and Y coordinates plus the mean of each variable. The point section is optional conceptually, but it makes the Mahalanobis distance result meaningful.

Formula and method

The covariance matrix is [[varX, covXY], [covXY, varY]]. The calculator solves its two eigenvalues. The larger eigenvalue is the principal variance and the smaller is the secondary variance. Explained variance is the larger eigenvalue divided by the trace of the matrix. The principal angle comes from the eigenvector direction. Correlation is covariance divided by the product of the two standard deviations. Mahalanobis distance uses the inverse covariance matrix to measure distance in the tilted coordinate system.

Interpreting the results

A high explained-variance percentage means most variation lies along one line-like direction. An axis ratio near one means the spread is more circular; a large ratio means the cloud is elongated. The principal angle tells how the elongated direction is oriented. Mahalanobis distance is often more useful than ordinary distance because it accounts for the fact that variation may be naturally larger in one direction than another.

Practical example

Suppose variance X is 9, variance Y is 4 and covariance is 3. The first principal component captures most of the combined variance because the variables move together. A point at X = 2 and Y = 1 may not be unusual if it lies along the tilted high-variance direction. The same ordinary distance perpendicular to that direction would produce a larger Mahalanobis distance because the data cloud is narrower there.

Limitations

This calculator assumes the covariance values describe a valid symmetric covariance matrix. If covariance is too large relative to the variances, the determinant can become negative and the statistical interpretation breaks down. PCA is also sensitive to scaling: variables measured in larger units can dominate unless they are standardized. Use this tool for transparent 2D analysis, teaching and quick checks, then use a full statistical package for larger datasets.