# Help in proving the necessity part (If D is an integral domain, if $d_1=$gcd(a,b), then ..)

In an integral domain D, if $d_1$=gcd(a,b), then $d_2$=gcd(a,b) if and only if $d_1$ and $d_2$ are associates.

Attempt: Since $d_1$=gcd(a,b) then $d_1|a$ and $d_1|b$ which implies that $a=d_1c$ and $b=d_2e$ for $c,e \in D$. Likewise, if $d_2$=gcd(a,b), then $d_2|a$ and $d_2|b$ which implies that $a=d_1x$ and $b=d_2y$ for $x,y \in D$.

And from this, I don't know any trick to show that $d_1=ud_2$ where $u$ is a unit.

Any suggestions?

Before we start, we note that $\gcd(a,b) = 0$ if and only if $d_1 = d_2 = 0$. So now we can assume that $\gcd(a,b) \ne 0$ and $d_1, d_2 \ne 0$.

If $d_1 = \gcd(a,b)$, then $d_1 \mid a$ and $d_1 \mid b$.

If $d_2 = \gcd(a,b)$ and $d_1 \mid a$ and $d_1 \mid b$, then $d_1 \mid d_2$.

Similarly, $d_2 \mid d_1$.

So there exists $u$ and $v$ such that $d_1 = u\,d_2$ and $d_2 = v\,d_1$.

So \begin{align} d_1 &= u\,d_2 \\ d_1 &= u\,v\,d_1 \\ d_1 - u\,v\,d_1 &= 0 \\ (1 - u\,v)d_1 &= 0 \\ \end{align}

You should be able to fill in the rest.