Is this a closed embedding of schemes? Let $X$, $Y$ be two schemes and $f$ be morphism from $Y$ to $X$. Now, consider the corresponding morphism $Y \times_{X} Y$ to $ Y \times Y$. Is this a closed embedding?
 A: If $X$ is separated over $\newcommand{\ZZ}{\mathbb{Z}}\newcommand{\Spec}{\operatorname{Spec}}\Spec\ZZ$, then yes.
Proof:
The following is a pullback diagram (see Vakil's notes, pg. 37, Ex 1.3.S):
$$\require{AMScd}
\begin{CD}
Y\times_X Y @>>> Y\times_{\Spec\ZZ}Y\\
@VVV @VVV\\
X @>>> X\times_{\Spec\ZZ}X\\
\end{CD}
$$
If $X$ is separated over $\Spec\ZZ$, then the bottom morphism is a closed immersion. Then since the base change of a closed immersion is a closed immersion, $Y\times_X Y\to Y\times_{\Spec \ZZ}Y$ is a closed immmersion.
Edit: As Marc Paul pointed out below, if $X$ is not separated over $\Spec\ZZ$, then if $Y=X$ and $f=\textrm{id}_X$, then the map $Y\times_X Y\to Y\times_{\Spec\ZZ} Y$ is just the map $X\to X\times_{\Spec\ZZ} X$, which is the diagonal map. By the assumption that $X$ is not separated over $\Spec\ZZ$, this is not a closed embedding.
For more on the general form of the pullback diagram above, see this nice MO answer.
Edit: in response to the further question below as to whether the map $Y\times_X Y\to Y\times_{\Spec\ZZ} Y$ is always a monomorphism, the answer is yes. In fact to be more precise, the map is always a locally closed immersion.
Proof: The morphism $X\to X\times_{\Spec\ZZ} X$ is always a locally closed immersion. For a justification, see the Stacks project. Locally closed immersions are preserved under base change, so $Y\times_X Y\to Y\times_{\Spec\ZZ} Y$ is a locally closed immersion. Finally immersions are monomorphisms.
