Minimizing Trimmed Distances I'm trying to understand what is the minimum of the following function,

$$
f(\mu) = \frac{1}{n}\sum_{i=1}^n F\left(\frac{\pi(i)}{n}\right) (x_i - \mu )^2
$$

where $F$ is a step function that assign $1$ to any $t \in [0, \gamma]$ and $0$ in $(\gamma, 1]$, $\pi$ is a permutation that sorts the $i$s based on the ascending ordering of the losses $( x_i - \mu )^2$ and  $\mu$ and $x_1,\ldots,x_n$ are real numbers. I was thinking that perhaps the minumum of $f$ is achieved by the trimmed mean, namely: sort the $x_i$s discard the first $(1-\gamma)/2$ and the last $(1-\gamma)/2$ of the $x_i$ and compute the arithmetic mean of the remaing points. However, it isn't as a simple numeric example shows. 

Any ideas or maybe suggestions (perhaps it is a known problem)? Many thanks in advance.
Your loss function is proportional to the $\gamma n$ smallest square differences with respect to $\mu$.

This is minimized by sorting your $x_i$ and choosing the mean of the contiguous substring $x_k, x_{k+1}, \dots, x_{k+\gamma n-1}$with the smallest variance.