Answer
a.
$ y=-x+2$ when $0\lt x\leq2$,
$ y=-\frac{1}{3}x+\frac{5}{3}$ when $2\lt x\leq5$
b.
$ y=-3x-3$ when $-1\lt x\leq0$
$ y=-2x+3$ when $0\lt x\leq2$
Work Step by Step
a. The equation of the line segment on the left can be determined using the formula:
$\frac{y-y_{1}}{x-x_{1}}=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$ where $(x_{1},y_{1})$ and $(x_{2},y_{2})$ are two points on the line.
Let $(x_{1},y_{1})=(0,2)$ and $(x_{2},y_{2})=(2,0)$ we have:
$\frac{y-2}{x-0}=\frac{0-2}{2-0}$ which gives: $ y=-x+2$ for $0\lt x\leq2$
Similarly, the equation of the line segment on the right would be:
$\frac{y-1}{x-2}=\frac{0-1}{5-2}$ which gives: $ y=-\frac{1}{3}x+\frac{5}{3}$ for $2\lt x\leq5$
b. Following the same procedure above, the equation for the left line segment is:
$\frac{y-0}{x+1}=\frac{-3-0}{0+1}$ which gives: $ y=-3x-3$ when $-1\lt x\leq0$
and the equation for the right line segment is:
$\frac{y-3}{x-0}=\frac{-1-3}{2-0}$ which gives: $ y=-2x+3$ when $0\lt x\leq2$