Why irreduciblilty and not division leads to relative primeness in a PID I'm unable to understand reasoning behind following conclusion: If $p$ is irreducible element of PID $R$ and $p$ doesn't divide $a$ of R. Then $p$ and $a$ are relatively prime.
The definition of a irreducible element $p$ is

*

*It's non-invertible

*If $p=ef$ then one of $e$ and $f$ is invertible

My problem is following reasoning $p\not|a$ doesn't imply $e\not|a$ and if $e$ does divide $a$ and since it divides $p$ (from def). Wouldn't then the GCD of $p$ and $a$ be $e$ instead of $1$? So they won't be relatively prime.
 A: Recall that - generally - in a domain a gcd is defined only up to associates, i.e. up to unit factors, In particular: $\,p,a\,$ are coprime means $\,\gcd(p,a)\approx 1,\,$ i.e. $\,d\mid p,a\iff d\mid 1\iff d\,$ is a unit.
The sought result is a bit more intuitive when viewed slightly more generally. By the Lemma below, in a PID, $\,p\,$ is irreducible $\iff (p)\,$ is a maximal ideal. Generally if $P$ is a maximal ideal we have
$$\begin{align} P\,\ {\rm max},\ P\not\supset A\,&\Rightarrow\, P\!+\!A = (1)\\[.2em]
{\rm so}\ \ p\,\ {\rm irred,}\ \ \ p\,\nmid\, a \,&\Rightarrow\, (p,\,a) = (1),\ \text{for $\,P\!=\!(p),\ A\!=\!(a)\,$ in a PID}\end{align}\qquad$$
therefore we conclude that $\ (1) = (p,a) = (\gcd(p,a)),\,$ so $\,p,a\,$ are coprime.

Lemma $ $ For principal ideals: $\ \rm\color{#0a0}{contains} = \color{#c00}{divides}$, $ $ i.e.  $\,\color{#0a0}{(a)\supseteq (b)}\iff \color{#c00}{a\mid b},\,$   thus having no proper $\rm\color{#0a0}{containing}$ ideal (maximal) is the same as having no proper $\rm\color{#c00}{divisor}$ (irreducible), $ $ i.e.
$\qquad\quad\begin{eqnarray} (p)\,\text{ is maximal} 
&\iff&\!\!\ (p)\, \text{ has no proper } \,{\rm\color{#0a0}{container}}\,\ (d)\\
&\iff&\  p\ \ \text{ has no proper}\,\ {\rm\color{#c00}{divisor}}\,\ d\\
&\iff&\  p\ \ \text{ is irreducible}\\
\end{eqnarray}$

Remark $ $ See also Euclid's Lemma in Bezout form, gcd form, and ideal form.
