Show that $(x-a)^T(x-a)=\text{tr}(x_c, x_c)+n(a-\bar x)^2$ (Gentle Matrix Algebra exercise 3.2)
This shows that the norm $\|x-a\|$ is minimized when $a=\bar x$.
I went through the pages and got the relevant equations:
$x^Tx=\text{tr}(xx^T)$
$x_c=x-\bar x$
$\bar x=1^Tx/n$
The solution says "This exercise occurs in many guises in many different places, and the simple approach is to add and subtract $\bar x$:
$$\begin{split}(x-a)^T(x-a)&=(x-\bar x-(a-\bar x))^T(x-\bar x-(a-\bar x))\\ &=(x_c-(a-\bar x))^T(x_c-(a-\bar x))\\ &=x_c^Tx_c+(a-\bar x)^T(a-\bar x)-2(a-\bar x)^Tx_c\\ &=\text{tr}(x_cx_c^T)+n(a-\bar x)^2\color{red}{-2(a-\bar x)^Tx_c}\end{split}$$
Finally, we get the expression by writing $x_c^Tx_c$ as $\text{tr}(x_cx_c^T)$. (I did this in the last step.) Question: where does the red part go? It doesn't look like it equals $0$ to me, but it is omitted in the last step (i.e. the red part disappears in the solution).
$a-\bar{x}$ is a constant. Any constant multiplying $x_c$ will not change the fact that $x_c$ is centred, so the scaled sum will still be $0$.