Let $R$ be a principal ideal domain. Show that any pair of nonzero elements $a, b\in R$ have a greatest common divisor and that for any greatest common divisor $d$, we have $d$ in $aR + bR$. Show also that $a, b$ are relatively prime if and only if $1\in aR + bR$.
My attempt: $aR + bR$ is an ideal of R. Let $(aR+bR) =(d)$. That is $(aR+bR)$ is generated by element $d$ in $R$. $a\in aR+bR$ , hence $a = dm$ for some $m\in R$. Now, $b\in aR+bR$, hence $b = dn$ for some $n\in R$. That shows $a$ and $b$ has a common divisor. But I don't know how to go further to turn $d$ into the greatest common divisor.
For b) Suppose $\gcd(a,b)=1$, then $1$ is in $aR+bR=R=(1)$. Conversely, if $1$ is in $aR + bR$, then $aR+bR=(1)=R$, $\gcd(a,b)=1$.