Diagonal morphism (algebraic geometry)

In algebraic geometry, given a morphism of schemes $$p: X \to S$$, the diagonal morphism
 * $$\delta: X \to X \times_S X$$

is a morphism determined by the universal property of the fiber product $$X \times_S X$$ of p and p applied to the identity $$1_X : X \to X$$ and the identity $$1_X$$.

It is a special case of a graph morphism: given a morphism $$f: X \to Y$$ over S, the graph morphism of it is $$X \to X \times_S Y$$ induced by $$f$$ and the identity $$1_X$$. The diagonal embedding is the graph morphism of $$1_X$$.

By definition, X is a separated scheme over S ($$p: X \to S$$ is a separated morphism) if the diagonal morphism is a closed immersion. Also, a morphism $$p: X \to S$$ locally of finite presentation is an unramified morphism if and only if the diagonal embedding is an open immersion.

Explanation
As an example, consider an algebraic variety over an algebraically closed field k and $$p: X \to \operatorname{Spec}(k)$$ the structure map. Then, identifying X with the set of its k-rational points, $$X \times_k X = \{ (x, y) \in X \times X \}$$ and $$\delta: X \to X \times_k X$$ is given as $$x \mapsto (x, x)$$; whence the name diagonal morphism.

Separated morphism
A separated morphism is a morphism $$ f $$ such that the fiber product of $$ f $$ with itself along $$ f $$ has its diagonal as a closed subscheme &mdash; in other words, the diagonal morphism is a closed immersion.

As a consequence, a scheme $$ X $$ is separated when the diagonal of $$ X $$ within the scheme product of $$ X $$ with itself is a closed immersion. Emphasizing the relative point of view, one might equivalently define a scheme to be separated if the unique morphism $$X \rightarrow \textrm{Spec} (\mathbb{Z})$$ is separated.

Notice that a topological space Y is Hausdorff iff the diagonal embedding
 * $$Y \stackrel{\Delta}{\longrightarrow} Y \times Y, \, y \mapsto (y, y)$$

is closed. In algebraic geometry, the above formulation is used because a scheme which is a Hausdorff space is necessarily empty or zero-dimensional. The difference between the topological and algebro-geometric context comes from the topological structure of the fiber product (in the category of schemes) $$X \times_{\textrm{Spec} (\mathbb{Z})} X$$, which is different from the product of topological spaces.

Any affine scheme Spec A is separated, because the diagonal corresponds to the surjective map of rings (hence is a closed immersion of schemes):
 * $$A \otimes_{\mathbb Z} A \rightarrow A, a \otimes a' \mapsto a \cdot a'$$.

Let $$S$$ be a scheme obtained by identifying two affine lines through the identity map except at the origins (see gluing scheme). It is not separated. Indeed, the image of the diagonal morphism $$S \to S \times S$$ image has two origins, while its closure contains four origins.

Use in intersection theory
A classic way to define the intersection product of algebraic cycles $$A, B$$ on a smooth variety X is by intersecting (restricting) their cartesian product with (to) the diagonal: precisely,
 * $$A \cdot B = \delta^*(A \times B)$$

where $$\delta^*$$ is the pullback along the diagonal embedding $$\delta: X \to X \times X$$.