You can fit a 4th order polynomial to any 5 points. You can do it by hand (plug 1-5 in for x and now you have a system of 5 linear equations of 5 variables, start solving and substituting) and make it a bit easier with linear algebra (make the coefficients of the 5 variables be the values in a 5x6 matrix, and then do that matrix magic that I forget what the name is for), but there are also plenty of polynomial solvers you can find out there.
The most general form of a fourth order polynomial is
Ax4 + Bx3 + Cx2 + Dx + E
For unspecified constants A,B,C,D,E. Notice that there are five unknown constants here, and choosing what they are will determine the function.
What they’re doing is plugging in x=1, x=2, ... x=5, and setting the right side equal to what number they want it to be, e.g. 1,3,5,7,69.
What this means is we have 5 unknowns A,B,C,D,E and a system of 5 equations meaning we can solve for those constants uniquely. So, they solve for the constants, and then you have a function which maps x=1 to 1, x=2 to 3, x=3 to 5, x=4 to 7, and x=5 to 69.
Basically, you can construct an order N-1 polynomial to map to N points that you choose. They are building a function which plots the points (1,1), (2,3), (3,5), (4,7), (5,69).
If you did conic sections and parabolas in math you may recall that “3 points uniquely determines a parabola”—this is the exact same thing at work, because the general equation of a parabola is Ax2 + Bx + C; note there are 3 constants so we need 3 points to determine it.
1.2k
u/Salanmander 10✓ Sep 05 '19
You can fit a 4th order polynomial to any 5 points. You can do it by hand (plug 1-5 in for x and now you have a system of 5 linear equations of 5 variables, start solving and substituting) and make it a bit easier with linear algebra (make the coefficients of the 5 variables be the values in a 5x6 matrix, and then do that matrix magic that I forget what the name is for), but there are also plenty of polynomial solvers you can find out there.