Dimension of a scheme

In algebraic geometry, the dimension of a scheme is a generalization of a dimension of an algebraic variety. Scheme theory emphasizes the relative point of view and, accordingly, the relative dimension of a morphism of schemes is also important.

Definition
By definition, the dimension of a scheme X is the dimension of the underlying topological space: the supremum of the lengths ℓ of chains of irreducible closed subsets:
 * $$\emptyset \ne V_0 \subsetneq V_1 \subsetneq \cdots \subsetneq V_\ell \subset X.$$

In particular, if $$X = \operatorname{Spec} A$$ is an affine scheme, then such chains correspond to chains of prime ideals (inclusion reversed) and so the dimension of X is precisely the Krull dimension of A.

If Y is an irreducible closed subset of a scheme X, then the codimension of Y in X is the supremum of the lengths ℓ of chains of irreducible closed subsets:
 * $$Y = V_0 \subsetneq V_1 \subsetneq \cdots \subsetneq V_\ell \subset X.$$

An irreducible subset of X is an irreducible component of X if and only if the codimension of it in X is zero. If $$X = \operatorname{Spec} A$$ is affine, then the codimension of Y in X is precisely the height of the prime ideal defining Y in X.

Examples
\{ x = 0 \} \subset \mathbb{A}^3$$ as an irreducible component). If x is a closed point of X, then $$\operatorname{codim}(x, X)$$ is 2 if x lies in H and is 1 if it is in $$X - H$$. Thus, $$\operatorname{codim}(x, X)$$ for closed points x can vary.
 * If a finite-dimensional vector space V over a field is viewed as a scheme over the field, then the dimension of the scheme V is the same as the vector-space dimension of V.
 * Let $$X = \operatorname{Spec} k[x, y, z]/(xy, xz)$$, k a field. Then it has dimension 2 (since it contains the hyperplane $$H =
 * Let $$X$$ be an algebraic pre-variety; i.e., an integral scheme of finite type over a field $$k$$. Then the dimension of $$X$$ is the transcendence degree of the function field $$k(X)$$ of $$X$$ over $$k$$. Also, if $$U$$ is a nonempty open subset of $$X$$, then $$\dim U = \dim X$$.
 * Let R be a discrete valuation ring and $$X = \mathbb{A}^1_R = \operatorname{Spec}(R[t])$$ the affine line over it. Let $$\pi: X \to \operatorname{Spec}R$$ be the projection. $$\operatorname{Spec}(R) = \{ s, \eta \}$$ consists of 2 points, $$s$$ corresponding to the maximal ideal and closed and $$\eta$$ the zero ideal and open. Then the fibers $$\pi^{-1}(s), \pi^{-1}(\eta)$$ are closed and open, respectively. We note that $$\pi^{-1}(\eta)$$ has dimension one, while $$X$$ has dimension $$2 = 1 + \dim R$$ and $$\pi^{-1}(\eta)$$ is dense in $$X$$. Thus, the dimension of the closure of an open subset can be strictly bigger than that of the open set.
 * Continuing the same example, let $$\mathfrak{m}_R$$ be the maximal ideal of R and $$\omega_R$$ a generator. We note that $$R[t]$$ has height-two and height-one maximal ideals; namely, $$\mathfrak{p}_1 = (\omega_R t - 1)$$ and $$\mathfrak{p}_2 = $$ the kernel of $$R[t] \to R/\mathfrak{m}_R, f \mapsto f(0) \bmod\mathfrak{m}_R$$. The first ideal $$\mathfrak{p}_1$$ is maximal since $$R[t]/(\omega_R t - 1) = R[\omega_R^{-1}] = $$ the field of fractions of R. Also, $$\mathfrak{p}_1$$ has height one by Krull's principal ideal theorem and $$\mathfrak{p}_2$$ has height two since $$\mathfrak{m}_R[t] \subsetneq \mathfrak{p}_2$$. Consequently,
 * $$\operatorname{codim}(\mathfrak{p}_1, X) = 1, \, \operatorname{codim}(\mathfrak{p}_2, X) = 2,$$
 * while X is irreducible.

Equidimensional scheme
An equidimensional scheme (or, pure dimensional scheme) is a scheme all of whose irreducible components are of the same dimension (implicitly assuming the dimensions are all well-defined).

Examples
All irreducible schemes are equidimensional.

In affine space, the union of a line and a point not on the line is not equidimensional. In general, if two closed subschemes of some scheme, neither containing the other, have unequal dimensions, then their union is not equidimensional.

If a scheme is smooth (for instance, étale) over Spec k for some field k, then every connected component (which is then in fact an irreducible component), is equidimensional.

Relative dimension
Let $$f: X\rightarrow Y$$ be a morphism locally of finite type between two schemes $$X$$ and $$Y$$. The relative dimension of $$f$$ at a point $$y \in Y$$ is the dimension of the fiber $$f^{-1} (y)$$. If all the nonempty fibers are purely of the same dimension $$n$$, then one says that $$f$$ is of relative dimension $$n$$.