**Proof.**
Assume $f$ separated. Suppose $(U, V)$ is a pair as in (1). Let $W = \mathop{\mathrm{Spec}}(R)$ be an affine open of $S$ containing both $f(U)$ and $f(V)$. Write $U = \mathop{\mathrm{Spec}}(A)$ and $V = \mathop{\mathrm{Spec}}(B)$ for $R$-algebras $A$ and $B$. By Lemma 26.17.3 we see that $U \times _ S V = U \times _ W V = \mathop{\mathrm{Spec}}(A \otimes _ R B)$ is an affine open of $X \times _ S X$. Hence, by Lemma 26.10.1 we see that $\Delta ^{-1}(U \times _ S V) \to U \times _ S V$ can be identified with $\mathop{\mathrm{Spec}}((A \otimes _ R B)/J) \to \mathop{\mathrm{Spec}}(A \otimes _ R B)$ for some ideal $J \subset A \otimes _ R B$. Thus $U \cap V = \Delta ^{-1}(U \times _ S V)$ is affine. Assertion (1)(b) holds because $A \otimes _{\mathbf{Z}} B \to (A \otimes _ R B)/J$ is surjective.

Assume the hypothesis formulated in (2) holds. Clearly the collection of affine opens $U \times _ S V$ for pairs $(U, V)$ as in (2) form an affine open covering of $X \times _ S X$ (see e.g. Lemma 26.17.4). Hence it suffices to show that each morphism $U \cap V = \Delta _{X/S}^{-1}(U \times _ S V) \to U \times _ S V$ is a closed immersion, see Lemma 26.4.2. By assumption (a) we have $U \cap V = \mathop{\mathrm{Spec}}(C)$ for some ring $C$. After choosing an affine open $W = \mathop{\mathrm{Spec}}(R)$ of $S$ into which both $U$ and $V$ map and writing $U = \mathop{\mathrm{Spec}}(A)$, $V = \mathop{\mathrm{Spec}}(B)$ we see that the assumption (b) means that the composition

\[ A \otimes _{\mathbf{Z}} B \to A \otimes _ R B \to C \]

is surjective. Hence $A \otimes _ R B \to C$ is surjective and we conclude that $\mathop{\mathrm{Spec}}(C) \to \mathop{\mathrm{Spec}}(A \otimes _ R B)$ is a closed immersion.
$\square$

## Comments (6)

Comment #2680 by sdf on

Comment #2681 by sdf on

Comment #2682 by Johan on

Comment #2768 by sdf on

Comment #8467 by ElĂas Guisado on

Comment #9084 by Stacks project on

There are also: