How do I prove that the sum of squared differences from the mean is never bigger than the sum of squared differences from the median?

254 Views Asked by At

I'm thinking there are $n$ numbers, call them $a_1$ through $a_n$ ... with mean $x$ and median $y$. I think it is true that $$\displaystyle\sum\limits_{k=1}^{n} (x-a_k)^2 \leq \displaystyle\sum\limits_{k=1}^{n} (y-a_k)^2$$

In words, this means the sum of squared differences from the mean is never bigger than the sum of squared differences from the median.

I have tested many sets of numbers and this is true for everything I tested. However, I do not know how to prove it.

2

There are 2 best solutions below

0
On BEST ANSWER

Hint: Consider $ f(x) = \sum (x - a_k)^2 = nx^2 - (2 \sum a_k)x + \sum a_k^2 $.

When is the minimum of $f(x)$ achieved?

Minimum is achieved at $ \frac{ 2 \sum a_k} { 2n }, $ which is the mean.
Hence the sum of squared differences from the mean is never bigger than the sum of squared differences from any other value, and in particular, the median.

0
On

We can show a stronger result -- that the variance of a data set is $\le$ the second moment about any other point, i.e.$\forall y$

$$\frac1n\sum(\bar x-a_k)^2\le\frac1n\sum(y-a_k)^2$$

Recall that the variance of random variable $X$ is given by $V[X]=E[(X-E[X])^2]$. Let $y$ be a point such that the second moment of $X$ about $y$,$E[(X-y)^2]<E[(X-E[X])^2]$. This gives$$E[X^2]+y^2-2yE[X]<E[X^2]-E[X]^2$$and hence $(E[X]-y)^2<0$, which is absurd.