prove $\sum_{i=1}^{n}(x_i-\bar{x})^2\lt\sum_{i=1}^{n}(x_i-a)^2$ How do we prove that
$$
\sum_{i=1}^{n}(x_i-\bar{x})^2\lt\sum_{i=1}^{n}(x_i-a)^2
$$
where $a$ is any value other than $\bar{x}$, the arithmetic mean.
My Attempt:
$$
\sum_{i=1}^{n}(x_i^2-2x_i\bar{x}+\bar{x}^2)\lt\sum_{i=1}^{n}(x_i^2-2x_ia+a^2)\\\sum_{i=1}^{n}x_i^2-2\bar{x}\sum_{i=1}^{n}x_i+\sum_{i=1}^{n}\bar{x}^2\lt\sum_{i=1}^{n}x_i^2-2a\sum_{i=1}^{n}x_i+\sum_{i=1}^{n}a^2\\-2\bar{x}.n\bar{x}+n.\bar{x}^2\lt-2a.n\bar{x}+n.a^2\\-2\bar{x}^2+\bar{x}^2\lt-2a\bar{x}+a^2\\-\bar{x}^2\lt-2a\bar{x}+a^2
$$
But how do I proceed further or is there any better way ?
 A: consider $$f(a) \equiv\sum_{i=1}^{n}(x_i-a)^2 $$
so that 
$$f'(a) =-2\sum_{i=1}^{n}(x_i-a) =-2n(\bar x -a) $$
so $f(a)$ is minimized when $a=\bar x$
A: $\begin{array}\\
\sum_{i=1}^{n}(x_i-a)^2-\sum_{i=1}^{n}(x_i-\bar{x})^2
&=\sum_{i=1}^{n}((x_i-a)^2-(x_i-\bar{x})^2)\\
&=\sum_{i=1}^{n}((x_i-a)-(x_i-\bar{x}))((x_i-a)+(x_i-\bar{x}))\\
&=\sum_{i=1}^{n}(\bar{x}-a)(2x_i-(a+\bar{x}))\\
&=\sum_{i=1}^{n}(\bar{x}-a)(2x_i)-\sum_{i=1}^{n}(\bar{x}-a)(a+\bar{x})\\
&=2(\bar{x}-a)\sum_{i=1}^{n}x_i-n(\bar{x}^2-a^2)\\
&=2(\bar{x}-a)n\bar{x}-n(\bar{x}^2-a^2)\\
&=2n\bar{x}^2-2an\bar{x}-n\bar{x}^2+na^2\\
&=n\bar{x}^2-2an\bar{x}+na^2\\
&=n(\bar{x}^2-2a\bar{x}+a^2)\\
&=n(\bar{x}-a)^2\\
&\ge 0\\
\end{array}
$
with equality only if
$a = \bar{x}$.
A: It would be simpler to think this as a quadratic function of $a$:
$$
f(a) = \sum_{i=1}^n (x_i-a)^2 = A a^2 + B a + C,
$$
where
$$
A = n, \quad B = -2 \sum_{i=1}^n x_i, \quad\text{and}\quad C = \sum_{i=1}^n x_i^2.
$$
"Completing the square" shows that for $A > 0$ the parabola $f(a)$ is minimized at $a = -B/(2A)$.  Substituting the values above yields a minimum at $a = \bar{x}$.
A: By factoring the difference of squares and taking the means (proportional to the sums),
$$\overline{(x_i-\overline x)^2-(x_i-a)^2}=\overline{(x_i-\overline x+x_i-a)}\overline{(a-\overline x)}=(\overline x-\overline x+\overline x-a)(a-\overline x)<0.$$
A: Once you have gotten the last intequality, just note that $$-\bar{x}^2<-2a\bar{x}+a^2\iff \bar{x}^2 -2a\bar{x}+a^2\iff(\bar{x}-a)^2>0.$$
A: If $a \neq \bar{x}$,
$$(a-\bar{x})^2 >0$$
$$a^2+\bar{x}^2-2a\bar{x}>0$$
$$-\bar{x}^2<a^2-2a\bar{x}$$
