The problem is to find maxima and minima for y= |x- 1|+ |x^2- 2x|= |x-1|+ |x(x- 2)|.
The first thing I would do is recognize that the absolute values are 0 for x= 1, x= 0, and x= 2. So I would divide the real line into four intervals: x< 0, 0< x< 1, 1< x< 2, and x> 2.
If x< 0 then all of x- 1, x, and x- 2 are negative. The product of x and x-2 however is positive so y= -(x- 1)+ x(x- 2)= -x+ 1+ x^2- 2x= x^2- 3x+ 1. y'= 2x- 3 which is 0 when x= 3/2. But that is not less than 0. y has no critical point when x< 0.
If 0< x< 1 then x is positive but x- 1 and x- 2 are negative. The product of x and x- 2 is negative so y= -(x-1)- x(x- 2)= -x+ 1- x^2+ 2x= -x^2+ x+ 1. y'= -2x+ 1 which is 0 when x= 1/2. Yes, that is between 0 and 1 so x= 1/2, y= -1/4+ 1/2+ 1= 5/4, is a critical point.
If 1< x< 2 then both x and x- 1 are positive but x- 2 is negative. The product of x and x- 2 is negative so y= x- 1- x(x- 2)= x- 1- x^2+ 2x= -x^2+ x- 1. y'= -2x+ 1 as before. That is 0 when x= 1/2 which is not between 1 and 2. There is no critical point between 1 and 2.
If x> 2 then all three of x, x- 1, and x- 2 are positive. So y= x- 1+ x(x- 2)= x- 1+ x^2- 2x= x^2- x- 1. y'= 2x- 1 which is 0 when x= 1/2. That is not larger than 2 so there is not critical point for x> 2.
The only critical point is x= 1/2, where y= 5/4 but we also need to check x= 0, x= 1, and x= 2. When x= 0, y= |0- 1|+ |0- 0|= |-1|= 1. When x= 1, y= |1- 1|+ |1- 2|= |-1|= 1. When x= 2, y= |2- 1|+ |4- 4|= |1|= 1.
The maximum value for the function is 5/4 which happens when x= 1/2. The minimum value is 1 which happens at x= 0, 1, and 2.