Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Proof: If $a\equiv b\pmod{n}$, then $n$ divides $a-b$. So $a-b=ni$ for some integer $i$. Then, $b=ni-a$. Since $\gcd(a,n)$ divides both $a$ and $n$, it also divides $b$. Similarly, $a=ni+b$, and since $\gcd(b,n)$ divides both $b$ and $n$, it also divides $a$.

Since $\gcd(a,n)$ is a divisor of both $b$ and $n$, we know $\gcd(a,n)\leq\gcd(b,n)$. Similarly, since $\gcd(b,n)$ is a divisor of both $a$ and $n$, we know $\gcd(b,n)\leq\gcd(a,n)$. Therefore, $\gcd(a,n)=\gcd(b,n)$.

Thanks for helping me through this one!

share|cite|improve this question
up vote 4 down vote accepted

Let $a-b=ni$ like you say. Then $b=a-ni$, so since $\gcd(a,n)$ divides $a$ and $n$, it also divides $b$. So as a common divisor of $n$ and $b$, you must have $\gcd(a,n)\mid\gcd(b,n)$. Similarly, $\gcd(b,n)\mid\gcd(a,n)$, so necessarily $\gcd(a,n)=\gcd(b,n)$.

share|cite|improve this answer
nicely put! I like that 2-directional approach. – ivan Feb 28 '13 at 17:33
@ivan Thanks, glad it helped. – Ben West Feb 28 '13 at 17:36

You're almost done. Note $\rm\: d\mid n,b\iff d\mid n,b\!+\!ni\:$ since if $\rm\:d\mid n\:$ then $\rm\:d\mid b\iff d\mid b\!+\!ni.\:$ Therefore we've deduced that $\rm\:n,b\:$ and $\rm\:n,b+ni\:$ have the same set D of common divisors d, therefore they have the same greatest common divisor (= max D).

share|cite|improve this answer

HINT : Let $d = \gcd(b,n)$, then $b = dx$ and $n = dy$ for some $x$ and $y$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.