3 added 689 characters in body

EDIT: So here is a direct construction of the homomorphism $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \Delta^{-1} \mathcal{O}_{X \times_S X}$:

Let $p_1,p_2$ be the projections $X \times_S X \to X$. Then we have for $i=1,2$ the homomorphism

$\mathcal{O}_X \to {p_i}_* \mathcal{O}_{X \times_S X} \to {p_i}_* \Delta_* \Delta^{-1} \mathcal{O}_{X \times_S X} = (p_i \Delta)_* \Delta^{-1} \mathcal{O}_{X \times_S X} = \Delta^{-1} \mathcal{O}_{X \times_S X}$,

and they commute over $f^{-1} \mathcal{O}_S$. Thus we get the desired homomorphism. But I think stalks are convenient when we want to show that this is an isomorphism when modding out the ideals.

2 added 58 characters in body

The statement holds in general if $f : X \to S$ is a morphism of locally ringed spaces. The fibred product of locally ringed spaces can be constructed explicitly without gluing constructions, and also restricts to the fibred product of schemes. See this article (german; shall I translate it?) for details. I will make use of the explicit description given herethere. Also I use stalks all over the place. Probably this is not the most elegant proof, but it works.

First we construct a homomorphism $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \Delta^{-1} \mathcal{O}_{X \times_S X}$. For that we compute the stalks at some point $x \in X$ lying over $s \in S$:

$(\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X)_x = \mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x},$

$(\Delta^{-1} \mathcal{O}_{X \times_S X})_x = \mathcal{O}_{X \times_S X,\Delta(x)} = (\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x})_{\mathfrak{q}}$,

where $\mathfrak{q}$ is the kernel of the canonical homomorphism

$\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x} \to \kappa(x), a \otimes b \mapsto \overline{ab}.$

Thus we get, at least, homomorphisms between the stalks (namely localizations). In order to get sheaf homomorphisms out of them, the following easy lemma is useful:

(*) Let $F,G$ be sheaves on a topological space $X$ and for every $x \in X$ let $s_x : F_x \to G_x$ be a homomorphism. Suppose that they fit together in the sense that for every open $U$, every section $f \in F(U)$ and every $x \in U$ there is some open neighborhood $x \in W \subseteq U$ and some section $g \in G(W)$ such that $s_y$ maps $f_y$ to $g_y$ for all $y \in W$. Then there is a sheaf homomorphism $s : F \to G$ inducing $s$.

This can be applied in the above situation: Every section in a neighborhood of $x$ in $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X$ induced by an element in $\mathcal{O}_X(U) \otimes_{\mathcal{O}_S(V)} \mathcal{O}_X(U)$ for some neighborhoods $U$ of $x$ and $V$ of $s$ such that $U \subseteq f^{-1}(V)$. This yields a section in $\mathcal{O}_{X \times_S X}$ on the basic-open subset $\Omega(U,U,V;1)=U \times_V U$ and thus a section of $\Delta^{-1} \mathcal{O}_{X \times_S X}$ on $U$. It is easily seen, that this construction yields the natural map on the stalks.

Thus we have a homomorphism $\alpha : \mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \Delta^{-1} \mathcal{O}_{X \times_S X}$. Now let $J$ be the kernel of the multiplication map $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \mathcal{O}_X$ and $I$ be the kernel of the homomorphism $\Delta^\# : \Delta^{-1} \mathcal{O}_{X \times_S X} \to \mathcal{O}_X$. Then for every $n \geq 1$ our $\alpha$ restricts to a homomorphism

$(\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X)/J^n \to (\Delta^{-1} \mathcal{O}_{X \times_S X})/I^n,$

which is given at $x \in X$ by the natural map

$(\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^n \to ((\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^n)_{\mathfrak{q}}$,

where $\mathfrak{p} \subseteq \mathfrak{q}$ is the kernel of the multiplication map $\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x} \to \mathcal{O}_{X,x}$.

We want to show that this map is an isomorphism, i.e. that the localization at $\mathfrak{q}$ is not needed. For that it is enough to show that every element in $\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}$, whose image in $\mathcal{O}_{X,x}$ is invertible, is invertible modulo $\mathfrak{p}^n$. Or in other mapswords: Preimages of units are units with respect to the projection

