A unique solution Find the sum of all values of k so that the system
$$y=|x+23|+|x−5|+|x−48|$$$$y=2x+k$$
has exactly one solution in real numbers. If the system has one solution, then one of the three $x's$, should be 0. Then, there are 3 solutions, when each of the modulus becomes 0. Where am I going wrong?
 A: Perhaps it would help to write the first equation as
$$
y=
\begin{cases}
-3x+30&\text{ for }x\leq-23\\
-x+76&\text{ for }x\in[-23,5]\\
x+66&\text{ for }x\in[5,48]\\
3x-30&\text{ for }x\geq48\\
\end{cases}
$$
Then find $x$-values of intersections with each of those four lines:
$$
\begin{align}
2x+k&=-3x+30&&\iff x=\frac{30-k}5\\
2x+k&=-x+76&&\iff x=\frac{76-k}{3}\\
2x+k&=x+66&&\iff x=66-k\\
2x+k&=3x-30&&\iff x=30+k
\end{align}
$$
and then write $k$-ranges for the valid intersections:
$$
\begin{align}
\frac{30-k}{5}&\leq-23&&\iff k\geq 30+5\cdot 23 =145\\
\frac{76-k}{3}&\in[-23,5]&&\iff k\in[76-3\cdot 5,76+3\cdot 23]=[61,145]\\
66-k&\in[5,48]&&\iff k\in[18,61]\\
30+k&\geq 48&&\iff k\geq 18
\end{align}
$$
So whenever $k$ is in one of the following four intervals, $y=2x+k$ has a legal intersection with the corresponding segment of $y=|x+23|+|x-5|+|x-48|$:
$$
\begin{align}
-3x+30:&k\in[145,\infty)\\
-x+76:&k\in[61,145]\\
x+66:&k\in[18,61]\\
3x-30:&k\in[18,\infty)
\end{align}
$$
and we see that only for $k=18$ we have $y=2x+k$ intersecting $y=x+66$ and $y=3x-30$ at the same point, $x=66-18=30+18=48$.

Here is a diagram of the situtation:

A: Working with String's initial boundaries, we have
$$
0=
\begin{cases}
-5x+30-k&\text{ for }x\leq-23\\
-3x+76-k&\text{ for }x\in[-23,5]\\
-x+66-k&\text{ for }x\in[5,48]\\
x-30-k&\text{ for }x\geq48\\
\end{cases}
$$
Now notice that the function is decreasing for $x<48$ and increasing for $x>48$. This means that the function $f(x)=y-2x-k$ has a global minimum at $x=48$. Since the function is continuous (it is a sum of absolute value functions and a linear function which are each continuous), when $k=18$, $x=48$ is the unique solution of $f(x)=0$; when $k>18$, the function has two roots; when $k<18$, the function has none. Hence the only time when there is a unique solution is when $k=18$. To picture why this is, think of the curve $y=x^2-k$ and its roots.
A: $$y-2x$$ is a piecewise linear function and is convex. The slope is nowhere zero (slope values are $-5,-3,-1,1$) so that it achieves an isolated minimum, which is the requested value of $k$, at the lowest vertex.
$$\begin{align}-23&\to145\\5&\to61\\48&\to\color{green}{18}\end{align}$$
