Given $2$ points in 2-dimensional space $(x_s,y_s)$ and $(x_d,y_d)$, our task is to find whether $(x_d,y_d)$ can be reached from $(x_s,y_s)$ by making a sequence of zero or more operations. From a given point $(x, y)$, the operations possible are:
a) Move to point (y, x)
b) Move to point (x, -y)
c) Move to point (x+y, y)
d) Move to point (2*x, y)
Now i am pretty sure this has something to do with gcd's but m not able to formalize my approach, Can someone intuitively explain how can we figure out if a particular state is reachable from the current state?
Gcd is invariant under operations a,b,c. Gcd may double under operation d. So the transition is possible if either $\gcd(x_s,y_s)=\gcd(x_d,y_d)$ or $2^n\gcd(x_s,y_s)=\gcd(x_d,y_d)$ for some $n\in\mathbb N$ where we assume $\gcd(x,y)=\gcd(|x|,|y|)$.
Note that $$\gcd(x,y)|ax+by\;\forall\;a,b\in\mathbb Z$$ We can justify our claim that under c gcd is invariant using Bezout's lemma. If $\gcd(x,y)=d\;$$$\exists a,b\in\mathbb Z: ax+by=d\implies a(x+y)+(b-a)y=d\implies\gcd(x+y,y)|d$$ Again $d|x+y,y\implies d|\gcd(x+y,y)$. As both are positive $d=\gcd(x+y,y)$.
For operation d, note that $x/d,y/d$ can't have any common factor other than $1$, it would violate the fact that $d=\gcd(x,y)$. So if $y/d$ is odd $\gcd(2x,y)=d\gcd(2x/d,y/d)=d$. If $y/d$ is even $\gcd(2x,y)=d\gcd(2x/d,y/d)=2d$.