A modified median Assume we have real numbers $x_1 < x_2 < \dots < x_n$.
Consider the following function which returns the average distance of a point $t$ from $x_1,\dots,x_n.$
$$
D_1(t) = \frac{1}{n}\sum_{i=1}^n|x_i - t|.
$$
It is well known that $D_1(t)$ is minimized at a median of $x_1,\dots,x_n$.
I am interested in the centrality parameter that is obtained when the mean is replaced by the median above (you may assume $n$ is odd and $n \geq 3$ if it helps).
So, my question is this : Is there a simple expression for $$ \arg\min D_2(t) $$ where
$$
D_2(t) = \operatorname{median}\{|x_1-t|,\dots,|x_n-t|\}?
$$
I have done some numerical experiments. I think that there is always a minimum at a point of the form $\frac{x_i + x_j}{2}$ where $i \leq j$ and $\frac{x_i+x_j}{2}\leq x_{i+1}.$
This problem is combinatorial because one has to keep track of how the order of $|x_i - t|$'s change as $t$ changes.
Update: User Joe has conjectured that if $n=2k+1$ is odd then the minimum occurs that $t = \frac{x_m + x_{m+k}}{2}$ where $m = \arg\min (x_{m+k} - x_m)$.
The plot of the objective function for $1, 2, 3, 10, 11, 12, 20$ shows that a median may not be the minimizer. The conjecture is valid here (k=3), a minimum occurs at $\frac{x_1+x_4}{2}$ and $x_4-x_1=9$.

Another example where the conjecture is valid. Here $k=4$ and the minimum occurs at $\frac{x_1+x_5}{2}=3.$

 A: Given real numbers $x_1 < x_2 < \dots < x_n$.
