Why is dh$(k(x))=$dim $X$? Let $X$ be an integral Noetherian scheme. Let $x\in X$ be a regular closed point of $X$. Then Huybrechts and Lehn in his book, says that dh$(k(x))=$dim $X$. Here dh$(k(x))$ refers to the homological/projective dimension of the $\mathcal{O}_x$-module (vector space in this case) $k(x)$. I have not been able to prove this.
I have tried the following. The Auslander-Buchsbaum formula for a module M over a  regular local ring $A$ is given by : $\mathrm{dh}(M)+\mathrm{depth}(M)=\mathrm{dim}(A)$.
depth($k(x)$)=0 since $k(x)$ is field. Therefore dh$(k(x))$=dim($\mathcal{O}_x)$=height$(\mathcal{m})$, where $\mathcal{m}$ is the maximal ideal corresponding to the point $x$ in an affine say Spec$(A)$ containing $x$. But why is this equal to dim$(X)$. The fact that $x$ is a regular closed point is to be used. But I am not able to proceed.
Any help will be appreciated!
 A: Your reasoning is correct and gives the first equality in the chain
$$\text{projdim}_{{\mathscr O}_{X,x}}(k(x))=\text{dim}({\mathscr O}_{X,x})=\text{codim}(\{x\},X)\leq\text{dim}(X)$$
in which the second equality can be checked directly for $X$ affine, and in which the third inequality is clear but strict in general: Take $R$ a discrete valuation ring with prime $\pi$, $X=\text{Spec}(R[T])$ and $x=(\pi T - 1)$. Then $X$ is regular integral of dimension $2$ and $x$ is a closed point since $$R[T]/(\pi T - 1) = R_{(\pi)} = \text{Quot}(R)$$ is a field. However, we have $\text{dim}({\mathscr O}_{X,x})=\text{height}_{R[T]}((\pi T-1))=1$ by the principal ideal theorem. 
This is taken from Exercise 2.5.3 from Liu's book Algebraic Geometry and Arithmetic Curves.
If $X$ is a integral variety over a field, however, you do have $\text{codim}(\{x\},X)=\text{dim}(X)$ for a closed point $x$.
A: This is consequence of the following fact : Let $(A,\mathfrak m,k)$ be a noetherian local ring. If $\operatorname{inj dim}_A k$ is finite, then $A$ is regular, where $\operatorname{inj dim}_A k$ is the injective dimension. As far as I remember, one variation on this assertion is called "global dimension theorem", referring to a (JP) Serre's result on the subject.
