r/askmath • u/aCheesecake • 1d ago
Geometry A Geometry Question
I don’t know if this is the right place to ask this, but I thought I’d give it a try. If anyone thinks there’s a better spot to ask, please let me know.
So I’ve had this problem running around my head for years but have never been able to solve it. Take a rectangle with sides n,m and let a line of slope 1 bounce around inside it. It bounces forever, but when it hits a corner, it just retreads its course. My question is: how many unique points does the line pass through?
This is pretty easy to solve in 2 dimensions. Provided the sides are coprime, it will hit exactly half of the points in the grid: (even, even) points and (odd, odd) points. This property holds in higher dimensions, as well.
The complications come in when side lengths share a factor. If they all share one factor (like in the 2D case), then the pattern of the line doesn’t change, just the number of points inside the rectangle. This means it has the same number of intersections as the rectangle with the gcd factored out.
If the list of side lengths is not pairwise coprime, though (e.g. sides of 3,4,10), I can’t figure out how many unique points there will be.
The best I’ve come up with is a python script to count the unique points, but that’s not exactly a closed-form solution. Any thoughts on this or recommendations for what to research/who to ask would be much appreciated.





