0

Again, I have been stuck in a problem of modular arithmetic.

Given that $a,b, n \in \mathbb Z $ and $n>0$ and $a \equiv b \bmod n$. Show that $\gcd(a, n)= \gcd(b,n)$.

2 Answers2

1

You have that $a = jn + c$ and $b = kn + c$ for some $j,k,c \in \mathbb Z$.

Suppose some $g \in Z$ divides both $a$ and $n$; then $\frac{a}{g}$ is an integer, as is $\frac{jn}{g}$. The difference between two integers is always an integer; so $\frac{c}{g}$ is also an integer - which means that $g$ is a divisor of $c$ as well.

Now consider $\frac{b}{g} = \frac{kn}{g} + \frac{c}{g}$. Since $\frac{kn}{g}$ and $\frac{c}{g}$ are integers, $\frac{b}{g}$ must also be an integer; which is to say that every number which divides both $a$ and $n$ will also divide $b$.

The same logic goes the other way - we can also conclude that every number which divides both $b$ and $n$ will also divide $a$.

So the common divisors of $a$ and $n$ are the same as the common divisors of $b$ and $n$; and thus the greatest of these divisors is the same: $gcd(a,n) = gcd(b,n)$.

Chas Brown
  • 1,660
1

Since $a \equiv b \pmod{n}$ then we can choose $i,j,x\in\mathbb{Z}$ such that $a=ni+x$ and $b=nj+x$. Let

$$d=\gcd(a,n)=\gcd(ni+x,n).$$ Since $d \mid (ni+x)$ and $d \mid n$ then $x$ must also be a mutiple of $d$. Since $d \mid n$ and $d\mid x$ then we have $d\mid (nj+x)$ so $d \mid \gcd(nj+x, n)=\gcd(b,n)$. Thus, $d=\gcd(a,n) \le \gcd(b,n)$. A similar argument shows that $\gcd(b,n)\le\gcd(a,n)$ so we can conclude that $\gcd(a,n)=\gcd(b,n)$.

sardoj
  • 471