subscheme where two morphisms agree is points where they agree on residue fields Let $X, Y, Z$ be schemes, where $X, Y$ are $Z$ schemes.  I know the definition of "the locally closed subscheme of $X$ where two $Z$-  morphisms $\pi, \pi': X\rightarrow Y$ agree" from its universal property.  Also I can define it as the fiber product of the diagonal $$\delta :  Y\rightarrow Y\times_Z Y$$ with $$(\pi, \pi'): X\rightarrow Y\times_Z Y.$$
My question:  how to prove that the underlying set of "the locally closed subscheme where the two morphisms agree" is the same as the set of points where the two morphism agree on the residue field.
It is probably clear thatthe former is contained in the latter, but why is it all of them?  That is, why is a point where $\pi, \pi'$ agree on the residue field necessarily contained in "the subscheme where $\pi, \pi'$ agree"?
 A: Let "the set where the morphisms agree" be called $A$ and the fiber product $X\times_{Y\times_Z Y} Y$ be called $V$. Our goal is to show the underlying sets are equal. You state in your post that you are ok with $V\subset A$ set-theoretically (where we fudge things a little and identify $V$ with it's image under the immersion $V\to X$).
To show that $V=A$ set theoretically, it is enough to show that if $a\in A$, the fiber $V \times_X \operatorname{Spec} k(a)$ is nonempty. To start, we define the maps $i:\operatorname{Spec} k(a)\to X$ given by the standard inclusion and $j:\operatorname{Spec} k(a)\to Y$ given by $j((0))=f(a)$ as sets and $j^\sharp:\mathcal{O}_Y \to j_*\mathcal{O}_{\operatorname{Spec} k(a)}$ is given by $\mathcal{O}_Y(U)\to \mathcal{O}_{Y,f(a)} \to k(f(a)) \to k(a)$ if $a\in U$ and $0$ otherwise. As $i$ and $j$ agree when composed with the maps to $Y\times_ZY$, this gives a map $\operatorname{Spec} k(a)\to V$ so that the composite of this map with the natural projections $V\to X$ and $V\to Y$ agree with $i$ and $j$ by the universal property of the fiber product. But this means that there's a point of $V$ which maps to $a$ and we're done.
A: Disclaimer: I have just finished this section in Vakil myself, so I am happy to be corrected by more experienced AGers.
Claim (see the discussion above Vakil 10.2 B): The set of points where two morphisms of $Z$-schemes $\pi, \pi' : X \to Y$ agree is the set of point on which those morphisms agree (on the level of points) and on induced maps of residue fields.
Let $\pi^{\#}_x$ and $\pi'^{\#}_x$ denote the maps of residue fields at $x \in X$ induced by $\pi$ and $\pi'$, respectively. By the universal property of the locus where two schemes agree, we must show
$$X \times_{Y \times_Z Y} Y$$
is in bijective correspondence as a set to
$$\{x \in X \ | \ \pi(x) = \pi'(x), \pi^{\#}_x  =\pi'^{\#}_x \}$$
Recall that points of $$X \times_{Y \times_Z Y} Y$$ are in bijective correspondence with tuples $(x, y, z, P)$ such that $\delta(y) = (y, y) = (\pi, \pi')(x) = z$ and $P \subset \kappa(x) \otimes_{\kappa(z)} \kappa(y)$ is prime. See Stacks Project, Lemma 26.17.5.
Clearly it is necessary that $\pi(x) = \pi'(x)$ for these conditions to be satisfied.
Now, again by Lemma 26.17.5, primes $P \subset \kappa(x) \otimes_{\kappa(z)} \kappa(y)$ have $\kappa(P)$ corresponding to $\kappa(z) = \kappa(\pi(x), \pi(x)) = \kappa(\pi'(x), \pi'(x))$ in the lower right corner of the tensor product diagram.
But $\kappa(P)$ then corresponds to the diagonal map $\kappa(y) = \kappa(\pi(x)) = \kappa(\pi'(x)) \to \kappa(x)$ found in the tensor product diagram. Hence, given such a prime, since $z$ is both $(\pi(x), \pi(x))$ and $(\pi'(x), \pi'(x))$, this diagonal map is both the map $\pi^{\#}_x$ and $\pi'^{\#}_x$, and so they are the same map.
A: An alternative  to the excellent accepted answer: If $\pi, \pi'$ agree at $ p$ let $ \varphi: Spec(\kappa(p))\rightarrow X.$ Then $ \pi \circ \varphi=\pi'\circ \varphi$ thus $ \varphi$ factors through the scheme where $\pi, \pi'$ agree. Thus $ p$ is in the latter.
