Problem 9 · Segment lengths in a 4×4 grid
Distinct values of $a^{2}+b^{2}$ with $0 \le a, b \le 4$.
Integer answer, at most 4 digitsIf, in a grid of 16 unit squares like the one in the figure, we draw all segments joining any 2 vertices of these squares, how many different lengths will these segments have?

Copa Cangur · SCM
Medium
Closed answer
Reasoned solution
Key idea: the length of a segment between vertices is $\sqrt{a^{2}+b^{2}}$ where $0 \le a, b \le 4$ are the horizontal and vertical displacements. Counting distinct lengths means counting distinct values of $a^{2}+b^{2}$.
List the values for $0 \le a \le b \le 4$ (not both zero):
$$1,\ 2,\ 4,\ 5,\ 8,\ 9,\ 10,\ 13,\ 16,\ 17,\ 18,\ 20,\ 25,\ 32.$$
There is no coincidence here (the classic $25 = 3^{2}+4^{2} = 5^{2}$ would need displacement $5$, which does not fit): $14$ distinct values.
Answer: 14