Solution 1 (Analytical argument)
We can state this problem more precisely: find all integer solutions
to the equation,
(1) y = (-b/a)x + b, 0 <= x <= a.
Let d denote the greatest common divisor a and b. Hence, there exist
integers r and s such that
a = rd, and b = sd. Now, we can rewrite equation (1) as follows,
y = (-s/r)x + b.
Furthermore, note that y is an integer if and only if x is a multiple
of r. And that there are d+1
multiple of r between 0 and a. Therefore there are d+1 lattice points
between (a,0) and (0,b).
Solution 2 (Geometric argument)
First, consider a more general problem: lattice points in a
rectangular region, and particularly, in a
square region:
a = 1,
* *
* *
a = 2,
* * *
* * *
* * *
a = 3,
* * * *
* * * *
* * * *
* * * *
Now, it's clear that the diagonal contains a+1 lattice points and the
gcd(a,a) = a.
Thus the number of lattice points between (a,0) and (0,a) is gcd(a,a)
+1.
What about a rectangular region? From solution 1 we know that ab =
rsd^2. Hence a rectangular
region contains the same number of lattice points as the square of
side d. Therefore, the number of
lattice points between (a,0) and (0,b) is gcd(a,b)+1.