Consider the set of integers $\{1,2,3,4,\cdots,100\}$. Let $\{x_1,x_2,x_3,x_4, \cdots, x_{100}\}$ be some arbitrary arrangement of the previous set, Where each $x_i$ is different. Find the minimum value of the sum: $$S = |x_2-x_1| + |x_3 - x_2| + |x_4-x_3| + \cdots + |x_{100}-x_{99}| + |x_{100} - x_1| $$
I think the sum will be minimum if the set is sorted. As we don't have any negative number in the sum. But I am worried about $|x_{100} - x_{99}|$. If I assume that the set is sorted then the sum will be $99 + 99 = 198$. I think this is wrong. Or I cant show any proof to this solution. If this is the right answer then how do I prove this?
Source: BdMO 2016 Secondary National