= Within-group and between-group scatter decomposition
{title2=$T=W+B$}
For groups with sizes $n_r$, means $\bar x_r$, and overall mean $\bar x$, define $W=\sum_{r,i}(x_{ri}-\bar x_r)(x_{ri}-\bar x_r)^T$ and $B=\sum_r n_r(\bar x_r-\bar x)(\bar x_r-\bar x)^T$. Expanding $x_{ri}-\bar x=(x_{ri}-\bar x_r)+(\bar x_r-\bar x)$ gives total scatter $T=W+B$ because each within-group residual sum vanishes. Both matrices are <positive semidefinite>, and $\operatorname{rank}B\leq\min(p,g-1)$. They separate within-group noise from between-group mean separation.
Back to article page