Given four points with integer coordinates, find if they make a quadratic polynomial Given four points with integer coordinates (x1, y1), (x2, y2), (x3, y3), and (x4, y4), how can I find whether or not they are all on the same quadratic polynomial? I could select any three of the points, and solve the general formula for a quadratic (f(x)=ax^2 + bx + c) and then see if the fourth point was on the quadratic, and repeat for all combinations of points, but that seems "dumb."
Is there a better algorithm for solving this problem?
 A: You only need to solve for the general formula once since this will give you the unique quadratic for which the three points you select land on. Therefore, the fourth point will or will not land on this curve and you'll have your answer.
A: The four equations $y=ax^2+bx+c$ form a linear system. You can check that it is compatible by means of Cramer's rule, which amounts to
$$\left|\begin{matrix}
y_1&x_1^2&x_1&1\\
y_2&x_2^2&x_2&1\\
y_3&x_3^2&x_3&1\\
y_4&x_4^2&x_4&1\\
\end{matrix}\right|=0$$
or
$$\left|\begin{matrix}
y_2-y_1&x_2^2-x_1^2&x_2-x_1\\
y_3-y_1&x_3^2-x_1^2&x_3-x_1\\
y_4-y_1&x_4^2-x_1^2&x_4-x_1\\
\end{matrix}\right|=0.$$
A: If they are on a quadratic, then the four vectors $\vec{u}_0=(1,1,1,1)$,
$\vec{u}_1=(x_1,x_2,x_3,x_4)$, $\vec{u}_2=(x_1^2,x_2^2,x_3^2,x_4^2)$ and
$\vec{v}=(y_1,y_2,y_3,y_4)$ will be linearly dependent. More precisely
$$
\vec{v}=a\vec{u}_2+b\vec{u}_1+c\vec{u}_0.
$$
This linear dependence can be checked by calculating the $4\times4$ determinant
$$D=
\left\vert\begin{array}{cccc}
1&1&1&1\\
x_1&x_2&x_3&x_4\\
x_1^2&x_2^2&x_3^2&x_4^2\\
y_1&y_2&y_3&y_4\end{array}\right\vert.
$$
If they are on a quadratic, you get $D=0$. Actually the converse also holds as long as $x_1,x_2,x_3,x_4$ are all distinct. That's because  by Vandermonde determinants the first three vectors are automatically linearly independent.
A: Making the problem more general : you have $n$ data points $(x_i,y_i)$ and you want to know if all of them  are  on the same quadratic polynomial.
Peform a multilinear regression; avoiding matrices, the corresponding normal equations write 
$$\sum_{i=1}^n y_i=n a + b \sum_{i=1}^n x_i+ c \sum_{i=1}^n x_i^2$$ 
$$\sum_{i=1}^n x_iy_i= a \sum_{i=1}^n x_i+ b \sum_{i=1}^n x_i^2+ c \sum_{i=1}^n x_i^3$$
$$\sum_{i=1}^n x_i^2y_i= a \sum_{i=1}^n x_i^2+ b \sum_{i=1}^n x_i^3+ c \sum_{i=1}^n x_i^4$$ Solve for $a,b,c$ (three linear equations) and compute $$y_i^{calc}=a+ b x_i+c x_i^2$$ If, for all values of $i$, $y_i^{calc}=y_i$, then all points are on the same quadratic polynomial.
