There is a line segment say $AB$ with coordinates of end-points as $A=(x_1, y_1)$ and $B=(x_2, y_2)$. $x_1, y_1, x_2, y_2$ are integers. I need to find the number of integer coordinates which lie on the line segment including end-points.
I read somewhere that it is $\gcd(|x_1 - x_2|, |y_1 - y_2|) + 1$. But, I cannot understand why this works.
I do not get the intuition behind it. I searched for proof but did not find anything intuitive and straightforward.
Please help me understand this. I am stuck on it. I am expecting a nice proof with great explanation.
Thanks in advance!