Apply the Lemma below with $\rm\,D = \Bbb Z\,$ and nonunit $\rm\,c = 2\in \Bbb Z$
Lemma $\, $ If $\ \rm \color{#90f}{0\neq c\in domain}\ D\ $ then $\rm \ (c,x) = (f)\ $ in $\rm \,D[x]\,\Rightarrow \,c\,$ is a unit in $\,\rm D.\ $
${\bf Proof}_{\,1}\ $ If $\rm\,(c,x)\!=\!(f)\,$ then $\:\!\rm f\mid c\Rightarrow \deg f \!=\! 0$ $\rm \:\!\Rightarrow\color{#0a0}{f(1)=f(0)},\,$ so eval $\rm\,(c,x)=(f)\,$ at $\rm\,x=0^{\phantom{|^|}}\!\!\Rightarrow\, \color{#c00}{(c)}=\color{#0a0}{(f(0))};\ $ eval at $\rm\,x\!=\!1\Rightarrow (1)= (\color{#0a0}{f(1)})\! = \!(\color{#0a0}{f(0)}) = \color{#c00}{(c)}\Rightarrow \color{#c00}c\mid 1\Rightarrow c\,$ unit.
$\bf Proof_{\,2}\ $ Below is an element-ary form of above proof (we evaluate elements vs. ideals)
$\rm\ \ f\ \in\ (c,x)\ \Rightarrow\ f = c\, g_1 + x\,h_1.\, $ Eval at $\rm\, x = 0\ \Rightarrow\ \color{#0a0}{f(0)} = cg_1(0) = \color{#0a0}{cd},\,\ d\in D$
$\rm\ \ c\ \in\ (f)\ \Rightarrow\ c\ =\ f\, g, \ \,\color{#90f}{hence}\,\ \ \deg f\:\! =\:\! 0\:\Rightarrow\: \color{#c00}f = \color{#0a0}{f(0) = cd}$
$\rm\ \ x\ \in\ (f)\ \Rightarrow\, x\ =\ \color{#c00}f\, h\ =\ \color{#0a0}{cd}\:\!h.\, $ Eval at $\rm\ x\! =\! 1\ \Rightarrow\ 1 = cd\,h(1)\ \Rightarrow\ c\,$ is a unit in $\rm\,D$
Corollary $ $ If $\rm\,D\,$ is a domain then $\rm\,D[x]\,$ is a PID $\rm \iff D\,$ is a field.
Proof $\ (\Rightarrow)\ $ By the lemma if $\rm\,c\neq 0\,$ then $\rm\,(c,x)\,$ principal $\rm\Rightarrow c\,$ is a unit, so $\rm\,D\,$ is a field.
$(\Leftarrow)$ well-known - by $\rm D$ field $\rm\Rightarrow D[x]$ has a Euclidean division (with remainder) algorithm.
Beware $ $ Our use of $\rm D$ is a $\rm\color{#90f}{domain}$ to infer $\rm\,\deg c=0,\ f\mid c\Rightarrow \deg f = 0\,$ is crucial to the proof. This generally fails for non-domains, and so does the Lemma, e.g. in $\rm\,\Bbb Z/6[x]\!:\ (2,x) = (2+3x)\,$ by $\rm\,(2,x)=(2+3x,x)=(2+3x),\,$ by $\rm\,2+3x\mid x,\,$ by $\rm\,(2+3x)(3+2x)=x.\,$ Notice here we have positive degree $\rm\:\! f\mid c,\,$ i.e. $\rm\,2+3x\mid 2\,$ [by $\,-2(2+3x) = 2$].
Remark $ $ It is often true that evaluation serves to reduce many arithmetical properties of polynomial rings to corresponding properties in their coefficient ring, e.g. see here and its links for application of such methods to factoring polynomials.
See here for generalizations to general commutative coefficient rings (vs. domains above)