I would like to prove the following fact.
Let $X$ be a scheme, and $x\in X$. Show that $\text{dim}(\mathcal{O}_{X,x})=\text{codim}(\bar{\{x\}},X) $, with $\bar{\{x \}}$ the closure of the subset $\{x\}$.
This is a simple exercise, that can be found on "Algebraic Geometry and Arithmetic Curves", Qing Liu, Oxford Science Pubilcations, 2002, pp. 75. I tried to prove it, but I don't think I can. Any ideas?
Suppose $X$ is an affine scheme $\textrm{Spec } A$. We can do this because the question (about the dimension) is local. If $x$ corresponds to a prime ideal $\mathfrak p\subset A$, we have $$\dim\,\mathscr O_{X,x}=\dim A_\mathfrak p=\textrm{height}\,\mathfrak p=\textrm{codim}\,(\{x\}^-,X).$$ Indeed the height of an ideal is always the codimension of the variety corresponding to that ideal (I used this in the last equality). This (and also the previous equality) follows from the very definition of height.