Có: \(\begin{cases}\left|x-1\right|\ge x-1\\\left|x-2\right|\ge x-2\\\left|x-3\right|\ge3-x\\\left|x-4\right|\ge4-x\end{cases}\)\(\forall x\)
\(\Rightarrow B=\left|x-1\right|+\left|x-2\right|+\left|x-3\right|+\left|x-4\right|\ge\left(x-1\right)+\left(x-2\right)+\left(3-x\right)+\left(4-x\right)\)
\(\Rightarrow B\ge4\)
Dấu "=" xảy ra khi \(\begin{cases}x-1\ge0\\x-2\ge0\\x-3\le0\\x-4\le0\end{cases}\)\(\Rightarrow\begin{cases}x\ge1\\x\ge2\\x\le3\\x\le4\end{cases}\)\(\Rightarrow2\le x\le3\)
Vậy với \(2\le x\le3\) thì B đạt GTNN là 4