TITLE: Does Euclid lemma hold for GCD domains?
QUESTION [6 upvotes]: Exercise $ 10 $ of Section $ 3 $ of Chapter III of Hungerford’s Algebra states that if $ R $ is a UFD and if $ a,b $ are relatively prime, then $ a | bc $ implies $ a | c $, something that is easy to prove using the uniqueness of factorization into irreducibles. So I want to ask whether this holds if $ R $ is just an integral domain (in order for divisibility to make sense) such that $ \gcd(a,b) $ exists for all $ a,b \in R $. 
I can prove this property if I could show that $\gcd(x,y)\gcd(x,z)=\gcd(x,zy)$ or showing that $\gcd(x,y)=1=\gcd(x,z)$ implies $\gcd(x,zy)=1$, this is the part where I've been stuck.
Thanks.

REPLY [7 votes]: This holds true if all pairs of elements have a $\gcd$, in other words in a gcd-domain.
However it fails if just $\gcd(a,b)$ is required to be defined.
To see the latter point, consider your favourite non-UFD, like $\mathbf Z[\sqrt{-5}]$ where $(1+\sqrt{-5})(1-\sqrt{-5})=6=2\times3$ are two distinct factorizations into irreducibles. Now with $a=2$, $b=1+\sqrt{-5}$ and $c=1-\sqrt{-5}$, one has $2=a\mid bc=6$ and $\gcd(a,b)=1$, but $a\not\mid c$.
That existence of all $\gcd$s implies that the implication is valid is explained in the other answers: supposing that $a\mid bc$, then since also $a\mid ac$ it follows that $a\mid\gcd(bc,ac)=\gcd(a,b)c=c$. Here the equality $\gcd(bc,ac)=\gcd(a,b)c$ (in the quotient set $R/{\sim}$, where $\sim$ is the equivalence relation of multiplication by invertible elements, because it is only there that $\gcd$ expression have a well-defined meaning) holds because on one hand $\gcd(a,b)c$ is a common divisor of $bc$ and $ac$, and on the other hand $\gcd(bc,ac)$, which is assumed to exist, divides $\gcd(a,b)c$: it is a multiple $xc$ of the common divisor $c$ of $ac$ and $bc$, and now $x$ must divide both $a$ and $b$ (since $xc$ divides $ac$ and $bc$) and therefore $x\mid\gcd(a,b)$.
By the way existence of all $\gcd$s does not imply that $R$ us a UFD, since it does not imply that factorisations into irreducibles exist in the first place.
Added. It may also be interesting to note if we replace the hypothesis $\gcd(a,b)=1$ for "$a,b$ are relatively prime" by the condition that $ab$ is a  least common multiple of $a$ and $b$, then we get this instance of Euclid's lemma without having to require the existence of other $\def\lcm{\operatorname{lcm}}\lcm$s or $\gcd$s: from $a\mid bc$ and the obvious $b\mid bc$ follow $ab=\lcm(a,b)\mid bc$, and then by simplification by $b$ one gets $a\mid c$.