Question about FOAG exercise 11.3.I This is an exercise in Ravi Vakil's AG notes.  My question is about part b.  Namely, in the induction step recommended in the hint, why can't I just choose $g_d$ to be any element outside $\cup_j \mathfrak{ p}_j$? Why do I need $g_d$ to be in all of the $\mathfrak{ q}_i$? Maybe the dimension of $A/(g_d)$ will go down by more than $1$, but that just means I would need fewer than $d$ generators in the statement of the proposition (and in fact that is prohibited by part a).  It makes me think I am misunderstanding something fundamental.
Edit: I have typed the exercise below.
Let $(A, \frak m)$ be a Noetherian local ring.
b) Let $d= \dim A$.  Show that there exist $g_1,...,g_d\in A$ such that $V(g_1,...,v_d) = \{[\frak m]\}$.
Hint: use induction on $d$. Find an equation $g_d$ knocking the dimension down by 1, i.e., $\dim A/(g_d) = \dim A -1$. Suppose $\frak p_1,...,p_n$ correspond to the irreducible components of $Spec A$ of dimension $d$, and $\frak p_i \subset q_i$ are prime ideals corresponding to irreducible closed susbsets of codimension $1$ and dimension $d-1$. Use prime avoidance to find $h_i \in \frak q_i- \cup_{j=1}^n p_j$. Let $g_d= \Pi_{i=1}^n h_i.$
 A: Yes, your argument looks absolutely correct to me, and in fact you can use it to prove the following more general fact:
Lemma 1: If $A$ is a (commutative) Noetherian ring, and $\mathfrak{p}<A$ is a prime of height $d$, then there exist $g_1,\dots,g_d\in \mathfrak{p}$ such that $\mathfrak{p}$ is a minimal prime over $\langle g_1,\dots,g_d\rangle$.
Proof: By induction on $d$. The case $d=0$ is clear, since then $\mathfrak{p}$ is minimal over the zero ideal, which is generated by $\varnothing$. For the inductive step, suppose $d>0$. Now, since $A$ is Noetherian, it has finitely many minimal prime ideals; let $\mathfrak{q}_1,\dots,\mathfrak{q}_k$ be a complete list. Since $\operatorname{ht}\mathfrak{q}_i=0<d=\operatorname{ht}\mathfrak{p}$ for each $i$, we have $\mathfrak{p}\nsubseteq \mathfrak{q}_i$ for each $i$, and hence by prime avoidance we may find $g_d\in \mathfrak{p}\setminus\bigcup_{i=1}^k\mathfrak{q}_i$. Then the prime ideal $\mathfrak{p}\big/\langle g_d\rangle$ of the Noetherian ring $A\big/\langle g_d\rangle$ has height strictly smaller than $d$ – say $\operatorname{ht}\mathfrak{p}\big/\langle g_d\rangle=l$ – and now by the inductive hypothesis there exist $g_1,\dots,g_{l}\in A$ such that $\mathfrak{p}\big/\langle g_d\rangle$ is a minimal prime over $\langle \bar{g}_1,\dots,\bar{g}_{l}\rangle$. Now $\mathfrak{p}$ is a minimal prime over $\langle g_1,\dots,g_l,g_d\rangle$, so we are done. $\blacksquare$
Note that the height actually is knocked down by precisely one; in other words, in the proof of Lemma 1, we actually must have $l=d-1$. Why? Well, by Krull's height theorem, if $\mathfrak{p}$ is minimal over $\langle g_1,\dots,g_l,g_d\rangle$ then $\operatorname{ht}\mathfrak{p}\leqslant l+1$. But $l<d$, and $\operatorname{ht}\mathfrak{p}=d$, so this forces $l=d-1$, as desired. So your proof in fact subsumes Ravi's completely. Also, because of this fact, ie since $l=d-1$, we may actually use the same argument to prove a slightly stronger fact:
Lemma 2: If $A$ is a (commutative) Noetherian ring, and $\mathfrak{p}<A$ is a prime of height $d$, then there exist $g_1,\dots,g_d\in \mathfrak{p}$ such that $\langle g_1,\dots,g_d\rangle$ has height $d$. $\blacksquare$
The proof is essentially identical, although it does invoke Krull's height theorem, which is not needed in Lemma 1.
