I'm trying to solve exercise 11.3.H in Vakil's notes (http://math.stanford.edu/~vakil/216blog/FOAGnov1817public.pdf). We want to show that if $X = \mathrm{Spec} A$ is an irreducible affine $k$-variety (so $A$ an integral domain of finite type over $k$) and $Z$ is an irreducible component of $V(r_1, \dots, r_\ell) \subseteq X$, then $\mathrm{codim}(Z, X) \leq \ell$.
Vakil suggests reducing to the case of $V(r_1, \dots, r_\ell) = Z$. Once we have this, we can apply Theorem 11.2.9 from the notes to get $\mathrm{codim}(Z, X) = \dim(A) - \dim(A/(r_1, \dots, r_\ell)) \leq \ell$ (this inequality can be shown by looking at transcendence degrees and applying $\mathrm{dim}(R) = \mathrm{tr.deg.}_k(\mathrm{Frac}(R))$ if $R$ is an integral domain that's also a finitely generated $k$-algebra (11.2.1 in the notes).
My difficulty is how to perform this reduction. Vakil suggests localizing something. If $Z$ corresponds to the prime ideal $\mathfrak{p}$ in $A$ (minimal among those containing $(r_1, \dots, r_\ell)$, then localizing at $\mathfrak{p}$ gives a Noetherian integral domain $A_\mathfrak{p}$ in which $V(r_1, \dots, r_\ell) = \{\mathfrak{p} A_\mathfrak{p}\} = V(\mathfrak{p})$ and $\mathrm{dim}(A_\mathfrak{p}) = \mathrm{ht}(\mathfrak{p})$, but $A_\mathfrak{p}$ is not necessarily of finite type over $k$ anymore (for example $k[x]_{(x)}$ is not a finitely generated $k$-algebra).
Any comments would be appreciated.