What is $\gcd(x,x+2)$?

835 Views Asked by At

Show that $\gcd(x,x+2)$ is $1$ if $x$ is odd and $2$ if $x$ is even.

I am looking for a much simpler proof beside the one which I have posted.

2

There are 2 best solutions below

2
On BEST ANSWER

If integer $d$ divides $x,x+2;d$ must divide $(x+2-x)=2$

Observe that $x,x+2$ have same parity as $x+2-x=2$ which is even

Now if $x$ is even $\iff x+2$ is even, then clearly $2$ divides both, hence $(2a,2a+2)=2$

If $x$ is odd, $2$ can not divide $x\implies (2b+1,2b-1)=1$

0
On

Case 1:

If $x$ is odd, then $x$ can be written as $x=2n-1$ where $n\in \mathbb{Z}$. Now $(x,x+2)$ becomes $(2n-1,2n+1)$.

Let's find the $(2n-1,2n+1)$ by using Euclidean Algorithm. $$ 2n+1=1\cdot(2n-1)+2$$ $$ 2n-1=2\cdot(n-1)+1$$ $$ n-1=1\cdot(n-1)+0$$ Clearly, $(2n-1,2n+1)=1.$

Case 2: (Trivial)

If $x$ is even, then it can be written as $x=2n$ where $n \in \mathbb{Z}$. Thus $(x,x+2)$ implies $(2n,2n+2)$. Hence $(x,x+2)=(2n,2n+2)=2.$