A Combinatorial Problem on Polynomials and Rational Functions

The structure of rational functions of two real variables which take few distinct values on large (finite) Cartesian products is described. As an application, a problem of G. Purdy is solved on finite subsets of the plane which determine few distinct distances.