What is the minimum value of $|x-1| + |x-2| + |x-3| .... + |x - k + 1| + |x-k|$ equal to?
I suppose it depends on whether or not $k$ is even or odd.
I was able to solve for $k = 3$ (three terms) using the triangle inequality - but couldn't generalize it to the above. Please help.
Let $k$ be odd, then the minimum is attained when $x=\dfrac{k+1}{2}$ (because the function is strictly decreasing and increasing before and after the point respectively).
Now let $k$ be even, then whole the $\dfrac{k}{2}\le x\le\dfrac{k}{2}+1$ is the minimum of the function