Does the arithmetic mean minimize the sum of absolute values of deviations? We have $x_1,x_2,\ldots,x_n \in \mathbb{R}$. I conjecture there to be a number $M \in  \mathbb{R}$ such that  for any $i=1,2,\ldots,n$ the quantity
$$|x_i - M|$$
is as small as possible. How do you go about proving that $M$ is the arithmetic mean
$$M=\frac{\sum_{i=1}^{n} x_i }{n}\text{ ?}$$
 A: The value of $M$ that makes $\displaystyle\sum_{i=1}^n |x_i-M|$ as small as possible for given $x_1,\ldots,x_n$ is the median, not the mean, of $x_1,\ldots,x_n$.
The value of $M$ that makes $\displaystyle\sum_{i=1}^n (x_i-M)^2$ as small as possible for given $x_1,\ldots,x_n$ is the mean, not the median, of $x_1,\ldots,x_n$.
The first proposition can be proved as follows: If $M$ is bigger than more $x$ values than it's smaller than, then making $M$ smaller increases its distance from a few $x$ values and decreases its distance from many $x$ values, all by the same amount, so the sum of the distances gets smaller.  Then do the same with $M$ smaller than the median.
The second proposition can be shown as follows:
\begin{align}
& \sum_{i=1}^n (x_i-M)^2 = \sum_{i=1}^n ((x_i -\text{mean})+(\text{mean}-M))^2 \\[10pt]
= {} & \sum_{i=1}^n (x_i-\text{mean})^2 + \underbrace{2\sum_{i=1}^n (x_i-\text{mean})(\text{mean}-M)}_{\text{This sum is $0$.}} + \sum_{i=1}^n (\text{mean}-M)^2 \\[10pt]
= {} & \left(\sum_{i=1}^n (x_i-\text{mean})^2\right) + n(\text{mean}-M)^2.
\end{align}
To find the value of $M$ that makes this as small as possible, notice that $M$ appears only in the last term, so pick $M$ so as to make that as small as possible.
A: One other way to make sense of the Question is that we'd like to make the largest of the deviations $|x_i - M|$ as small as possible, i.e. find the real number $M$ that minimizes:
$$ \max_{i=1,\ldots,n} |x_i - M| $$
For this it suffices to choose $M$ to be the average of the largest and smallest values $x_i$.  Then the $\max |x_i - M|$ is half the (absolute) difference between those largest and smallest values.
