# Can a function be found to fit any set of points?

Could a function be found for any set of points, assuming those points didn't contradict the definition of function?

I mean, given a bunch of (x, y) pairs, could a function be found where when you input the x given in each pair, the output is the y?

I've run into many questions like this in highschool mathematics. Questions like "Find a function who's graph goes through the points (-5,10) and (7,-10)". Now I'm wondering if a function could be found no matter which points, and no matter how many points you're given.

-
Depends on what you mean by "function." – Qiaochu Yuan Sep 20 '11 at 3:10
If there's only a finite number of points then you can explicitly construct a polynomial that hits them (interpolation). – anon Sep 20 '11 at 3:15
Yes, you can even find very nice functions (polynomials) when there are only finitely many points given. And you can always define a function to have the given values at the given points, and value $0$ elsewhere; this is a perfectly fine function from the mathematical point of view. If you have a more restrictive notion of what a "function" is (e.g., it must be given by some sort of "formula"), then you'll need to specify that. – Arturo Magidin Sep 20 '11 at 3:44
... and for an infinite set of points $(x_j, y_j),\ j = 1 \ldots \infty$ such that $\{x_j\}$ has no finite limit points, you can construct an entire function (i.e. an infinite series $f(z) = \sum_{k=0}^\infty c_k z^k$ that converges for all $z$) that hits them. – Robert Israel Sep 20 '11 at 4:29

Yes, there are many methods to find a function that has particular values at particular points. In general, this is part of a field called 'numerical analysis' and this question is called 'interpolation.' If you have any finite set of points, you can even interpolate the points with a polynomial. The standard way here is to use a Lagrange polynomial interpolation or Newton's Divided Differences (which amounts to the same thing). The link is good, but let me give you the idea - one comes up with a very clever polynomial for each point that is zero at all the points but that point, so that when you add them all together you get a (actually the - it's unique) minimal polynomial that hits them all.

Polynomial interpolation is a big topic, and there are lots of resources on the problem. Much of it is automated. I often link to Numerical Recipes, a freely available numerical analysis text aimed towards the end goal of automating the procedure of interpolation and other numerical problems. I think it's a good place to look - once you find something that you're interested in, google it and find accessible material.

Now, you ask about applications and utility. I would say that interpolation is one of the most useful things out there - it's like the idea of best-fit lines, sort of. It lets you predict and analyze patters of relationships, and it the approximation is smooth enough it even lets you use the techniques of calculus (which is a very powerful tool set). Very useful.

-
"Best-fit" lines, however, fall under "fitting" or "regression", and not interpolation proper. :) Indulge me again a reminder: if you're sure you want a function passing through all your given points, interpolate. If your points are sullied by error, regress. – J. M. Sep 20 '11 at 17:19
@Arturo - I like that you edited just to capitalize Lagrange. And JM - indeed. – mixedmath Sep 20 '11 at 18:37