Let $D$ be a domain, and let $a,b\in D$. An element $d\in D$ is called a greatest common divisor (g.c.d) of $a$ and $b$ if:
i) $d|a$ and $d|b$; and
ii) if $c$ is any element such that $c|a$ and $c|b$, then $c|d$.
Show that if $D$ is a PID, then any two elements of $D$ have a g.c.d. which can be written in the form $xa+yb$, for some $x,y\in D$. (Suggestion: consider the ideal $\{xa+yb|x,y\in D\}$.)