Answer
a.
$ y=-x $ when $-1\leq x\lt 0$
$ y=1$ when $0\lt x\leq 1$
$ y=-\frac{1}{2}x+\frac{3}{2}$ when $1\leq x\lt 3$
b.
$ y=\frac{1}{2}x $ when $-2\leq x\leq 0$
$ y=-2x+2$ when $0\lt x\leq 1$
$ y=-1$ when $1\lt x\leq 3$
Work Step by Step
a. There are three line segments: (-1,1) to (0,0), (0,1) to (1,1) and (1,1) to (3,0).
Using the formula for a line equation passing two known points, we have:
Left line segment: $\frac{y-0}{x-0}=\frac{1-0}{-1-0}$ which gives $ y=-x $ when $-1\leq x\lt 0$
Middle line segment: $\frac{y-1}{x-1}=\frac{1-1}{0-1}$ which gives $ y=1$ when $0\lt x\leq 1$
Right line segment: $\frac{y-0}{x-3}=\frac{1-0}{1-3}$ which gives $ y=-\frac{1}{2}x+\frac{3}{2}$ when $1\leq x\lt 3$
b. Similarly, the three line segments can be defined by: (-2,-1) to (0,0), (0,2) to (1,0) and (1,-1) to (3,-1).
Left line segment: $\frac{y-0}{x-0}=\frac{-1-0}{-2-0}$ which gives $ y=\frac{1}{2}x $ when $-2\leq x\leq 0$
Middle line segment: $\frac{y-0}{x-1}=\frac{2-0}{0-1}$ which gives $ y=-2x+2$ when $0\lt x\leq 1$
Right line segment: $\frac{y+1}{x-3}=\frac{-1+1}{1-3}$ which gives $ y=-1$ when $1\lt x\leq 3$