Question: **Problem:**

Consider the following model:

$y\_i = \mu + \epsilon\_i$, $i = 1,...,n$

Let the mean $\mu$ be estimated by minimizing the criterion $\sum|\mu - y\_i|$ over $\mu$.

Show that $m = $median($y\_1,y\_2,...,y\_n$) is optimal for this criterion.

Distinguish the case $n$ is odd and $n$ is even.

---

**My idea to approach the problem:**

$1)$ Rewrite the criterion such that no absolute signs are needed (with indicator function for example).

$2)$ Determine the first order condition to recognize the median.

$3)$ Order data to distinguish $n$ odd or $n$ even

---

However, I dont't know how to to the steps of my apporach in a mathematical/statistical way.

Could anyone please help me?

Answer: 
The function $g$ is monotone on the interval $J:=\bigl[{1\over2},1\bigr]$, and from $g\bigl({1\over2}\bigr)={4\over5}$, $\>g(1)={1\over2}$ it follows that $g(J)\subset J$.

When $x\in J$ then
$$|g'(x)|={2x\over (1+x^2)^2}\leq{2x\over 1+2x^2}={1\over\sqrt{2}}\>{2\over{1\over \sqrt{2}\, x}+\sqrt{2}\,x}\leq{1\over\sqrt{2}}\ .$$
It follows that $g$ is contracting on $J$. Therefore by the general fixed point theorem $g$ has a unique fixed point $\xi\in J$, and any sequence $(x\_n)\_{n\geq0}$ of the considered kind will converge to $\xi$.

Solving the equation $g(x)=x$ numerically gives $\xi\doteq0.682328$.
See related approachs and techniques [(I)](https://math.stackexchange.com/questions/267648/prove-that-a-function-having-a-derivative-bounded-by-0-49-has-a-unique-solution/267677#267677), [(II)](https://math.stackexchange.com/questions/287865/how-to-determine-interval-a-b-for-a-fixed-point-iteration).