Answer
See the explanation
Work Step by Step
Determine the equation of the line passing through the points $(0,1)$ and $(2,-1)$:
$y-1=\dfrac{-1-{1}}{2-{0}}(x)$
$y-1=-x$
$y=-x+1$
The formula for the piece-wise function graph is as follows:
$f(x)=$ $\begin{cases}
1 & \text{if} & x \leq -1\\
-x+1 & \text{if} & -1\lt x \leq 2\\
-2 & \text{if} & x \gt 2
\end{cases}$