Problem 9 · Segment lengths in a grid
How many distinct distances exist between points of a 5×5 grid.
Integer answer, at most 4 digitsIf, in a grid of 25 unit squares like the one in the figure, we draw all the segments joining any 2 of its points, how many different lengths will these segments have?

Copa Cangur · SCM
Medium
Closed answer
Reasoned solution
Key idea: the length of a segment between grid points is $\sqrt{a^{2}+b^{2}}$ where $0 \le a, b \le 5$ are the horizontal and vertical displacements. Counting distinct lengths means counting distinct values of $a^{2}+b^{2}$.
We list the values of $a^{2}+b^{2}$ for $0 \le a \le b \le 5$ (not both zero):
$$1,\ 2,\ 4,\ 5,\ 8,\ 9,\ 10,\ 13,\ 16,\ 17,\ 18,\ 20,\ 25,\ 26,\ 29,\ 32,\ 34,\ 41,\ 50.$$
Mind the single coincidence: $25 = 5^{2}+0^{2} = 3^{2}+4^{2}$, which gives the same length ($5$) for two different pairs, so it counts only once.
In total there are $19$ distinct values.
Answer: 19