Denote by the set of all points in the plane with integer coordinates. For each integer , let be the subset of consisting of the point together with all points such that for some integer . Determine, as a function of , the number of four-point subsets of whose elements are the vertices of a square.
Problem 1784
Official solution
The answer is .
We first determine the set . Let be the set of points in of the form or for some . Let be the set of points in of the form for some (the two signs being chosen independently). We prove by induction on that We take as base cases the straightforward computations For , it is clear that , so it remains to prove the reverse inclusion. For , note that ; since every perfect square is congruent to either 0 or 1 modulo 4, and must both be even. Consequently, , so we may appeal to the induction hypothesis to conclude.
We next identify all of the squares with vertices in . In the following discussion, let and be two opposite vertices of a square, so that the other two vertices are and
\begin{itemize}
\item Suppose that . Then may be any element of not contained in . The number of such squares is .
\item Suppose that for some . There is one such square with vertices for , for a total of . To show that there are no others, by symmetry it suffices to rule out the existence of a square with opposite vertices and where . The other two vertices of this square would be and . These cannot belong to any , or be equal to , because by the triangle inequality. These also cannot belong to any because . (One can also phrase this argument in geometric terms.)
\item Suppose that for some . There is one such square with vertices for , for a total of . To show that there are no others, we may reduce to the previous case: rotating by an angle of and then rescaling by a factor of would yield a square with two opposite vertices in some not centered at , which we have already ruled out.
\item It remains to show that we cannot have and for some . By symmetry, we may reduce to the case where and . If , then the third vertex is impossible. If , then the third vertex is impossible.
\end{itemize}
Summing up, we obtain squares, proving the claim.