[proofplan]
The algebraic part is the height-one consequence of Krull's Principal Ideal Theorem. The theorem gives $\operatorname{height}(\mathfrak p)\le 1$, while the domain hypothesis excludes height $0$ because the only prime below every prime is $(0)$ and $f\ne 0$. For the geometric statement, translate irreducible components of $V_X(f)$ into prime ideals minimal over $(f)$ in $k[X]$, apply the algebraic result, and identify height with codimension under the affine variety dictionary.
[/proofplan]
custom_env
admin
[step:Apply Krull's Principal Ideal Theorem to bound the height from above]Let $A$ be a Noetherian [integral domain](/page/Integral%20Domain), let $f\in A$ be a nonzero nonunit, and let $\mathfrak p\trianglelefteq A$ be prime and minimal over $(f)$. Since $f$ is a nonunit, the principal ideal $(f)$ is a proper ideal of $A$. By Krull's Principal Ideal Theorem (citing a result not yet in the wiki: Krull's Principal Ideal Theorem), every prime ideal minimal over a principal proper ideal in a Noetherian ring has height at most $1$. Applying this theorem to the principal ideal $(f)$ gives
\begin{align*}
\operatorname{height}(\mathfrak p)\le 1.
\end{align*}[/step]
custom_env
admin
[guided]We first isolate exactly where the Noetherian hypothesis is used. The ring $A$ is Noetherian, and the ideal under consideration is the principal ideal $(f)$. Because $f$ is a nonunit, $(f)\ne A$, so $(f)$ is a proper ideal. The prime ideal $\mathfrak p$ is assumed to be minimal among prime ideals containing $(f)$.
Krull's Principal Ideal Theorem says that in a Noetherian ring, if a prime ideal is minimal over a principal proper ideal, then its height is at most $1$. All hypotheses are now verified: the ring is Noetherian, the ideal is principal and proper, and $\mathfrak p$ is minimal over that ideal. Therefore
\begin{align*}
\operatorname{height}(\mathfrak p)\le 1.
\end{align*}
This is the upper bound. The remaining algebraic work is to rule out height $0$, which is where the assumption that $A$ is an integral domain and $f\ne 0$ enters.[/guided]
custom_env
admin
[step:Exclude height zero using the domain hypothesis]
Since $A$ is an integral domain, the zero ideal $(0)$ is a prime ideal. Also, $(0)\subset \mathfrak p$ for every ideal $\mathfrak p\trianglelefteq A$. If $\operatorname{height}(\mathfrak p)=0$, then there is no strictly smaller prime ideal contained in $\mathfrak p$, so the inclusion $(0)\subset \mathfrak p$ forces $\mathfrak p=(0)$.
But $(f)\subset \mathfrak p$ by assumption. If $\mathfrak p=(0)$, then $f\in (0)$, contradicting $f\ne 0$. Hence
\begin{align*}
\operatorname{height}(\mathfrak p)\ne 0.
\end{align*}
Together with $\operatorname{height}(\mathfrak p)\le 1$, this gives
\begin{align*}
\operatorname{height}(\mathfrak p)=1.
\end{align*}
[/step]
custom_env
admin
[step:Translate irreducible hypersurface components into minimal primes]
Now let $k$ be algebraically closed, let $X$ be an irreducible affine variety over $k$, and set
\begin{align*}
A:=k[X].
\end{align*}
By [citetheorem:9415], $A$ is a finitely generated reduced $k$-algebra, and by [citetheorem:9418], irreducibility of $X$ implies that $A$ is an integral domain. Since $A$ is finitely generated over the field $k$, [Hilbert's basis theorem](/theorems/2904) gives that $A$ is Noetherian.
Let $Z\subset X$ be an irreducible component of
\begin{align*}
V_X(f):=\{x\in X:f(x)=0\}.
\end{align*}
Under the affine dictionary between irreducible closed subvarieties of $X$ and prime ideals of $A$, as recorded in [citetheorem:9455], the component $Z$ corresponds to a prime ideal $\mathfrak p_Z\trianglelefteq A$. Because $Z$ is an irreducible component of $V_X(f)$, the prime $\mathfrak p_Z$ is minimal among prime ideals of $A$ containing $(f)$. The same-run affine dictionary also records that regular functions on $X$ are elements of $k[X]$, so the [closed set](/page/Closed%20Set) cut out by $f$ is exactly the vanishing locus attached to the principal ideal $(f)$.
[/step]
custom_env
admin
[step:Convert height one into codimension one]
The element $f\in A$ is nonzero and nonunit by hypothesis. The algebraic result already proved applies to the Noetherian integral domain $A=k[X]$ and the prime ideal $\mathfrak p_Z$ minimal over $(f)$, so
\begin{align*}
\operatorname{height}(\mathfrak p_Z)=1.
\end{align*}
By the prime-closed-subvariety correspondence in [citetheorem:9455], chains of prime ideals from $(0)$ to $\mathfrak p_Z$ correspond, with inclusions reversed, to chains of irreducible closed subvarieties from $X$ down to $Z$. Therefore the codimension of $Z$ in $X$ is the height of $\mathfrak p_Z$. Hence
\begin{align*}
\operatorname{codim}_X Z=1.
\end{align*}
Since $Z$ was an arbitrary irreducible component of $V_X(f)$, every irreducible component of $V_X(f)$ has codimension $1$ in $X$.
[/step]