<s>[INST] Finding the maximum and minimum values of $f(x)=|x-1|+|x^2-2x|$ for $x \in [0,2]$ Can someone help me solve this problem?

If a function $f(x)$ in the domain $x \in [0,2]$ is
$$f(x)=|x-1|+|x^2-2x|$$
then the minimum value is [A] and the maximum one is [B].

I've tried a lot of things:
As I said earlier, I tried to set everything to zero.
The first and second part:
$f(0)=|0-1|+|0^2-2(0)|=>0-1+0^2-2(0)=>f(0)=-1$
$f(2)=|2-1|+|2^2-2(2)|=>2-1+2^2-2(2)=>f(2)=1$
Only the first part:
$f(0)=|0-1|=>0-1=>f(0)=-1$
$f(0)=|0^2-2(0)|=>0^2-2(0)=>f(0)=0$
Only the second part:
$f(2)=|2-1|=>2-1=>f(2)=1$
$f(2)=|2^2-2(2)|=>2^2-2(2)=>f(2)=0$
In all cases, I don't know what to do next. I also tried to do the same thing this guy in this video did (first problem) https://www.youtube.com/watch?v=3wrXDw5ETh4&t=131s
$\frac{d}{dx}(x-1+x^2-2x)=>-1+2x=0=>x=\frac{1}{2}$
\begin{array} {|r|r|}\hline X & Y \\ \hline 0 & -1 \\ \hline \frac{1}{2} & -\frac{11}{4} \\ \hline 2 & 1 \\ \hline  \end{array}
But $-\frac{11}{4}$ and $1$ are not the minimum and maximun respectively.
One way this site (https://www.wikihow.com/Find-the-Maximum-or-Minimum-Value-of-a-Quadratic-Function-Easily#:~:text=Categories%3A%20Algebra-,To%20find%20the%20maximum%20or%20minimum%20value%20of%20a%20quadratic,%5E2%20%2B%205x%20%2B%204.) says you can find the minimum and maximum value of a quadratic equation is by taking the derivative of that equation in its general form.
$f(x)=|x-1|+|x^2-2x|$
$f(x)=x-1+x^2-2x=x^2-x-1$
$f'(x)=2x−1$
$0=2x-1$
$x=\frac{1}{2}$
$f(\frac{1}{2})=|(\frac{1}{2})-1|+|(\frac{1}{2})^2-2(\frac{1}{2})|=\frac{5}{4}$
Which is one of the answers on the answer sheet, $\frac{5}{4}$ is the maximum value, but the minimum value is 1 and not $\frac{1}{2}$.
 [/INST] I think you are looking for a hint rather than a full solution.So this is how I would go about it.
We start by getting rid of modulus symbol
Case 1: $0\leq x<1$
$f(x)=-(x-1)+x(-(x-2))=-x^2+x+1=\frac{5}{4}-(x-\frac{1}{2})^2$
Case 2: $1\leq x\leq 2$
$f(x)=(x-1)+x(-(x-2))=-x^2+3x-1=\frac{5}{4}-(x-\frac{3}{2})^2$
</s>