I have a list of dozens of points and would like to find a way of finding an equation that passes through every point. I am NOT looking for linear regression
2026-05-15 18:08:12.1778868492
On
Finding an equation given points
89 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
There are 3 best solutions below
0
On
Well, if you do not mind have a polynomial of dozens of degrees and you have points $\{(x_i,y_i)\vert 1\le i\le m\}$
$$ f(x)=\sum_{i=1}^m\left(\prod_{j\ne i}^m\frac{x-x_j}{x_i-x_j}\right)y_i $$
Then when $x=x_i$ the coefficient of $y_i$ will be $1$.
But the coefficient for each $y_j$ where $j\ne i$ will have the term $x_i-x_i$ in the numerator, giving a coefficient of $0$.
Thus, for each $i$, $f(x_i)=y_i$.
But your function is a polynomial of degree $m-1$, which you say, is dozens of degrees.
Two points $(x_1, y_1)$ and $(x_2, y_2)$ uniquely determine a straight line and the equation is given by
$ y - y_1 = m (x - x_1) $
where
$m = \mbox{slope} = {y_2 - y_1 \over x_2 - x_1}$
This is a general formula..
Now, if you have dozens of points and look for a straight line that passes through every one of them, then it is not possible in most of the situations unless we are in a special case when all these points lie in a straight line (collinear points).
If the required polynomial is not required to be a straight line, then you generalize the above calculation..
Suppose that you have a data of $N$ points.
Then we can try to find a polynomial of degree $N - 1$ given by
$$p(x) = a_0 x^{{N - 1}} + \cdots + a_{N - 2} x + a_{N - 1}$$.
(Note that this has a total of $N$ unknowns.)
If this polynomial passes through all the $N$ points $(x_i, y_i)$, it is called an interpolating polynomial and we have a set of $N$ linear equations in $N$ unknowns ($a_0, a_1, \ldots, a_{N - 1}$)
Set this up as a linear system of equations.
A necessary and sufficient condition for a unique solution of this system (unique interpolating polynomial) is that the coefficient matrix has full rank (or nonsingular).