$f(x_1,x_2)\in k[x_1,x_2]$ - prove that $\dim Z(f)=1$ I am dealing with the following question:

Le be $f(x_1,x_2)\in k[x_1,x_2]$ non-constant. Prove that $\dim Z(f)=1.$


I know that $\dim Z(f)=\dim \dfrac{k[x_1,x_2]}{I(Z(f))}$, where $I(Z(f))$ is the set of zeros of $Z(f)$ (and I think it is  $\langle f\rangle $, is it?).
So, I wonder that the dimension is $1$ once it cannot be $2$ (because of there is more than one root, so dimension is lower) and cannot be $0$, because of there is some point that is not root.
This is very unformal and I'd like to get some clue to formalize an answer.
Thanks in advance!
 A: You really only want to talk about the dimension of $I$ when $R/I$ is a domain. That is, only dimensions of irreducible varieties. For example, if $I$ is the ideal corresponding to the line $x = 0$ union the plane $y = z = 0$ then the total variety has one dimension $1$ part (the line) and one dimension $2$ part (the plane). Of course, when you have a principal ideal $(f)$ and $f = g_1 \cdots g_k$ where each $g_i$ is irreducible, then $\operatorname{codim} (g_i) = 1$ by what I will show next. Therefore every irreducible component of $Z(f)$ has codimension $1$.
So let's take $f$ to be irreducible. Then $I(Z(f)) = (f)$ is a prime ideal and chains of (prime) ideals of $k[x_1, x_2]/(f)$ correspond to chains of (prime) ideals containing $f$. So if we have a chain of length $2$ in $k[x_1, x_2]/(f)$:
$$ \mathfrak{p}_0/(f) \subset \mathfrak{p}_1/(f) \subset \mathfrak{p}_3/(f), $$
we get a chain of length at least $3$ in $k[x_1, x_2]$:
$$ (0) \subset (f) \subseteq \mathfrak{p}_0 \subset \mathfrak{p}_1 \subset \mathfrak{p}_2 $$
(possibly $\mathfrak{p}_0 = (f)$). Since we know that $\dim [x_1, x_2] = 2$, this can't happen.
Conversely, we know that $\dim [x_1, x_2]/(f) > 0$ since if $(a_1, a_2)$ is any zero of $f$, then
$$ (f) \subset (x_1 - a_1, x_2 - a_2). $$
Also note that this must be a proper subset because $(x_1 - a_1, x_2 - a_2)$ cannot be a principal ideal. Otherwise $f \mid x_1 - a_1$ and $f \mid x_2 - a_2$ which is only possible if $f \in k$.
You can work this out using polynomial division. First divide by $x_1 - a_1$ until you get a remainder which is a polynomial in $x_2$ only. Then divide by $x_2 - a_2$ until you get a remainder which is constant. Then the remainder must be $0$ since it equals $f(a_1,a_2)$.
I recommend Eisenbud's book Commutative Algebra (Section II: Dimension Theory) for more on Krull dimension.

and I think it is $⟨f⟩$, is it?

If $f = g_1^{i_1} \cdots g_k^{i_k}$ is the irreducible factorization of $f$ (where $g_i$ are irreducible and distinct), then $$I(Z(f)) = (g_1 \cdots g_k).$$
You can maybe see why this should be the case, because $Z(f) = Z(g_1\cdots g_k)$. To prove this, you use Hilbert's Nullstellensatz.
