Q:

Using GCD/GCF to find number of intersections in a grid

The question I was trying to solve was:

A rectangular floor $24×40$ is covered by squares of sides $1$. A chalk line is drawn from one corner to the diagonally opposite corner. How many tiles have a chalk line segment on them?

In the answer to the problem, the following was stated

Because $GCD(24, 40)=8$, the chalk line contains 8 points where a row and a column intersect, including the terminal corner.

I came to the same conclusion in a different manner, by simplifying the slope, $\frac{24}{40}$ to $\frac{3}{5}$ and plugging in multiples of $5$ and obtaining the points $\left\{ \left( 3,\; 5 \right),\; \left( 10,\; 6 \right),\; \left( 9,\; 15 \right),\; ... \right\}$ by multiplying both $x$ and $y$ by integral values.
What I want to know is why finding the GCD between the two numbers gives you the number of intersection points between the row and column. How can you prove that this always works?

A:

When you simplified $\frac {24}{40}$ to $\frac 35$, you divided numerator and denominator by $8$, which is $\gcd(24,40)$  The point is in a sense the same as what you did by hand.  The first intersection the line goes through is $\left(\frac {24}{\gcd(24,40)},\frac {40}{\gcd(24,40)}\right)$ and the pattern repeats.

