Hexa Scholar

What a covariance matrix does to a circle

Navy and gold beads scattered in a cream tray, beside an unmarked wooden caliper.
A cloud of beads and a measuring tool: a metaphor for comparing spread in different directions.

The question

Can you tune two variances and a correlation until the cloud's match score reaches 100?

The shape is a clue. The matrix tells you how to measure it.

  1. 1 SeeTurn the cloud into a circle.
  2. 2 TryTest what the boundary means.
  3. 3 ProveBuild the square-root argument.
  4. 4 ApplyCompute axes, distances and scales.
Before you start · 3 quick checks on variance, covariance and eigenvectors

Two ideas before you start

2 ideas

Measure deviations from the center

A small point cloud and its center; translating both preserves their relative positions.

Covariance records spread around the mean. Moving every point by the same amount changes the mean but leaves covariance unchanged.

Exact definition

Let \(X=(X_1,X_2)^T\) have finite second moments and mean \(\mu=E[X]\). Its covariance matrix is

\[\begin{aligned}\Sigma&=E[(X-\mu)(X-\mu)^T]\\&=\begin{pmatrix}v_1&c\\c&v_2\end{pmatrix}.\end{aligned}\]

Here \(v_i=\operatorname{Var}(X_i)\) and \(c=\operatorname{Cov}(X_1,X_2)\). When both variances are positive, \(c=\rho\sqrt{v_1v_2}\), where \(\rho\) is correlation. The lesson on covariance and correlation explains these entries. For an equally weighted finite cloud, expectation means the average over its points.

Read the matrix along a direction

A unit direction through a centered cloud; its projection has a variance.

A unit vector chooses a direction to measure. Projecting the centered cloud onto that line turns its spread into a scalar variance.

Exact definition

For a unit column vector \(q\), the scalar projection is \(q^T(X-\mu)\). Expanding its square gives

\[\operatorname{Var}(q^TX)=q^T\Sigma q.\]

The variance is nonnegative in every direction. This property is called positive semidefiniteness. Because \(\operatorname{Cov}(X_1,X_2)=\operatorname{Cov}(X_2,X_1)\), the matrix is also symmetric, so every covariance matrix is symmetric positive semidefinite. A covariance is positive definite when the variance is strictly positive in every nonzero direction. The figures use equal spatial units on both coordinate axes; otherwise the apparent angle and shape would depend on the drawing scale.

Refresher: orthonormal eigenvectors

An eigenvector satisfies \(\Sigma q=\lambda q\) and is nonzero. For a real symmetric matrix, the spectral theorem supplies an orthonormal basis of eigenvectors. Put them in the columns of \(Q\). Then

\[\Sigma=Q\Lambda Q^T,\qquad Q^TQ=I.\]

The diagonal matrix \(\Lambda\) lists the matching eigenvalues. The transpose \(Q^T\) finds coordinates along those perpendicular unit directions; \(Q\) converts back. Orthogonal changes of coordinates preserve lengths. For covariance matrices the eigenvalues are nonnegative, because each is the variance in its unit eigenvector direction. Equal eigenvalues allow many choices of axes.

1 See

Undo the cloud's stretch

Dots: the transformed cloud. Solid circle: the target. Dashed curve: its current covariance ellipse. Dotted principal axes appear after a check. Both coordinate axes use the same scale, which adjusts to keep every point visible.
How the score and synthetic points work

The score is \(100/(1+e)\), where \(e=\|C-I\|_F\). The Frobenius norm squares every matrix entry, adds, and takes a square root. A round ellipse of the wrong size still loses points. The goal uses \(e\le0.05\), an approximate match; the score can round to 100 without exact equality.

The synthetic points use equally spaced directions on concentric rings. Their average is zero and their covariance, with divisor n, is I before the source stretch. They are a designed cloud, not a random sample from a normal distribution. The unit circle is a geometric input boundary, not that standardized cloud: a uniform distribution on the unit circle has covariance I/2.

The controls keep both proposed variances positive and correlation strictly between −1 and 1. This guarantees that B is invertible and has a real positive square root. Center real data before whitening; otherwise a nonzero mean remains a separate issue.

2 Try

What does the boundary tell you?

Now suppose X is a centered bivariate normal random vector with positive definite covariance Σ. The boundary is \(x^T\Sigma^{-1}x=1\). Predict the probability inside before opening the explanation.

3 Prove

Derive the square-root stretch

Covariance-ellipse theorem

Let Σ be a real symmetric positive definite matrix in the plane, with orthonormal eigenvectors \(q_1,q_2\) and eigenvalues \(\lambda_1,\lambda_2\). Let Z have mean zero, finite second moments and covariance I. Define \(A=Q\Lambda^{1/2}Q^T\), taking positive scalar square roots. Then X = AZ has covariance Σ.

The image of the unit circle under A is \(x^T\Sigma^{-1}x=1\). Its semiaxes lie along the eigenvectors and have lengths \(\sqrt{\lambda_i}\). Conversely, \(W=A^{-1}\) whitens X. No normal-distribution assumption is used in this theorem.

For the builder, u is any unit vector. The covariance transformation rule follows by expanding \(E[(AZ)(AZ)^T]\): fixed matrices can be pulled outside expectation, so \(\operatorname{Cov}(AZ)=A\operatorname{Cov}(Z)A^T\).

4 Apply

Read a matrix as a shape

Use what you found above. Enter a decimal without units. Each problem accepts the stated tolerance around its unrounded answer. Keep intermediate values unrounded; hints and worked solutions are available after you act.

Key point First identify the covariance and center. Then choose the task: eigenvalues for directional variance, square roots for lengths, or the inverse for standardized distance.
Level IntermediatePrerequisites Covariance and correlation, symmetric matrices, eigenvectorsTime ~30 min

Further reading