Four 2-D points are , , and . What are the sample covariance matrix, the first principal component, the fraction of variance it explains, and the coordinate of the first point along it?
Unsupervised learning, Principal component analysis
Level L2 Elementary. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can run PCA by hand from raw points, including centring and the divisor.
Key idea
Centre the data, form , then find its eigenpairs; the projection of a centred point on the unit eigenvector is .
Steps
- The mean is . The centred points are , , and .
- , and the same for . .
- Divide by : .
- For a matrix of the form the eigenvalues are with eigenvectors and . So and .
- The first principal component is . It explains , i.e. of the variance.
- The first point's coordinate is .
Common mistakes
- Projecting the raw point instead of the centred one.
- Dividing by in one place and in another. The eigenvectors do not change, but the eigenvalues and the ratios must be consistent.
- Picking the eigenvector of the smaller eigenvalue, or forgetting to normalise it to unit length.
How long your answer should be
Half a page; 4–5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Unsupervised learning: The covariance matrix of a 4-dimensional dataset has eigenvalues , , and . (a) What fraction of the variance does each principal component explain? (b) How many components are needed to keep at least 90% of the variance? (c) What is the average squared reconstruction error per point when you keep that many?
Next in Unsupervised learning: In matrix factorisation for recommendation, a rating is modelled as with user vector and item vector . With squared loss plus L2 penalty , learning rate and , perform one stochastic gradient step on this rating. What are the new , and prediction?