Use the corrected decomposition
The hint's minus sign before is a typographical error. Squaring, summing, and using for each coordinate gives the centroid sum-of-squares identity
Since and , the final term is strictly positive. Hence
Thus the centroid uniquely minimizes the sum of squared Euclidean distances to the observations.
Write for row of the data matrix. The k-means clustering objective is the within-cluster sum of squared Euclidean distances:
The nonempty form a partition of a set of observation indices. For fixed clusters, part (a) shows that the best is their centroid.
Initialize distinct centres, for example by choosing distinct observations. Then repeat the following steps:
  • Assign each observation to a nearest centre in Euclidean distance. Keep its current assignment on an exact tie; for a previously unassigned observation use a fixed ordering to resolve ties.
  • If a cluster is empty, choose an observation from a cluster with at least two members and make it the empty cluster's sole member, placing its centre at that observation. A definite rule is to choose an eligible observation farthest from its currently assigned centre, breaking ties by observation index. Repeat until all clusters are nonempty.
  • Replace each centre by the arithmetic mean of its assigned observations.
  • After updating, check whether every observation is still assigned to a nearest updated centre, retaining its assignment on ties. If so, stop; otherwise repeat.
The empty-cluster repair is possible for and cannot increase : the transferred observation now has squared distance zero, while all other squared distances stay unchanged before the centre update.
Assignment cannot increase , and any changed assignment strictly decreases it under the tie rule. Updating centres cannot increase by the centroid sum-of-squares identity. After an update, the centres are determined by the partition of a set. There are only finitely many possible assignments. Unless this is the initial round, any nonterminal round starts with an assignment that strictly reduces ; repairing empty clusters and updating cannot undo that decrease. Thus a partition cannot recur, proving finite termination of K-means clustering. The final result need not be a global minimum; different initial centres can lead to different final clusterings.
Sort the distinct observations as . For ordered centres , a point is closer to than to precisely when it lies to the left of their midpoint. Thus each Voronoi cell is an interval, with either choice allowed for an endpoint tie. Consequently, after assignment, each nonempty cluster is a contiguous block of the sorted observations.
The arithmetic means of disjoint ordered blocks are strictly ordered, so updating centres preserves this order. The empty-cluster repair in part (b) preserves contiguous blocks too: an observation farthest from its assigned centre lies at an endpoint of its block, and removing that endpoint makes a new singleton block. In one dimension with distinct observations, choosing distinct observations as initial centres makes the first assignment nonempty.
The one-dimensional K-means iteration bound now follows by counting block partitions. Choosing the gaps between consecutive nonempty blocks gives
possibilities. By the strict-decrease argument in part (b), no such partition can recur before algorithm termination. Counting a step as an assignment, any empty-cluster repairs, and a centre update, with the stability check performed after that update, gives
For , one update to the overall arithmetic mean suffices. Arbitrary changes between tied centres would invalidate the strict-decrease argument, which is why the stable tie convention in part (b) matters.

Articles by others on the same topic (0)

There are currently no matching articles.