Construction of an immersion of schemes using the fibered product I'm trying to understand the proof of Lemma 26.21.9. in the stack project.

*

*How does one obtain the following commutative diagram mentioned in the proof lemma?


So far I've tried to construct the following diagram



*The 3 lemmas in the proof mention well known properties stable under base change, it's not clear for me how to exploit them in the commutative diagram.

 A: It suffices to show that it satisfies the universal property of a fiber product diagram: that is, given an object $Q$ with morphisms $q_1:Q\to T$ and $q_2:Q\to X\times_S Y$ so that $\Delta_{T/S}\circ q_1=(f\times_S g)\circ q_2$ as morphisms $Q\to T\times_S T$, then there's a unique morphism $\alpha:Q\to X\times_T Y$ so that $q_1=p_1\circ \alpha$ and $q_2=p_2\circ\alpha$.
As $\Delta_{T/S}\circ q_1 =(q_1\times_S q_1)$ and $(f\times_S g)\circ q_2 = ((f\circ q_2)\times_S (g\circ q_2))$, the condition that these morphisms agree is the condition that $f\circ q_2 = g\circ q_2$ as morphisms $Q\to X\to T$ and $Q\to Y\to T$. This gives a unique map $Q\to X\times_T Y$ by the definition of the fiber product, and thus $X\times_T Y$ is the fiber product of $T\stackrel{\Delta_{T/S}}{\to} T\times_S T$ and $X\times_S Y\to T\times_S T$.
As to how one might think about this, it's instructive to give the diagram a gander in the category of sets. Then you can actually get your hands on some elements and compute what the fiber product should be: an element of $T\times_{T\times_S T} (X\times_S Y)$ is an element of $T\times X\times Y$ so that it's image under the two ways around the diagram are the same - but this is exactly the set of elements of $X\times Y$ which give the same image under the maps $X\to T$ and $Y\to T$, or $X\times_T Y$.

As to why this suffices to prove the claims:

*

*$T\to S$ separated is the fact $\Delta_{T/S}$ a closed immersion by definition, and as closed immersions are stable under base change, this implies that $X\times_T Y\to X\times_S Y$ is a closed immersion;

*$T\to S$ quasi-separated is the fact that $\Delta_{T/S}$ is quasi-compact by definition, and as quasi-compact morphisms are stable under base change, this implies that $X\times_T Y\to X\times_S Y$ is quasi-compact.

If you're struggling with what stable under base change means, here's a reminder: a property $\mathcal{P}$ of a morphism being stable under base change means that if $f:X\to Y$ has property $\mathcal{P}$ and $g:Y'\to Y$ is any morphism, then letting $X'=X\times_Y Y'$ and $f'=X'\to Y'$, then $f'$ has property $\mathcal{P}$ too.
