Lemma 10.130.4. Let $k$ be a field. Let $S$ be a finite type $k$ algebra. If $\dim (S) > 0$, then there exists an element $f \in S$ which is a nonzerodivisor and a nonunit.

Proof. Let $I \subset S$ be the radical ideal such that $V(I) \subset \mathop{\mathrm{Spec}}(S)$ is the set of primes $\mathfrak q \subset S$ with $S_\mathfrak q$ not Cohen-Macaulay. See Lemma 10.130.3 which also tells us that $V(I)$ is nowhere dense in $\mathop{\mathrm{Spec}}(S)$. Let $\mathfrak m \subset S$ be a maximal ideal such that $\dim (S_\mathfrak m) > 0$ and $\mathfrak m \not\in V(I)$. Such a maximal ideal exists as $\dim (S) > 0$ using the Hilbert Nullstellensatz (Theorem 10.34.1) and Lemma 10.114.5 which implies that any dense open of $\mathop{\mathrm{Spec}}(S)$ has the same dimension as $\mathop{\mathrm{Spec}}(S)$. Finally, let $\mathfrak q_1, \ldots , \mathfrak q_ m$ be the minimal primes of $S$. Choose $f \in S$ with

$f \equiv 1 \bmod I,\quad f \in \mathfrak m,\quad f \not\in \bigcup \mathfrak q_ i$

This is possible by Lemma 10.15.3. Namely, we have $S/(I \cap \mathfrak m) = S/I \times S/\mathfrak m$ by Lemma 10.15.4. Thus we can first choose $g \in S$ such that $g \equiv 1 \bmod I$ and $g \in \mathfrak m$. Then $g + (I \cap \mathfrak m) \not\subset \mathfrak q_ i$ since $V(I \cap \mathfrak m) \not\supset V(\mathfrak q_ i)$. Hence the lemma applies. Clearly $f$ is not a unit. To show that $f$ is a nonzerodivisor, it suffices to prove that $f : S_\mathfrak q \to S_\mathfrak q$ is injective for every prime ideal $\mathfrak q \subset S$. If $S_\mathfrak q$ is not Cohen-Macaulay, then $\mathfrak q \in V(I)$ and $f$ maps to a unit of $S_\mathfrak q$. On the other hand, if $S_\mathfrak q$ is Cohen-Macaulay, then we use that $\dim (S_\mathfrak q/fS_\mathfrak q) < \dim (S_\mathfrak q)$ by the requirement $f \not\in \mathfrak q_ i$ and we conclude that $f$ is a nonzerodivisor in $S_\mathfrak q$ by Lemma 10.104.2. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).