I will consider the case of $n = 2k+1$.
$$
D_2(t) = \operatorname{median}\{|x_1-t|,\dots,|x_n-t|\}
$$
$D_2(t)$ is continuous, and attains its minimum on $[x_1,x_n]$.
Let$$d^* = \min_{t\in \mathbb{R}} D_2(t)$$
Let $t$ be such that $D_2(t) = d^*$. Then we know that there are at least $k+1$ points $x_i$ such that $|x_i-t|\le d^*$.
Therefore, there are at least $k+1$ points $x_i$ in $[t-d^*, t+d^*]$.
Let $A$ be the subset of points in $[t-d^*, t+d^*]$
If  $A \subset (t-d^*, t+d^*]$ , then we could let:$$t_2 = \frac{\min A + (t+d^*)}{2}$$
Which would give $k+1$ points less than a distance $d^*$ from $t_2$, contradicting that $d^*$ was the min.
Similarly for $A \subset [t-d^*, t+d^*)$.
Hence, $\min A = t-d^*$ and $\max A = t+d^*$.
Since $i<j \implies x_i<x_j$, this implies that there are exactly $k+1$ points in $[t-d^*, t+d^*]$, for otherwise we could take a subset of $A$ consisting of only $k+1$ points, by removing the maximum or minimum of $A$, to attain a value for $D_2(t)$ less than $d^*$, by the same argument as above.
Hence, $\min A = x_m = t-d^*$ and $\max A = x_{m+k} = t+d^*$, and $$t=\frac{x_m + x_{m+k}}{2}$$
Therefore, to find a $t$, you should first find $d^*$, which is the minimum of $\displaystyle\frac{x_{m+k} - x_m}{2}$ for $1 \le m \le n-k$, and use any points $x_m$ and $x_{m+k}$ that are $2d^*$ apart.
A: Proof for even $n = 2k$ with $k > 1$.
The median for any $-\infty < a_1 \leq \dots \leq a_{2k} < \infty$ is defined to be mean of the $k^{th}$ and $(k+1)^{th}$ largest elements : $M = \dfrac{a_{k}+a_{k+1}}{2}$.
Assume $n = 2k$ with $k > 1$ and $x_1 < x_2 < \dots < x_{n}$.
Result $$\inf D_2(t) = \min_{1 \leq i \leq k} \frac{x_{i+k}-x_{i}}{2}.$$ $\arg\min D_2(t) = \dfrac{x_{i^*} + x_{i^*+k}}{2}$ where $ i^* = \arg\min_{i} (x_{i+k}-x_i)$.
We will need the following lemma.
Lemma
For all $1 \leq i \leq k$
$$
D_2(\frac{x_i+x_{i+k}}{2}) = \frac{x_{i+k}-x_i}{2}
$$
Proof of lemma
$t_0 = \dfrac{x_i+x_{i+k}}{2}$ is the midpoint of the interval $[x_i,x_{i+k}]$. Let $d_1 \leq d_2 \dots \leq d_n$ be the elements of $|x_1-t_0|,\dots,|x_n - t_0|$ written in increasing order. Since the $k+1$ closest $x$'s to $t_0$ are $x_i,x_{i+1},\dots,x_{i+k}$ in some order and since $x_i$ and $x_{i+k}$ are the points at largest distances from $t_0$ in $[x_i,x_{i+k}]$ we have $d_k = d_{k+1} = \dfrac{x_{i+k}-x_i}{2}.$
So, $D_2(\dfrac{x_i+x_{i+k}}{2}) = \dfrac{1}{2}(d_k+d_{k+1}) = \dfrac{x_{i+k}-x_i}{2}.$
Proof of main result
Let $d_0 = \inf D_2(t)$.
We will show that there is an $i$ such that $D_2(\frac{1}{2}(x_i + x_{i+k})) = \frac{1}{2}(x_{i+k} - x_i) = d_0.$
Let $t_0$ be such that $d_0 = D_2(t_0).$
From the properties of the median, at least $k$ of $|x_i - t_0|,\dots,|x_n-t_0|$  must be less than or equal to $d_0$, or equivalently, $I=[t_0-d_0,t_0+d_0]$ must contain at least $k$ of $x_1,\dots,x_n$.
First consider the case when $I$ contains at least $k+1$ of the $x$'s, say, $t_0 - d_0 \leq x_i < \dots < x_{i+k} \leq t_0 + d_0.$
The minimality of $d_0$ means
$$
\begin{align}
D_2(\frac{x_i + x_{i+k}}{2}) - d_0 &\geq 0
\end{align}
$$
That is,
$$
\begin{align}
\frac{x_{i+k} - (t_0+d_0)}{2}+\frac{(t_0-d_0)-x_i}{2} &\geq 0
\end{align} 
$$
Since $t_0-d_0 \leq x_i < x_{i+k} \leq t_0 + d_0$, that is, $x_{i+k} - (t_0+d_0) \leq 0$ and $(t_0-d_0)-x_i \leq 0$ this implies $x_i = t_0 - d_0$ and $x_{i+k}=t_0+d_0$. So $t_0 = \dfrac{x_i+x_{i+k}}{2}$ and $d_0 = \dfrac{x_{i+k}-x_i}{2} = D_2(\dfrac{x_{i+k}+x_i}{2})$.
Finally consider the case when $I$ contains exactly $k$ $x$'s, say $t_0-d_0 \leq x_i < \dots < x_{i+k-1} \leq t_0+d_0$. Since $x \to |x-t_0|$ is a convex function, the maximum of $|t_0-x_i|,\dots,|t_0-x_{i+k-1}|$ must occur at $x_i$ or $x_{i+k-1}$. By construction $x_i,\dots,x_{i+k-1}$ are the closest $k$ points among $x$'s to $t_0$. The next closest point must be one of $x_{i+k}$ or $x_{i-1}$. Assume the next closest point among $x$'s to $t_0$ is $x_{i+k}$.  The proof when we assume the next closest point is $x_{i-1}$ is almost identical.
Note since $x_{i+k} \not\in I$ we must have $x_{i+k} > t_0 + d_0.$.
We must have $t_0 \geq \frac{1}{2}(x_i + x_{i+k-1})$. For if $t_0 < \frac{1}{2}(x_i + x_{i+k-1}) < x_{i+k-1}$ then $|t_0 - x_i| < |t_0 - x_{i+k-1}|.$ So the point at the $k^{th}$ largest distance from $t_0$ among the $x$'s must be $x_{i+k-1}$. So, $d_0$, which is the mean of the $k^{th}$ and $(k+1)^{th}$ distances among $x$'s from $t_0$ must be
$$
\begin{align}
d_0 &= \frac{1}{2}(|t_0 - x_{i+k-1}| + |t_0-x_{i+k}|)\\
    &= \frac{1}{2}\left( (x_{i+k-1} -t_0) + ( x_{i+k} - t_0) \right)\\ 
    &= \dfrac{x_{i+k-1}+x_{i+k}}{2} - t_0 \\
    &> \dfrac{x_{i+k-1}+x_{i+k}}{2} - \dfrac{x_{i+k-1}+x_i}{2} = \dfrac{x_{i+k}-x_i}{2} = D_2(\frac{x_{i+k}+x_i}{2})
\end{align}
$$
This contradicts the minimality of $d_0$.
So we must have $t_0 \geq \dfrac{x_i+x_{i+k-1}}{2} > x_i$. So the point among $x$'s at the $k^{th}$ largest distance from $t_0$ is $x_i$, and we have
$$
d_0 = \frac{1}{2}(|x_{i+k}-t_0| + |x_i - t_0|) = \frac{1}{2}( (x_{i+k}-t_0) +(t_0 - x_{i} ) = \dfrac{x_{i+k}-x_i}{2} = D_2(\frac{1}{2}(x_{i+k}+x_i)). 
$$
So we have shown $d_0 = D_2( \frac{1}{2} (x_i + x_{i+k} ) )$ for some $i$ and the result follows.
