In this post
A commutative ring $A$ is a field iff $A[x]$ is a PID
It was proved that a commutative ring $A$ is a field iff $A[x]$ is a principal ideal domain. By this theorem, because $GF_9$ is a finite field, then $GF_9[x]$ must be a principal ideal domian. However in my midterm exam of cryptography. There is a problem said $GF_9[x]$ is a principal ideal domain but not a field. Using the polynomial representation of $GF_9$, we can view $GF_9[x]$ as two variables polynomial in $\alpha$ and $x$ with coefficient belong to $GF_3$.
My question is, how to prove that it is not a field?
Are there any necessary and sufficient condition to make it become a field?
Furthermore, from Wikipedia it is said that
"$K[x,y]$ : rings of polynomials in two variables. The ideal $(x,y)$ is not principal." It confused me that whether $GF_9[x]$ is a principal ideal domain or not.
You can observe that $x$ does not have an inverse. (Argue by degree, for example.)
No. The indeterminate $x$ is never invertible in an ordinary polynomial ring over a field.
That example requires two free indeterminates. The point is that $x$ and $y$ cannot be multiples of a single element of $K[x,y]$. In your case, (with a single variable) the argument does not apply.
No, it is not a full polynomial ring of two variables. It is true that $GF_9\cong GF_3[\alpha]/p(\alpha)$ where $p(\alpha)$ is an irreducible quadratic over $GF_3$, but that does not make the quotient "a polynomial ring." You are describing $GF_3[x,\alpha]/(p(\alpha))$ which is a quotient of $GF_3[x,\alpha]$, and does not fit that argument.