Hartshorne, Algebraic Geometry, Exercise II.3.20, reads (in part):
Let $X$ be an integral scheme of finite type over a field $k$.
(a) [Prove:] For any closed point $P \in X$, $\dim X = \dim \mathcal{O}_P$, where for rings we always mean the Krull dimension.
[...]
I'm stuck on a point which is completely tangential to the actual business about dimension. Here's my proof:
Let $\emptyset \neq X_0 \subset X_1 \subset \cdots \subset X_n \subseteq X$ be an increasing chain of irreducible closed subsets of $X$ of maximum length, so that $n = \dim X$. (In fact $X_n = X$ since $X$ is irreducible.) Let $U \subseteq X$ be an open affine subset which meets $X_0$, and write $A := \mathcal{O}_X(U)$. As $X$ is of finite type over $k$, $A$ is a finitely-generated $k$-algebra by Exercise II.3.3(b).
It follows from general topology that $\dim U = \dim X$. [etc.]
We've now done enough to reduce the problem to the affine case. To see this, consider a closed point $P \in X$. $P$ is contained in some open affine set $V$, which intersects $U$ since $X$ is irreducible. Let $Q$ be a closed point in $U \cap V$. Assuming the affine case, we have $$\dim \mathcal{O}_{X, P} = \dim V = \dim \mathcal{O}_{X, Q} = \dim U = \dim X$$ which establishes the desired result.
So suppose that $X = \operatorname{Spec} A$ for some finitely-generated $k$-algebra $A$. [etc.]
I'm concerned with the bolded sentence, "Let $Q$ be a closed point of $U \cap V$." In particular, how do I ensure that $U \cap V$ contains a closed point? As I understand it, the hypothesis that $X$ is integral of finite type over a field is vital here -- if I take two arbitrary open affines and glue them together then I can easily create a situation where $U \cap V$ doesn't contain a closed point.
However, I'm having trouble seeing how to get anything out of this hypothesis. For instance, $U \cap V$ isn't necessarily affine, and though it contains some affine set a point could be closed in that affine but not in $U \cap V$.
Am I just being stupid here? How do you do this?