= Centroid sum-of-squares identity
{title2=$\sum_i\|x_i-z\|^2=\sum_i\|x_i-\bar x\|^2+n\|z-\bar x\|^2$}
For a nonempty finite collection of <Euclidean vectors>, its <sample mean> $\bar x=n^{-1}\sum_i x_i$ uniquely minimizes the sum of squared <Euclidean distances> to a proposed <centroid> $z$. Expand each squared <Euclidean norm> around $\bar x$ and use $\sum_i(x_i-\bar x)=0$ to cancel the cross term. The displayed identity leaves a nonnegative term $n\|z-\bar x\|^2$, equal to zero exactly at $z=\bar x$.
Back to article page