**2015 Spain MO 1.1.** On the graph of a polynomial with integer coefficients, two points are chosen with integer coordinates. Prove that if the distance between them is an integer, then the segment that connects them is parallel to the horizontal axis.

First, let’s * give names to the objects mentioned in the question*. Let the polynomial in question be denoted by , where the ‘s are integers. Let the two chosen points be and , where and are integers and .

With this notation, we can calculate the distance between the 2 points:

Note here that “distance is an integer” is equivalent to being a perfect square.

Next, let’s * test out some simple cases to get a feel for the problem*. If is the constant function (i.e. degree ), then the graph is a horizontal line. In this case, the statement in the problem is obvious: the segment connecting

*any*two points on the graph is parallel to the horizontal axis.

* The next simplest case is where is a linear function *(degree ), i.e.

where . We can calculate the square of the distance between the 2 points:

The term factors out nicely and the remaining term is , which means that it can’t be a perfect square itself!

Hence, we can make the following argument:

Contradiction (since )! Hence, there is no such thing as 2 points with integer coordinates on a (non-constant) linear graph that are an integer distance apart.

Hmmm. That was not particularly illuminating for the general case as the “prerequisite” of having integer distance between 2 points can never be true. The next step is to * see what happens for quadratic functions* (), i.e.

where .

Again, the term factors out nicely and the remaining term is ! Hence, we can use similar logic as in the case of :

But unlike the case of , we can go further:

Hence the line connecting the points and is parallel to the horizontal axis. Done for the case of !

* Can we generalise this procedure?* Looking over the proof above, the key step was in factoring out from the term when calculating the square of the distance. Since

we should be able to follow the same steps to obtain the result for general !

To help make the proof a bit cleaner, let’s * introduce additional notation*:

Then we have the identity

Following the previous chain of logic as close as possible but for general :

Hence,

Since the only pair of perfect squares of difference 1 is , we must have

Hence the line connecting the points and is parallel to the horizontal axis. **Done!**

My solution was essentially the same but starts by noticing that if you have an f, p and q that work, you can shift everything so that (p, f(p)) -> (0, 0). This means f'(x) has no constant term and is actually f'(x) = x * g(x) and so the square distance is q^2 + (q * g(q))^2 = q^2 * (1 + g(q)^2).