Range of $f(x) = | x-1| + |x - a| + | x| + |x+1| + |x+ 2a - 21|$ The Range of function $f(x) = | x-1| + |x - a| + | x| + |x+1| + |x+ 2a - 21|$ is 
where $a\in\mathbb{R}$ and $x\in\mathbb{R}$ 
 A: First, one should observe that the function $f$ is $+\infty$ at $\pm \infty$.
It follows that $f$ attains a minimum and
$$
f(\mathbb{R})=[\min f,+\infty).
$$
Note next that $f$ is differentiable everywhere but at $1, a, 0, -1, 21-2a$.
Assume that $f$ attains its minimum somewhere out of these critical points. Then the derivative there must be zero. But the derivative would be of the form
$$
\pm 1+\pm 1+\pm 1+\pm 1+\pm 1.
$$
Since there are $5$ terms, this can never make $0$.
So the minimum is one of the values
$$
f(1),f(a),f(0),f(-1),f(21-2a).
$$
Now I can't see anything more clever than computing these values and distinguish cases.
Edit: See Ross Millikian's comment below. There is indeed a more clever way to approach the last step. Basically, the minimum is attained at $x_0$, where $x_0$ is in the mid value among the five values $-1,0,1$ and $a,21-2a$. Note that you have to be more careful when these collapse to $4$ values (when $a=-1,0,1,7, ...$).
Remark: It is not hard to see, more generally, that a linear combination with positive coefficcients of functions of the type $|ax+b|$ attains its minimum at one of the values that annihilate the $|ax+b|$'s. You just have to observe that such a function is piecewise affine with possible change of slope at these specific values.
