Proof of sample mean and median

473 Views Asked by At

Show that

$$\overline{X}=arg_{a\in\mathbb{R}}min \sum_{i=1}^n (x_i-a)^2$$ $$m=arg_{a\in\mathbb{R}}min \sum_{i=1}^n |x_i-a|$$ where $m$ is the median

Is there any way to prove it? I tried to develop something through the definitions of the sample mean and median but did not get anywhere.

1

There are 1 best solutions below

0
On BEST ANSWER

Deriving on $a$ and canceling,

$$\frac{d\overline X}{da}=\sum_{i=1}^n2(x_i-a)=0,$$ yields $$na=\sum_{i=1}^n x_i.$$

$$\frac{d m}{da}=\sum_{i=1}^n\text{sign}(x_i-a)=0,$$ yields $$x_{\lfloor (n+1)/2\rfloor}\le a\le x_{\lceil (n+1)/2\rceil},$$

assuming the $x_i$ are sorted increasingly.

Note that for even $n$, the solution is not unique.