I'm having trouble proving the following if and only if statement:
For all integers $a,b,n$, prove that $n|gcd(a,n)gcd(b,n)$ if and only if $n|ab$
For proving $n|gcd(a,n)gcd(b,n)\implies n|ab$, I tried using Bezout's Lemma for both $gcd$s and expanding but didn't know how to show that $n$ divided $ab$.
Also didn't didn't how to approach the converse. Any help?
Let $d=\gcd(a,n)$ and $e=\gcd(b,n)$ and let $a = da'; b = eb'$ and $n = n'd; n =\overline ne$. Note: $n'$ is relatively prime to $a'$ and $\overline n$ to $b'$
If $n|de$ then $n|de*a'b' = (da')(eb') = ab$.
That was the simple direction.
If $n|ab$ then $n'd|a'db$ so $n'|a'b$ but as $n'$ and $a'$ are relatively prime $n'|b$. So $n'$ is a common factor of $b$ and $n$ so $n'$ divides that greatest common factor of $b$ and $n$. So $n'|e$.
So $n'|e$ so $n'd|de$ so $n|de$.
Likewise we can argue:
If $n|ab$ then $\overline ne|ab'e$ so $\overline n|ab'$ but as $\overline n$ and $a$ are relatively prime $\overline n|a$. So $\overline n$ is a common factor of $a$ and $n$ so $\overline n$ divides that greatest common factor of $a$ and $n$. So $\overline n|d$.
So $\overline n|d$ so $\overline ne|de$ so $n|de$.