Minimizing maximum deviation

Give n floating point numbers a1 , a2 … an . Find X such that it minimizes maximum absolute difference (d)
d = [ for ( 1 <= i <= n) max ( abs ( ai - X ) ) ]
how to find X such that d is minimum ?
I have tried using some Order Statistics
X is any real number
Source : Unknown : (
is it ((max(ai)+min(ai) )/2) ?

Here’s my idea:

So, if you view the numbers on the number line, you should realise that the problem asks you to find X so that the maximum distance from any number is minimised. Now, for any choice of X, you can show that you actually only need to care about distances from two points: the largest and the smallest. So yeah, X=(max(ai)+min(ai))/2 (the post was edited while I was writing this).

1 Like

yeah I’m thinking about proof

got it !
max ( l - c , c ) is min when c = ( l / 2 ) -----> mid point of line i.e , ((max(ai)+min(ai) )/2)

1 Like