[proofplan]
Decompose each centered observation $X_{ij}-\bar{X}$ into its within-group part $X_{ij}-\bar{X}_i$ and its group-mean part $\bar{X}_i-\bar{X}$. Expanding the resulting outer product gives within terms, between terms, and two mixed terms. The within terms sum to $W$, the between terms sum to $B$, and the mixed terms vanish because the deviations from each group mean sum to zero within every group.
[/proofplan]
[step:Decompose each centered observation into within-group and between-group parts]
For each $i \in \{1,\dots,g\}$ and $j \in \{1,\dots,n_i\}$, define vectors $a_{ij}, b_i \in \mathbb{R}^p$ by
\begin{align*}
a_{ij} := X_{ij}-\bar{X}_i,
\qquad
b_i := \bar{X}_i-\bar{X}.
\end{align*}
Then
\begin{align*}
X_{ij}-\bar{X}
= (X_{ij}-\bar{X}_i)+(\bar{X}_i-\bar{X})
= a_{ij}+b_i.
\end{align*}
Therefore the total SSP matrix satisfies
\begin{align*}
T
&= \sum_{i=1}^g\sum_{j=1}^{n_i} (a_{ij}+b_i)(a_{ij}+b_i)^\top.
\end{align*}
[guided]
The purpose of the decomposition is to separate two sources of variation. The vector $a_{ij}:=X_{ij}-\bar{X}_i$ measures how far observation $X_{ij}$ is from its own group mean, while $b_i:=\bar{X}_i-\bar{X}$ measures how far the group mean is from the grand mean. Both vectors lie in $\mathbb{R}^p$, so their outer products are $p \times p$ matrices.
For every $i \in \{1,\dots,g\}$ and $j \in \{1,\dots,n_i\}$,
\begin{align*}
X_{ij}-\bar{X}
&= X_{ij}-\bar{X}_i+\bar{X}_i-\bar{X}\\
&= a_{ij}+b_i.
\end{align*}
Substituting this identity into the definition of $T$ gives
\begin{align*}
T
&= \sum_{i=1}^g\sum_{j=1}^{n_i} (X_{ij}-\bar{X})(X_{ij}-\bar{X})^\top\\
&= \sum_{i=1}^g\sum_{j=1}^{n_i} (a_{ij}+b_i)(a_{ij}+b_i)^\top.
\end{align*}
This converts the theorem into a purely algebraic identity about expanding outer products and summing the resulting terms.
[/guided]
[/step]
[step:Expand the outer products and identify the within-group contribution]
For vectors $u,v \in \mathbb{R}^p$, bilinearity of matrix multiplication gives
\begin{align*}
(u+v)(u+v)^\top = uu^\top + uv^\top + vu^\top + vv^\top.
\end{align*}
Applying this identity with $u=a_{ij}$ and $v=b_i$ yields
\begin{align*}
T
&= \sum_{i=1}^g\sum_{j=1}^{n_i} a_{ij}a_{ij}^\top
+ \sum_{i=1}^g\sum_{j=1}^{n_i} a_{ij}b_i^\top
+ \sum_{i=1}^g\sum_{j=1}^{n_i} b_i a_{ij}^\top
+ \sum_{i=1}^g\sum_{j=1}^{n_i} b_i b_i^\top.
\end{align*}
By the definition of $a_{ij}$,
\begin{align*}
\sum_{i=1}^g\sum_{j=1}^{n_i} a_{ij}a_{ij}^\top
&= \sum_{i=1}^g\sum_{j=1}^{n_i} (X_{ij}-\bar{X}_i)(X_{ij}-\bar{X}_i)^\top\\
&= W.
\end{align*}
[/step]
[step:Show that the mixed terms vanish within each group]
For each fixed $i \in \{1,\dots,g\}$, the definition of $\bar{X}_i$ gives
\begin{align*}
\sum_{j=1}^{n_i} a_{ij}
&= \sum_{j=1}^{n_i}(X_{ij}-\bar{X}_i)\\
&= \sum_{j=1}^{n_i}X_{ij}-n_i\bar{X}_i\\
&= \sum_{j=1}^{n_i}X_{ij}-n_i\left(\frac{1}{n_i}\sum_{j=1}^{n_i}X_{ij}\right)\\
&= 0.
\end{align*}
Since $b_i$ does not depend on $j$, we have
\begin{align*}
\sum_{j=1}^{n_i} a_{ij}b_i^\top
&= \left(\sum_{j=1}^{n_i} a_{ij}\right)b_i^\top
= 0b_i^\top
= 0,\\
\sum_{j=1}^{n_i} b_i a_{ij}^\top
&= b_i\left(\sum_{j=1}^{n_i} a_{ij}\right)^\top
= b_i0^\top
= 0.
\end{align*}
Summing these identities over $i$ gives
\begin{align*}
\sum_{i=1}^g\sum_{j=1}^{n_i} a_{ij}b_i^\top
=
\sum_{i=1}^g\sum_{j=1}^{n_i} b_i a_{ij}^\top
= 0.
\end{align*}
[guided]
The mixed terms vanish because deviations from a sample mean always sum to zero inside the group. Fix a group index $i \in \{1,\dots,g\}$. By definition,
\begin{align*}
\bar{X}_i = \frac{1}{n_i}\sum_{j=1}^{n_i}X_{ij}.
\end{align*}
Therefore
\begin{align*}
\sum_{j=1}^{n_i} a_{ij}
&= \sum_{j=1}^{n_i}(X_{ij}-\bar{X}_i)\\
&= \sum_{j=1}^{n_i}X_{ij}-\sum_{j=1}^{n_i}\bar{X}_i\\
&= \sum_{j=1}^{n_i}X_{ij}-n_i\bar{X}_i\\
&= \sum_{j=1}^{n_i}X_{ij}-n_i\left(\frac{1}{n_i}\sum_{j=1}^{n_i}X_{ij}\right)\\
&= 0.
\end{align*}
The vector $b_i=\bar{X}_i-\bar{X}$ depends only on the group index $i$, not on the observation index $j$. Hence it may be factored out of the sum over $j$:
\begin{align*}
\sum_{j=1}^{n_i} a_{ij}b_i^\top
&= \left(\sum_{j=1}^{n_i}a_{ij}\right)b_i^\top
= 0b_i^\top
= 0,\\
\sum_{j=1}^{n_i} b_i a_{ij}^\top
&= b_i\left(\sum_{j=1}^{n_i}a_{ij}\right)^\top
= b_i0^\top
= 0.
\end{align*}
Since this holds for every group $i$, summing over all groups gives
\begin{align*}
\sum_{i=1}^g\sum_{j=1}^{n_i} a_{ij}b_i^\top
=
\sum_{i=1}^g\sum_{j=1}^{n_i} b_i a_{ij}^\top
= 0.
\end{align*}
[/guided]
[/step]
[step:Identify the between-group contribution and conclude the decomposition]
Because $b_i$ is independent of $j$ for fixed $i$,
\begin{align*}
\sum_{i=1}^g\sum_{j=1}^{n_i} b_i b_i^\top
&= \sum_{i=1}^g n_i b_i b_i^\top\\
&= \sum_{i=1}^g n_i(\bar{X}_i-\bar{X})(\bar{X}_i-\bar{X})^\top\\
&= B.
\end{align*}
Combining the expansion of $T$, the identification of the within-group term with $W$, the vanishing of the mixed terms, and the identification of the between-group term with $B$, we obtain
\begin{align*}
T = W + B.
\end{align*}
Since matrix addition is commutative, this is equivalently
\begin{align*}
T = B + W.
\end{align*}
This proves the one-way MANOVA SSP decomposition.
[/step]