How do you show that Ward's linkage, which merges the pair of clusters that least increases the total within-cluster sum of squares, has merge cost Δ(A,B)=nAnBnA+nB∥μA−μB∥2? How do you check it on A={0,2} and B={6}?

Unsupervised learning, Hierarchical clustering
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can derive the increase in sum of squared errors (SSE) on merging using the decomposition of variance about two means.

Key idea

For a cluster C with mean μC, SSE(C)=∑x∈C∥x−μC∥2. The merged mean is the weighted average μ=nAμA+nBμBnA+nB, and the SSE increase is Δ=nA∥μA−μ∥2+nB∥μB−μ∥2.

Steps

  1. Write Δ=SSE(A∪B)−SSE(A)−SSE(B). This is the increase in total SSE when the two clusters are merged.
  2. For points in A, ∥x−μ∥2=∥x−μA∥2+2(x−μA)⊤(μA−μ)+∥μA−μ∥2. Sum over x∈A. The cross term vanishes because ∑x∈A(x−μA)=0. So ∑x∈A∥x−μ∥2=SSE(A)+nA∥μA−μ∥2. The same holds for B.
  3. Hence Δ=nA∥μA−μ∥2+nB∥μB−μ∥2.
  4. Substitute μA−μ=nBnA+nB(μA−μB) and μB−μ=−nAnA+nB(μA−μB). Then Δ=nAnB2+nBnA2(nA+nB)2∥μA−μB∥2=nAnBnA+nB∥μA−μB∥2.
  5. Check: μA=1, μB=6, so Δ=2⋅13⋅25=16.67. Directly, the merged mean is 8/3 and SSE(A∪B)=64+4+1009=18.67, while SSE(A)=2 and SSE(B)=0, so Δ=18.67−2=16.67. It matches.
  6. Interpret: the factor nAnBnA+nB penalises merging two large clusters, so Ward tends to produce clusters of similar size, unlike single linkage.

Common mistakes

How long your answer should be

One page; 6–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: How do you compute PCA from the singular value decomposition (SVD) of the centred data matrix Xc∈Rn×d, how are the principal directions, variances and projected coordinates read off it, and why is the SVD route preferred in practice?
Next in Unsupervised learning: A 1-D Gaussian mixture has two components with equal weights π1=π2=0.5, means μ1=0 and μ2=4, and both variances equal to 1. For the data {0,1,5}, what are the E-step responsibilities and the updated weights and means after one EM iteration?