Problem:
A rectangle is plotted on the Cartesian plane with one corner at the origin and with sides parallel to the coordinate axes. How many unit squares do the two diagonals of this rectangle pass through?
Problem:
A rectangle is plotted on the Cartesian plane with one corner at the origin and with sides parallel to the coordinate axes. How many unit squares do the two diagonals of this rectangle pass through?
Solution:
Suppose that one corner of the rectangle is on . First of all, note that and are relatively prime. This means that the line does not intersect any vertex of a unit square in the interior of the grid.
Now, consider the diagonal from to . This diagonal intersects exactly vertical segments and horizontal segments. Here, each intersection point represents an entry point into a new unit square. Including the original unit square (which has the origin as a corner), this accounts for a total of unit squares.
Similarly, the other diagonal of the rectangle passes through unit squares. Finally, since the diagonals intersect at the center, the center must have been an entry point for one diagonal and an exit point for the other, and vice versa. These pertain to the two unit squares that both diagonals pass through.
Therefore, the diagonals pass through a total of unit squares.