# $x$ and $y$ are real numbers such that $y = |x - 2| - |2x - 12| + |x - 8|$. What is the least possible value of $y$?

I solved this question by assuming cases for various roots of this equation and I found that lowest value of $$y$$ is $$-2$$ for $$x<2$$ but this is a long process and took some time. I was wondering if there is a quick way to solve this or any smart trick to get the answer while solving these types of questions in the competitive exams. Please help !!!

Thanks in advance !!!

• @MyMolecules : Commented on that answer. Sorry I overlooked that notifications for that. Commented Dec 11, 2021 at 15:55

Note that the function will be linear in each of the subintervals determined by the $$x$$-values $$2$$, $$6$$, $$8$$. Evaluate the function at each of these three $$x$$-values; and at one point to the left of $$2$$ and at one point to the right of $$8$$, and you should be able to resolve the question.

That is a continuous function $$f:\mathbb{R}\rightarrow\mathbb{R}$$ which is differentiable everywhere except the points $$\{2,6,8\}$$.
Also it is obvious that for $$x<2$$ and $$x>8$$, $$f$$ is constant.
It should be easy to show that its minimum value is $$-2$$ and its maximum is $$6$$. You could simply "break" the line of reals into disjoint subintervals in order to "break" the form of $$f$$ into more simple forms without absolute values. Give it a try.