# Clustering Proof of Equation

Greetings! Could anyone enlighten me about the validity of this equation? I'm trying to prove it without success. $$K$$ is the number of clusters, $$C_i$$ is the $$i$$-th cluster, $$m_i$$ is the number of objects of $$i$$-th cluster and m is the total number of objects. Thanks in advance!

• It's the sum of all objects (x) that belong to i-th cluster! Commented Dec 25, 2019 at 10:22
• @IoannisTsirovasilis $m_i$ should be means, not counts; otherwise the equality doesn't hold. Let $x_1=1,x_2=-1$, and let they belong to different clusters, i.e. $m_1=1,m_2=1$. Apparently, the equation doesn't hold. Commented Dec 25, 2019 at 10:43
• Thank you! You are absolutely right! Commented Dec 25, 2019 at 11:51
• Please choose a more descriptive title, e.g., by including the meaning of the equation, so that others can more easily find this. Commented Dec 26, 2019 at 8:43
• @Anony-Mousse-ReinstateMonica Thanks for the tip I will keep that in mind! Happy new year's eve! Commented Dec 28, 2019 at 13:27

Via a couple of algebraical tricks, you'll have your zero only if $$\mu_i$$ and $$\mu$$ are the means, not the counts: \begin{align}S&=\sum_{i=1}^K\sum_{x\in C_i}(x-\mu_i)\cdot(\mu-\mu_i)\\&=\sum_{i=1}^K\overbrace{\left(\sum_{x\in C_i} (x-\mu_i)\right)}^0\cdot (\mu-\mu_i)\\&=0\end{align}
If it were the counts, letting $$x_1=1\in C_1,x_2=-1\in C_2$$ will cause invalidity of the equation shown. The equation is also shift-variant if $$m$$ are counts.