in the interval [-1,0] the function is equal to
-x + x^2-5x+8 = x^2-6x+8
On this interval, this function has a minimum at x=0 (with y=8) and a max at x= -1 (with y=15)
On the interval [0,4] the function is equal to
x + x^2-5x+8 = x^2-4x+8
On this interval, this function has a minimum at x= -b/2a = 4/2 = 2 (with y=4) and a max at x=4 (with y=8)
over the entire interval from -1 to 4, the smallest value occurs when x=2 giving y=4, and the largest value occurs at x= -1 with y=15
|x| splits at 0:
for x ≥ 0: |x| = x
for x < 0: |x| = -x
So:
for x ≥ 0: |x| + x2 - 5x + 8 becomes x + x2 - 5x + 8 ---> x2 - 4x + 8
for x 0: |x| + x2 - 5x + 8 becomes -x + x2 - 5x + 8 ---> x2 - 6x + 8
Both of these are (partial) parabolas.
The vertex of y = x2 - 4x + 8 occurs at (2,4) so the minimum value is 4.
The maximum value of x2 - 4x + 8 on [0,4] occurs at x = 4 ---> y = 8.
The maximum value of x2 - 6x + 8 on [-1,0] occurs at x = -1 ---> y = 15.
Thus, the maximum value is 15.