I have this expression, and I have to simplify it:
$D=\sqrt{x^2}+\sqrt{x^2-2x+1}$
Answer: $1)$ If $x<0, D=1-2x$, $2)$ if $0\le x<1, D=1;$ $3)$ if $x>1, D=2x-1$.
I received $|x-1| + |x|$, but I am not sure how to continue, and I have problems with understanding the answer.
$D = \sqrt{x^2}+\sqrt{(x-1)^2}=|x| + |x-1|$