Image of the diagonal map in a scheme My question is similar to the question in The image of the diagonal map in scheme. I saw a hint to my question in the comments, but I was not able to prove it. 
Let $f:X\longrightarrow Y$ is a morphism of schemes. Let $T$ be a scheme and $h:T\longrightarrow X\times_Y X$ be a morphism such that $p_1\circ h=p_2\circ h$, where $p_1,p_2$ are projection morphisms from $X\times_Y X\longrightarrow X$. Then is it true that $h(T)\subset\Delta(X)$?
I initially tried proving that if $x\in X\times_Y X$ such that $p_1(x)=p_2(x)$, then $x\in\Delta(X)$. But that I think is not true, and I am going nowhere. I will be help if someone can tell me how to prove it.
 A: Don't work with elements, work with morphisms. This general lesson of category theory is also very useful for algebraic geometry.
Let $g := p_1 h = p_2 h : T \to X$. Then $h$ is equal to $T \xrightarrow{g} X \xrightarrow{\Delta} X \times_Y X$, since $p_i \Delta g = g = p_i h$. Hence, $h$ factors through $\Delta$.
By the way, you are right with your guess that $z \in X \times_Y X$ with $x:=p_1(z)=p_2(z)$ doesn't imply that $z \in \Delta(X)$. We also need that $(p_1^\#)_z : \mathcal{O}_{X,x} \to \mathcal{O}_{X \times_Y X,z}  $ is equal to  $(p_2^\#)_z : \mathcal{O}_{X,x} \to \mathcal{O}_{X \times_Y X,z}$. For example, let $X=\mathrm{Spec}(L)$ and $Y=\mathrm{Spec}(K)$ for a field extension $L/K$. Then $p_1(z)=p_2(z)$ is a vacuous condition! The image of $\Delta : \mathrm{Spec}(L) \to \mathrm{Spec}(L \otimes_K L)$ has just one element corresponding to the kernel of the multiplication $L \otimes_K L \to L$, but $L \otimes_K L$ usually has more prime ideals (if $L$ is simple over $K$, say $L=K[x]/(f)$, then $L \otimes_K L = L[x]/(f)$ and the prime ideals of $L \otimes_K L$ correspond to the irreducible factors of $f$ over $L$).
