Standard linear function is f(x)=ax+b where a and b are constants.
Substitute each point into the function:
21=-2a+b, -35=5a+b. We need go no further because we have two linear equations and two unknowns.
f(-2)-f(5): 56=-7a so a=-8. Now we can work out b: b=21+2a=21-16=5 so f(x)=5-8x.
Quick check shows that the function is correct: f(-2)=5+16=21; f(5)=5-40=-35.
But we need to check all the other points:
f(-6)=5+48=53; f(3)=5-24=-19; uh-oh, something wrong!
The values don't fit. So either f(x) is not linear or it's piecewise.
Closer inspection is needed. First plot the points. It's clear to see that the points are not colinear. Join the points with straight lines. We're not told that f is continuous. Let's assume it is. If it's piecewise, we need 5 different equations to define the function between the 6 points. In order these are (-9,-4), (-6,-2), (-2,21), (3,-5), (5,-35), (12,14). Call these points A, B, C, D, E, F. We can work out linear equations between A and B, B and C, C and D, etc. These equations will provide continuity for f in the domain -9<x<12.
The alternative is to assume continuous f is non-linear: f(x)=a0+a1x+a2x^2+a3x^3+a4x^4+a5x^5, where a0 to a5 are six coefficients which can be calculated from the six given points. The process is tedious and time-consuming. it's unlikely that the coefficients will be integers. The calculations will involve raising numbers like 9 and 12 to the power 5.
Going back to the piecewise function. Take two points (x1,y1) and (x2,y2). The line between them has the general form y=f(x)=ax+b. Plugging in the points we get: y1=ax1+b and y2=ax2+b; so y1-y2=a(x1-y1) and a=(y1-y2)/(x1-x2).
To find b, use one equation: b=y1-ax1=y1-x1(y1-y2)/(x1-x2)=(y1x1-y1x2-y1x1+x1y2)/(x1-x2)=(x1y2-x2y1)/(x1-x2).
So f(x)=x(y1-y2)/(x1-x2)+(x1y2-x2y1)/(x1-x2). So now we take pairs of points and work out the equations.
(-9,-4) and (-6,-2): f(x)=2x/3+2; -9<x<-6
(-6,-2) and (-2,21): f(x)=23x/4+65/2; -6<x<-2
(-2,21) and (3,-5): f(x)=-26x/5+53/5; -2<x<3
(3,-5) and (5,-35): f(x)=-15x+40; 3<x<5
(5,-35) and (12,14): f(x)=7x-70; 5<x<12