Understanding a relationship between sample and population mean for sample of iids I have been reading "Applied Statistical Inference" by Held and Bove. In example 2.21 they came upon this expression while trying to show a statistic is sufficient:
$$\sum_{i = 1}^n(x_i - \mu)^2 = \sum_{i = 1}^n(x_i - \bar{x})^2 + n(\bar{x} - \mu)^2$$
I am having a hard time understanding where this expression comes from. I would be very grateful if someone could shed light into the matter.
 A: [All you have to do is take $(X_i - \mu)^2$ and add and subtract $\overline{x}$ inside because
$(X_i - \overline{x} + \overline{x} -\mu)^2$ 
is the same as doing this algebra 
$(X_i - \overline{x})^2 + (\overline{x} - \mu)^2 + 2 (X_i - \overline{x}) (\overline{x} - \mu)$. After summation you get $\sum_i (X_i -\overline{x})^2  + n (\overline{x}-\mu)^2$ Note that $(\overline{x} - \mu)^2$ is independent of i. So adding it n times give the n in front of it .  
Now $\sum_i [ 2 (X_i - \overline{x}) (\overline{x} - \mu)^2] = 2 (\overline{x} - \mu)^2 \sum_i[ (X_i - \overline{x}) ]$ since we can take the constant 
terms out of the summation. 
Now notice that $\sum_i [(X_i - \overline{x} )] = 0$ since $\sum_i X_i = n \overline{x}$ cancels out - $\sum_i \overline{x} = - n \overline{x}$
A: \begin{align}
& \sum_{i = 1}^n(x_i - \mu)^2 \\[10pt] = {} & \sum_{i=1}^n \Big( (x_i-\bar x)+(\bar x - \mu) \Big)^2 \\[10pt]
= {} & \sum_{i=1}^n \Big( (x_i-\bar x)^2 + 2(x_i-\bar x)(\bar x - \mu) + (\bar x - \mu)^2 \Big) \\[10pt]
= {} & \left( \underbrace{\sum_{i=1}^n (x_i-\bar x)^2}_A \right) + \left( \underbrace{\sum_{i=1}^n 2(x_i -\bar x)(\bar x - \mu)}_B \right) + \left( \underbrace{\sum_{i=1}^n (\bar x - \mu)^2}_C \right)
\end{align}
In the sum labeled $B$, the factor $2(\bar x - \mu)$ does not change as $i$ goes from $1$ to $n$; therefore it can be pulled out, yielding
$$
2(\bar x - \mu) \sum_{i=1}^n (x_i-\bar x).
$$
This sum is $0$, so the term labeled $B$ vanishes.
In the sum labeled $C$, the term $(\bar x - \mu)^2$ does not change as $i$ goes from $1$ to $n$, so it can be pulled out, yielding
$$
(\bar x - \mu)^2 \sum_{i=1}^n 1.
$$
This is $n(\bar x - \mu)^2.$
