For a clustering of data points into clusters with centroids and overall mean , prove that total scatter = within-cluster scatter + between-cluster scatter. Why does this show that minimising k-means cost is the same as maximising between-cluster scatter? How do you check it on the 1-D clusters and ?
Unsupervised learning, k-means theory
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can split the total sum of squares by adding and subtracting the cluster centroid, and use the result to interpret the k-means objective.
Key idea
. The left side does not depend on the clustering, so lowering the first term on the right forces the second to rise.
Steps
- Define total scatter , within-cluster scatter , and between-cluster scatter , where .
- For , write and expand the square: .
- Sum over . Since is the mean of the cluster, , so the cross term vanishes. What remains is .
- Sum over to get .
- The k-means cost is . The data fix , so minimising is the same as maximising . So k-means makes clusters tight and also pushes the centroids apart.
- Check on . Overall mean , so . Cluster means are 1.5 and 6.5, so . Then . Indeed .
Common mistakes
- Forgetting the weights in . Large clusters count more.
- Not using the fact that is the cluster mean. Only then does the cross term vanish.
- Concluding that k-means stops at the global optimum because is fixed. The identity only says the two objectives agree.
- Using non-squared distances. The identity needs squared Euclidean distance, so it fails for k-medoids with absolute distance.
How long your answer should be
Half a page; 3–4 minutes.
Last checked on 4 December 2026.
Read this
Previous in Unsupervised learning: For , find the singular values, the best rank-1 approximation in the Frobenius norm, and the approximation error. What fraction of the squared Frobenius norm does keep, and why is this the best possible rank-1 choice?
Next in Unsupervised learning: Centred 2-D data has covariance . What is a whitening matrix so that has identity covariance? What is for , and how do you check that equals the Mahalanobis distance of ?