# How do you write f(x)=|x-1| as piecewise functions?

$f \left(x\right) = x - 1$ if $x \ge 1$ otherwise $f \left(x\right) = 1 - x$
Since $x - 1$ may be positive or negative or null, you can write the function as:
$f \left(x\right) = x - 1$ if $x \ge 1$ otherwise $f \left(x\right) = 1 - x$