This question is somewhat related to a previous question of mine, but appeared in a different context.
Suppose given two morphisms of $S$-schemes $f,g:X \to Y$. Intuitively, I am interested on the locus of points of $X$ in which these two morphisms coincide. A schematic approach to that, would be to consider $Z$ as the pullback of the diagonal $\Delta: Y \to Y\times_S Y$ by the morphism $(f,g): X \to Y\times_S Y$.
Then, for example, if $Y\to S$ is separated ("Hausdorff"), then $Z \to X$ is a closed immersion, which makes sense.
Also, the composition of $Z \to X$ with $f$ and $g$ are the same (by the commutativity of the cartesian diagram defining $Z$). Hence, I would expect that the scheme $Z$ is what I'm searching.
But one could also take a naive, set-theoretic, approach (which we know is usually inappropriate when dealing with schemes) and define the set $A=\{x\in X \mid f(x)=g(x)\}$.
My question is: what is the relation between $Z$ and $A$?
The most strange thing is that $A$ can be empty, but $Z$ seems to be always well defined. In this case (when $A$ is empty), how this information is "captured" in the scheme $Z$?