Is there an algebraic solution to deriving a function from a table of values, for example: \begin{array} {|r|r|} \hline x &f(x) \\ \hline 1 &2 \\ \hline 2 &4 \\ \hline \end{array}
which produces $f(x)=2x$
\begin{array} {|r|r|} \hline x &f(x) \\ \hline 1 &1 \\ \hline 2 &4 \\ \hline 3 &9 \\ \hline \end{array}
which produces $f(x)=x^2$
How can this be derived algebraically? And what will result if you are given a table of values that does not represent a function? Is it possible to find a table of values that is similar that will result in a function?
Context: I'm writing software that interprets an image and finds it's outline, then converts the outline to a set of polynomials that when drawn, create an outline similar within a degree of the original images outline