Manipulating summations that include the magnitude squared of vectors I'm really bad with sigma summation notation and have been puzzling over how my professor in his notes for class got from one step to the next. 
It's pretty simple:
$$D_{avg} = \sum_{i=1}^n \sum_{x \in C_i} ||\mathbf x-\mathbf m_i||^2$$
$$D_{IC} = \sum_{i=1}^n \frac{1}{|C_i|} \sum_{x \in C_i} \sum_{x' \in C_i}||\mathbf x-\mathbf x'||^2$$
$$m_i = \frac{1}{|C_i|} \sum_{x \in C_i} \mathbf x$$  
therefore 
$$D_{IC} = 2D_{avg}$$
I tried to simply substitute the expression for $m_i$ into $D_{IC}$, but I think I am getting stuck on manipulating $||\mathbf x - \mathbf x'||$ because they're vectors and not scalars.
Here is what I have thus far:
$$D_{IC} = \sum_{i=1}^n \sum_{x' \in C_i}||\mathbf m_i-\mathbf x'||^2$$
Obviously, I know this is wrong.. 
 A: \begin{align}D_{IC} &= \sum_{i=1}^n \frac{1}{|C_i|} \sum_{x \in C_i} \sum_{x' \in C_i}||\mathbf x-\mathbf x'||^2 \\
&= \sum_{i=1}^n \frac{1}{|C_i|} \sum_{x \in C_i} \sum_{x' \in C_i}(||\mathbf x||^2+ ||\mathbf x'||^2-2\mathbf x'^T\mathbf x) \\
&= \sum_{i=1}^n \frac{1}{|C_i|}  \sum_{x \in C_i}(|C_i|||\mathbf x||^2+\sum_{x' \in C_i} ||\mathbf x'||^2-\sum_{x' \in C_i}2\mathbf x'^T\mathbf x) \\
&= \sum_{i=1}^n \frac{1}{|C_i|}  \sum_{x \in C_i}(|C_i|||\mathbf x||^2+\sum_{x' \in C_i} ||\mathbf x'||^2-2|C_i|m_i^T\mathbf x) \\
&= \sum_{i=1}^n \frac{1}{|C_i|}  \left( |C_i|\sum_{x \in C_i}||\mathbf x||^2+|C_i|\sum_{x' \in C_i} ||\mathbf x'||^2-2|C_i|^2||m_i||^2\right) \\
&= \sum_{i=1}^n  \left( \sum_{x \in C_i}||\mathbf x||^2+\sum_{x' \in C_i} ||\mathbf x'||^2-2|C_i|||m_i||^2\right) \\
&= 2\sum_{i=1}^n  \left( \sum_{x \in C_i}||\mathbf x||^2-|C_i|||m_i||^2\right) \\
\end{align}
\begin{align}
D_{avg} &= \sum_{i=1}^n \sum_{x \in C_i} ||\mathbf x-\mathbf m_i||^2 \\
&= \sum_{i=1}^n \sum_{x \in C_i} \left(||\mathbf x||^2 + ||m_i||^2-2\mathbf x^T m_i\right) \\
&= \sum_{i=1}^n \left(\sum_{x \in C_i} ||\mathbf x||^2 + |C_i|||m_i||^2-2|C_i||| m_i||^2\right) \\
&= \sum_{i=1}^n \left(\sum_{x \in C_i} ||\mathbf x||^2 -|C_i||| m_i||^2\right) \\
\end{align}
Hence $$D_{IC} =2D_{avg} $$
