How to count lattice points on a line.

How can we count the number of lattice point on a line, given that the endpoints of the lines are themselves lattice points? I really can't think of how counting lattice points would work, so please provide me some intuition on how lattice points can be counted. Also, what is the relation of the x-distance and y-distance being coprime to existence of lattice points?


Solution 1:

For the line from $(a,b)$ to $(c,d)$ the number of such points is $${\gcd(c-a,d-b)}+1.$$ Especially, if the $x$ and $y$ distances are coprime, only the endpoints are lattice points.