Let the structure maps of $X$ and $Y$ as $S$-schemes be $u$ and $v$, respectively, so that $u=v\circ f$.
As mentioned in the comments, we want to check
$$\require{AMScd}
\begin{CD}
X @>{\Gamma_f}>> X\times_SY\\
@V{f}VV @V{f\times Y}VV \\
Y @>{\Delta_Y}>> Y\times_SY
\end{CD}$$
is a fibered product. We may check this locally [the commuting diagram produces a morphism of schemes $X\to Y\times_{Y\times_SY}(X\times_SY)$, and we may check this is an isomorphism locally], so let $U=\mathrm{Spec} R\subset S$ be an affine open set, $W=\mathrm{Spec} B\subset v^{-1}(U)\subset Y$, and $V=\mathrm{Spec} A\subset f^{-1}(W)\subset X$. Now the diagram solely consists of affine schemes:
$$\require{AMScd}
\begin{CD}
V @>{\Gamma_{f|_V}}>> V\times_UW\\
@V{f|_V}VV @V{f|_V\times W}VV \\
W @>{\Delta_Y}>> W\times_UW
\end{CD}$$
Suppose $f\colon V\to W$ is given by $\varphi\colon B\to A$. Then in the category of commutative rings the diagram becomes:
$$\require{AMScd}
\begin{CD}
A @<{\gamma}<< A\otimes_RB\\
@A{\varphi}AA @A{\varphi\otimes B}AA \\
B @<{\delta}<< B\otimes_RB
\end{CD}$$
where $\gamma(a\otimes b):=a\varphi(b)$ and $\delta(b_1\otimes b_2)=b_1b_2$. Now following the diagram gives $$\varphi\circ\delta(b_1\otimes b_2)=\varphi(b_1b_2)=\varphi(b_1)\cdot\varphi(b_2)=\gamma(\varphi(b_1)\otimes b_2)=\gamma\circ(\varphi\otimes B)(b_1\otimes b_2),$$
so it indeed commutes.
To show this is a pullback diagram: We want to show $A\cong B\otimes_{B\otimes_RB}(A\otimes_RB)$. We have maps:
$$A\to B\otimes_{B\otimes_RB}(A\otimes_RB):a\mapsto1\otimes(a\otimes1)$$
and
$$B\otimes_{B\otimes_RB}(A\otimes_RB)\to A:b_1\otimes(a\otimes b_2)\mapsto \varphi(b_1b_2)a.$$
There are a couple of things to check here:
- That the second map is well-defined: Check that $B\times(A\otimes_RB)\to A:(b_1,a\otimes b_2)\mapsto \varphi(b_1b_2)a$ is a well-defined $B\otimes_RB$-bilinear map.
- That these maps are inverses of each other. One composition is obvious: $a\mapsto 1\otimes(a\otimes 1)\mapsto a$. The other direction is:
\begin{align*}1\otimes(\varphi(b_1b_2)a\otimes 1)&=1\otimes\big((b_1b_2\otimes1)\cdot(a\otimes 1)\big)\\
&=\big((b_1b_2\otimes1)\cdot1\big)\otimes(a\otimes 1)\\
&=b_1b_2\otimes(a\otimes 1)\\
&=\big((1\otimes b_2)\cdot b_1\big)\otimes(a\otimes 1)\\
&=b_1\otimes\big((1\otimes b_2)\cdot(a\otimes 1)\big)\\
&=b_1\otimes(a\otimes b_2).
\end{align*}
$$ \require{AMScd} \begin{CD} X @>\Gamma_f >> Y\times_S X \ @VVfV @VV(id,f)V \ Y @>\Delta>> X \times_S Y \end{CD} $$
Is it that what you mean? If yes, why does if prove the claim? Is $(id,f)$ closed immersion?
– user267839 Apr 13 '18 at 21:40