
Zachary M. answered 09/11/19
Former Collegiate Math Instructor
What you would like to do first is break up the problem into two different sections. We have three points, so we need to find two lines, hence the piecewise nature of the problem.
We need a line that goes starts at (-2,2) and ends (0,0). For a traditional line we need two things, slope and y-intercept, so let's find them!
Slope(m)=(y2-y1)/(x2-x1)=(0-2)/(0-(-2))=-1 and luckily the y-intercept is given based on the point (0,0) thus y-int(b)=0. So the first line we have is y=mx+b => y=-x. Careful we are not done, we need to domain. Our line starts at (-2,2) and ends at (0,0) so we only care about the x-vlaues as this is the domain. So the first piece is
y=-x, -2<x<0
We want to perform the same process with the points (0,0) and (3,1). So not to sound repetitive we end up getting m=1/3 and b=0 hence the second piece is y=1/3x, 0<=x<3. Thus we should have our piecewise function
f(x)= -x, -2<x<=0
1/3x, 0<x<=3