$(\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^n \to (\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^1 \cong \mathcal{O}_{X,x}$.

However, this follows from the observation that the kernel $\mathfrak{p}^1 / \mathfrak{p}^n$ is nilpotent; cf. also this question.

I'm sure that there is also a proof which avoids stalks at all.

1

The statement holds in general if $f : X \to S$ is a morphism of locally ringed spaces. The fibred product of locally ringed spaces can be constructed explicitly without gluing constructions, and also restricts to the fibred product of schemes. See this article for details. I will make use of the explicit description given here. Also I use stalks all over the place. Probably this is not the most elegant proof, but it works.

First we construct a homomorphism $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \Delta^{-1} \mathcal{O}_{X \times_S X}$. For that we compute the stalks at some point $x \in X$ lying over $s \in S$:

$(\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X)_x = \mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x},$

$(\Delta^{-1} \mathcal{O}_{X \times_S X})_x = \mathcal{O}_{X \times_S X,\Delta(x)} = (\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x})_{\mathfrak{q}}$,

where $\mathfrak{q}$ is the kernel of the canonical homomorphism

$\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x} \to \kappa(x), a \otimes b \mapsto \overline{ab}.$

Thus we get, at least, homomorphisms between the stalks. In order to get sheaf homomorphisms out of them, the following easy lemma is useful

(*) Let $F,G$ be sheaves on a topological space $X$ and for every $x \in X$ let $s_x : F_x \to G_x$ be a homomorphism. Suppose that they fit together in the sense that for every open $U$, every section $f \in F(U)$ and every $x \in U$ there is some open neighborhood $x \in W \subseteq U$ and some section $g \in G(W)$ such that $s_y$ maps $f_y$ to $g_y$ for all $y \in W$. Then there is a sheaf homomorphism $s : F \to G$ inducing $s$.

This can be applied in the above situation: Every section in a neighborhood of $x$ in $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X$ induced by an element in $\mathcal{O}_X(U) \otimes_{\mathcal{O}_S(V)} \mathcal{O}_X(U)$ for some neighborhoods $U$ of $x$ and $V$ of $s$ such that $U \subseteq f^{-1}(V)$. This yields a section in $\mathcal{O}_{X \times_S X}$ on the basic-open subset $\Omega(U,U,V;1)=U \times_V U$ and thus a section of $\Delta^{-1} \mathcal{O}_{X \times_S X}$ on $U$. It is easily seen, that this construction yields the natural map on the stalks.

Thus we have a homomorphism $\alpha : \mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \Delta^{-1} \mathcal{O}_{X \times_S X}$. Now let $J$ be the kernel of the multiplication map $\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X \to \mathcal{O}_X$ and $I$ be the kernel of the homomorphism $\Delta^\# : \Delta^{-1} \mathcal{O}_{X \times_S X} \to \mathcal{O}_X$. Then for every $n \geq 1$ our $\alpha$ restricts to a homomorphism

$(\mathcal{O}_X \otimes_{f^{-1} \mathcal{O}_S} \mathcal{O}_X)/J^n \to (\Delta^{-1} \mathcal{O}_{X \times_S X})/I^n,$

which is given at $x \in X$ by the natural map

$(\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^n \to ((\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^n)_{\mathfrak{q}}$,

where $\mathfrak{p} \subseteq \mathfrak{q}$ is the kernel of the multiplication map $\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x} \to \mathcal{O}_{X,x}$.

We want to show that this map is an isomorphism, i.e. that the localization at $\mathfrak{q}$ is not needed. For that it is enough to show that every element in $\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}$, whose image in $\mathcal{O}_{X,x}$ is invertible, is invertible modulo $\mathfrak{p}^n$. Or in other maps: Preimages of units are units with respect to the projection

$(\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^n \to (\mathcal{O}_{X,x} \otimes_{\mathcal{O}_{S,s}} \mathcal{O}_{X,x}) / \mathfrak{p}^1 \cong \mathcal{O}_{X,x}$.

However, this follows from the observation that the kernel $\mathfrak{p}^1 / \mathfrak{p}^n$ is nilpotent; cf. also this question.

I'm sure that there is also a proof which avoids stalks at all.