TITLE: Show that if $a \equiv b \pmod n$, $\gcd(a,n)=\gcd(b,n)$
QUESTION [9 upvotes]: My problem is how to somehow relate the the gcd and congruence. I know that $(a,b) = ax + by$. I also know that $a \equiv b \pmod n$ means $n\mid a-b$. Any hints?
Thanks!

REPLY [6 votes]: If $\rm\ d\ |\ n\ |\ a\!-\!b\  $ then $\rm\ d\ |\ a \!\iff\! d\ |\ b, \ $ i.e. $\rm\bmod d\!:\ $ if $\rm\ a\equiv b\ $ then $\rm\ a\equiv 0\!\iff\! b\equiv 0$
So $\rm\, \{n,a\},\ \{n,b\}\ $ have the same common divisors $\rm\,d,\,$ so the same greatest common divisor.
Remark $\ $ Note how it simplifies after eliminating the less intuitive divisibility relations in favor of familiar equations (here congruences). $\ $ After converting it to manipulation of equations it is completely trivial, viz. if $\rm\ a \equiv b\ $ then $\rm\ n,a\equiv 0 \iff n,b \equiv 0.\:$ That illustrates the tremendous power of congruences - they allow us to transform diverse problems to equational form - allowing us to reuse our well-honed intuition on manipulating (integer) equations. To succeed in number theory and algebra it is essential to master such techniques. They lead to powerful methods of "modular reduction" - an algebraic way of "dividing and conquering" - reducing problems to simpler problems that (hopefully) combine to yield the complete solution.