As x ranges over all real values, what is the minimum value of f(x)=|x-123|+|x-456| + |x-789|

Note that |x-a|+|x-b| is constant (b-a) for a<=x<=b

So, since |x-123|+|x-789| is constant for 123<=x<=789, the minimum occurs at x=456, and is 666.

devilishly clever!

Strange r meets stranger

To find the minimum value of the function f(x), we need to consider the different possible cases based on the ranges of x.

Case 1: x < 123
In this case, all three absolute values will be positive.
f(x) = -(x - 123) + -(x - 456) + -(x - 789)
= -3x + 1368
Since -3x is a decreasing function, the minimum value of f(x) is obtained when x is the maximum, which is x = 122.

Case 2: 123 ≤ x < 456
In this case, the first absolute value will be positive, while the other two will be negative.
f(x) = (x - 123) + -(x - 456) + -(x - 789)

To find the minimum value, we need to consider the two possible ranges within this case:
2.1: 123 ≤ x < 456 - In this range, the function becomes:
f(x) = (x - 123) + (x - 456) + -(x - 789)
= -2x + 456

2.2: 456 ≤ x < 789 - In this range, the function becomes:
f(x) = (x - 123) + -(x - 456) + -(x - 789)
= 3x - 1222

Using the same logic as in case 1, we find that the minimum value in case 2.1 is obtained when x is the maximum, which is x = 455. Similarly, in case 2.2, the minimum value is obtained when x is the minimum, which is x = 456.

Case 3: 456 ≤ x < 789
In this case, the first and second absolute values will be positive, while the third will be negative.
f(x) = (x - 123) + (x - 456) + -(x - 789)
= x - 123

Again, using the same logic as before, we find that the minimum value in this range is obtained when x is the maximum, which is x = 788.

Case 4: x ≥ 789
In this case, all three absolute values will be negative.
f(x) = -(x - 123) + -(x - 456) + -(x - 789)
= -3x + 1368

Similar to case 1, the minimum value is obtained when x is the minimum, which is x = 789.

In summary, the minimum value of f(x) = |x - 123| + |x - 456| + |x - 789| is:
- For x < 123, f(x) = -3x + 1368, with minimum value at x = 122.
- For 123 ≤ x < 456, f(x) = -2x + 456, with minimum value at x = 455.
- For 456 ≤ x < 789, f(x) = x - 123, with minimum value at x = 788.
- For x ≥ 789, f(x) = -3x + 1368, with minimum value at x = 789.