Suppose that the map $f$ in the following diagram is a separated morphism (i.e. $\Delta_{X/S}:X\rightarrow X\times_{S}X$ is a closed immersion). I want to prove that $p_{2}$ is also a separated morphism. $$\require{AMScd}$$ \begin{CD} X\times_{S}Y @>{p_{1}}>> X\\ @VV{p_{2}}V @VV{f}V\\ Y @>{h}>> S \end{CD} To prove that $p_{2}$ is also separated we have to show that the diagonal morphism $\Delta_{X\times_{S}Y/Y}: X\times_{S}Y\rightarrow (X\times_{S}Y)\times_{Y}(X\times_{S}Y)$ is a closed immersion.
My strategy was to construct a cartesian diagram containing the $\Delta_{X/S}$ and $\Delta_{X\times_{S}Y/X}$ and use the fact that closed immersions are stable under base change, i.e. if we have a cartesian diagram $$\require{AMScd}$$ \begin{CD} Z @>>> Y\\ @VVV @VVV\\ X @>>> S \end{CD} such that $X\rightarrow S$ is a closed immersion, then also $Z\rightarrow Y$ is a closed immersion.
Unfortunately I couldn't find such a cartesian diagram.