Is it possible to determine a $\gcd$ in a non integral domain. For instance if we take the ring $\mathcal{Z}/9\mathcal{Z}=\{\bar0,\bar1,\bar2,\bar3,\bar4,\bar5,\bar6,\bar7,\bar8\}$. It's not an integral domain (indeed : $\bar3.\bar3=\bar0$ but $\bar3\neq \bar0$).
How can we determine $\gcd(\bar2,\bar7)$ ? Can we write a Bézout's relation ? I know that we can determine $(\mathcal{Z}/9\mathcal{Z})^{\times}$ using the congruences and Bézout which make the link between $\mathcal{Z}/9\mathcal{Z}$ and the ring $\mathcal{Z}$.
Moreover if we want to determine idempotent elements of this ring it can be a problem if we cannot use Bézout.
Thanks in advance !
 A: The first thing you have to understand is that even if $\gcd(a, b)$ exists, it is not unique, strictly speaking. Even in $\mathbb{Z}$, for instance both $3$ and $-3$ are gcd's of $6$ and $15$. But the change of $\pm$ is the only thing that can happen in $\mathbb{Z}$, because $\pm 1$ are the only units of $\mathbb{Z}$.
Now quasi's answer is correct, and you should understand why in that example, all units of the ring are gcd's for your example. However, being all units, of course they are all associated (meaning: If $d$ and $e$ are gcd's of $a$ and $b$, then there is a unit $u$ such that $d\cdot u=e$).
In a domain, that would always be the case: If gcd's exist, they are associated.
That is also true in your ring $\mathbb{Z}/9$, as you can check by going through all cases (and noticing that $6 = -3$ in that ring), and it will be true for any $\mathbb{Z}/n$. But it is not true in general in rings with zero-divisors. Examples for this are a bit more complicated. Some are given in answers to this question: Two principal ideals coincide if and only if their generators are associated, and here.
A: By definition, in a commutative ring $R$, given two elements $a,b \in R$, an element $d \in R$ is a $\gcd$ of $a,b$, if


*

*$d|a$ and $d|b\;$(i.e., $d$ is a common divisor of $a,b$).$\\[4pt]$

*If $e \in R$ is such that $e|a$ and  $e|b$, then $e|d$.


If all ideals of $R$ are principal (as is the case for $Z_9$), then any principal generator of the ideal $(a,b)$ is a $\gcd$ of $a,b$.

In particular, in the ring$Z_9$, the elements $2,7$ are units, so any unit is a $\gcd$ of $2,7$, For example, $1$ is a $\gcd$ of $2,7$.
