Is it true that for every sequence $a$ of $n$ numbers there is exactly one polynomial function $f(x)$ of degree $\leq n$ such that all $f(1)=a_1,f(2)=a_2,\dots f(n)=a_{n}$? If so, is there an algorithm to, given the sequence, generate the coefficients of this function?
Intuitively, I feel like this is true, because:
- Given $a$ and $b$, you can find a polynomial function $f$ that has degree $1$ such that $f(0)=a$ and $f(1)=b$.
- By induction: given coefficients $a_1,a_2\dots a_n$, you can find a polynomial function of degree $n$ such that $f(x)$ yields a constant value for all $x$ in $\{1,2\dots n-1\}$.
Mostly, the reason I want to be able to find such a function is so when my math teacher says "find the function rule" and presents us with an obviously linear function I can give her some strange polynomial that just happens to give the correct answers for those values.
f has degree 1 such that f(0)=a and f(1)=b
then $f(x)+ x(x-1)g(x)$ will take the same values at $0,1$ for any $g(x)$. P.S. You've got the degrees off-by-1 a couple of times in the question. – dxiv Mar 16 '17 at 04:58