2
$\begingroup$

I cannot figure this out:

I have a square in the plane with side length $5$. $A$ and $B$ are points in the square. The coordinates of $A$ and $B$ are always integers.

I want to know how many unique Euclidean distances are possible between $A$ and $B$.

I thought $15$?

Editor note The original ambiguous phrasing of this question and the consequent edits to clarify resulted in conflicting solutions. Please take this into consideration as you vote on the answers.

  • 0
    @joriki No problem: thanks for alerting me to problems I inadvertently caused.2012-08-11

3 Answers 3

2

The problem seems to be solved if you count the number of right triangles with integer length short legs (including length 0 legs) which fit into the square, and then check to see if any of the hypotenuse lengths happen to coincide.

I count 21 such triangles (including degenerate ones), which yield 20 distinct values for the hypotenuse.

The only duplicate distance occured was 5: for example, between (0,0) and (0,5), or else between (0,4) and (3,0).

This is all done with the understanding that we are allowed to pick any integer coordinate point in the square $(0,0), (5,0),(0,5),(5,5)$, so I may be interpreting it differently from other people.

  • 0
    Note that for very large grid sizes the duplicates actually dominate: for an $n \times n$ grid there are only about $cn^2 / \sqrt{\log n}$ distances.2012-08-10
1

If you count vertical or horizontal distances the values are 0,1,2,3,4,5;

If the horizontal (or vertical) has length 1 and the vertical has length 1, 2, 3, 4, 5 then the distances are $\sqrt{1^2+1^2}=\sqrt{2}, \sqrt{1^2+2^2}=\sqrt{5}, \sqrt{1^2+3^2}=\sqrt{10}, \sqrt{1^2+4^2}=\sqrt{17}, \sqrt{1^2+5^2}=\sqrt{26}$,

If the horizontal (or vertical) has length 2 and the vertical has length 2, 3, 4, 5 then the distances are $\sqrt{2^2+2^2}=\sqrt{8}, \sqrt{2^2+3^2}=\sqrt{13}, \sqrt{2^2+4^2}=\sqrt{20}, \sqrt{2^2+5^2}=\sqrt{29}$,

If the horizontal (or vertical) has length 3 and the vertical has length 3, 4, 5 then the distances are $\sqrt{3^2+3^2}=\sqrt{18}, \sqrt{3^2+4^2}=\sqrt{25}=5, \sqrt{3^2+5^2}=\sqrt{34}$.

If the horizontal (or vertical) has length 4 and the vertical has length 4, 5 then the distances are $\sqrt{4^2+4^2}=\sqrt{32}, \sqrt{4^2+5^2}=\sqrt{41}$.

If the horizontal (or vertical) has length 5 and the vertical has length 5 then the distances are $\sqrt{5^2+5^2}=\sqrt{50}$.

So there are 20 distinct values for the distances between two points.

0

To the downvoters: This answer was in response to the original question, which asked about a "$5$ by $5$ matrix". The answer was invalidated by an edit that affected the meaning of the question and wasn't marked as such.


I count $15$, too. What makes you think that's wrong?

  • 0
    yes you're right2012-08-10