Let $a_1,a_2,...,a_n\in\mathbb{R}$. I wonder how to find the number $x$ with $$|x-a_1|+...+|x-a_n|=\mbox{min}\{|a-a_1|+...+|a-a_n|\mid a\in\mathbb{R}\},$$ namely the sum of the differences with $a_1,...,a_n$ is minimised as possible. What if $a_1,...,a_n\in\mathbb{N}$ and $x$ must also be a natural number?
2026-04-24 15:49:53.1777045793
On
The number with minimum sum of differences
129 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
1
On
Let us assume that the $a_k$ are all different, and, without loss of generality, ranked in this way: $a_1<a_2<\cdots <a_n$. Then:
case 1) if $n=2k+1$ (odd number), there is a unique value which is $x=a_{k+1}$.
case 2) if $n=2k$ (even number), all values $x \in [a_k,a_{k+1}]$ are solutions.
If all the $a_k$s are integers, one restricts cases 1) and 2) to integer solutions.
Note that in case of $n = 2$ points, any point between the two given points work. In case of $n = 3$, we must pick the middle point. This gives us an idea on how to proceed for greater $n$.
Firstly, we must pick the point between the two end points, and secondly wherever we pick the point between the two end points, the sum of it's distance from the end points remains same. So just drop the two end points, and you have reduced $n$ by two. Proceeding in this manner we see that we must pick the middle point in case of $n$ odd and any point between the two middle points for $n$ even.
The solution does not change when the points are natural numbers. Just pick the middle (or one the middle) points.