Answer
See graph and explanations.
Work Step by Step
a. Step 1. The first line segment starts with point $(-2,3)$ with a slope equal to the derivative, which is given in the figure as $m=-2$ in the interval of $[-2,0)$; thus we can find the line equation as $y-3=-2(x+2)$ or $y=-2x-1$
Step 2. The right end point of the above equation gives a point $(0,-1)$ which provides the starting point for the next line segment because the line segments are joined end to end.
Step 3. The second line segment has a slope of $m=0$ which is given in the figure; thus the line equation for this segment is $y+1=0(x-0)$ or $y=-1$ in the interval $(0,1)$ with a right end point at $(1,-1)$
Step 4. The next line segment has a slope of $m=1$ which is given in the figure for the interval $(1,3)$; thus the line equation for this segment is $y+1=1(x-1)$ or $y=x-2$ with a right end point at $(3,1)$
Step 5. The last line segment has a slope of $m=-1$ which is given in the figure for the interval $(3,5)$; thus the line equation for this segment is $y-1=-1(x-3)$ or $y=-x+4$ with a right end point at $(5,-1)$
Step 6. Based on the above results, we can graph the function as shown in the figure.
b. Step 1. The first line segment starts with point $(-2,0)$ with a slope equal to the derivative which is given in the figure as $m=-2$ in the interval of $[-2,0)$; thus we can find the line equation as $y-0=-2(x+2)$ or $y=-2x-4$
Step 2. The right end point of the above equation gives a point $(0,-4)$ which provides the starting point for the next line segment because the line segments are joined end to end.
Step 3. The second line segment has a slope of $m=0$ which is given in the figure; thus the line equation for this segment is $y+4=0(x-0)$ or $y=-4$ in the interval $(0,1)$ with a right end point at $(1,-4)$
Step 4. The next line segment has a slope of $m=1$ which is given in the figure for the interval $(1,3)$; thus the line equation for this segment is $y+4=1(x-1)$ or $y=x-5$ with a right end point at $(3,-2)$
Step 5. The last line segment has a slope of $m=-1$ which is given in the figure for the interval $(3,5)$; thus the line equation for this segment is $y+2=-1(x-3)$ or $y=-x+1$ with a right end point at $(5,-4)$
Step 6. Based on the above results, we can graph the function as shown in the figure.