Proving that $\operatorname{codim}(X,Y)=\dim(\mathcal{O}_{X,\eta})$

First some reductions. The problem is local so we may reduce to the case that $X$ is affine and we have a closed immersion $Y \to X$ in which case $Y$ is affine too. Furthermore, we can give $Y$ the reduced induced subscheme structure so that the closed immersion $Y \to X$ is the one induced by a ring map $A \to A/\mathfrak{p}$ for $\mathfrak{p}$ a prime ideal of $A$. Here we use the fact that an irreducible, reduced scheme is integral.

We recall that $\operatorname{codim}(Y,X)$ is equal to the supremum of the lengths of chains of irreducible closed subsets containing $Y$ (see Qing Liu, Definition 2.5.7):

$$Y \subseteq Z_0 \subsetneq Z_1 \ldots \subsetneq Z_n.$$

Since we have $Y =V(\mathfrak{p})$ you are now asking to prove:

$$\operatorname{codim}(V(\mathfrak{p}),\operatorname{Spec} A) = \operatorname{ht}(\mathfrak{p}) = \dim ( \operatorname{Spec} A_{\mathfrak{p}}).$$

In some sense this is now easy from the Nullstellensatz for $\operatorname{Spec} A$: Given a chain of prime ideals $\mathfrak{p}_0 \subsetneq \ldots \subsetneq \mathfrak{p}_n \subseteq \mathfrak{p}$ we apply $V(-)$ to get a chain of irreducible closed subsets $V(\mathfrak{p}) \subset V(\mathfrak{p}_n) \subsetneq V(\mathfrak{p}_{n-1}) \ldots \subsetneq V(\mathfrak{p}_0)$. The inclusions $V(\mathfrak{p}_i) \subset V(\mathfrak{p}_{i-1})$ are strict for $i \leq n$ (otherwise just take radicals to get that the original primes you had were equal, contradiction).

Conversely for any chain $V(\mathfrak{p}) \subseteq V(J_0) \subsetneq \ldots \subsetneq V(J_n)$ with each $V(J_k)$ irreducible, we must have that the radical of $J_k$ be prime (exercise). Since $V(\sqrt{J}) = V(J)$ it follows we may assume that each $J_k$ is prime. Now apply $I(-)$ to each of these to get

$$J_n \subsetneq J_{n-1} \subsetneq \ldots \subsetneq J_0 \subseteq \mathfrak{p}.$$

This establishes the fact we wanted to prove! Now did we need the Noetherian hypothesis? Not at all!

Exercise : In my answer above, I used the fact that $V(I)$ is irreducible iff $\sqrt{I}$ is prime. Prove this.


The main observation here is that there is a topological embedding $$j: \operatorname{Spec}\: \mathcal O_{X,\eta}\hookrightarrow X$$ inducing an order preserving bijection between the points $z=[\mathfrak p]\in \operatorname{Spec}\: \mathcal O_{X,\eta}$ and the set $\operatorname {Irr}(Y,X)$ of irrreducible closed subsets $Z\subset X$ satisfying $Y\subset Z\subset X$ .
The bijection associates to $z\in \operatorname{Spec}\: \mathcal O_{X,\eta}$ the irreducible closed subset $Z=\overline {\{j(z)\}}$
This is proved in EGA I, Proposition (2.4.2) page 102 . See also this answer on MathOverflow.

The order relation on $\operatorname{Spec}\: \mathcal O_{X,\eta}$ being $$z=[\mathfrak p] \leq z'=[\mathfrak p'] \iff z\in \overline { \{z'\}}\iff \mathfrak p\supset \mathfrak p' $$ and the order relation on $\operatorname {Irr}(Y,X)$ being $Z\subset Z'$, we immediately obtain $$\operatorname {dim} (\operatorname{Spec}\: \mathcal O_{X,\eta})=\operatorname{codim} (Y,X)$$