The exercise 9.2.J of Ravi Vakil's notes of Algebraic Geometry is
Suppose $\pi:X\to Y$ and $\rho: X \to Y$ are morphisms of $k$-schemes, $l/k$ is a field extension, $\pi_{l}:X\times_{k}l\to Y\times_{k}l$ and $\rho_{l}:X\times_{k}l\to Y\times_{k}l$ are the same induced maps. Show that if $\pi_{l}=\rho_{l}$ then $\pi=\rho$.
Then there is a hint: using the fact that $X\times_{k}l\to X$ is surjective, then reduced the case to $X$ and $Y$ are affine.
My question is how could we reduced the case to $X$ and $Y$ are affine?
Thank you very much about your help.
The surjectivity of $X\times_k l \to X$ should be used to show that $\pi$ and $\rho$ are the same on the level of sets. For this, use the fibered diagram along with the fact that that surjective maps of sets are epimorphisms.
Once this is established, to show that $\pi$ and $\rho$ are equal as maps of schemes, we need only to show that they induce the same map on sheaves. It is enough to check this on the level of stalks. This is where we are reduced to the affine case, as to check that $\pi$ and $\rho$ induce the same map on the stalk at a point, it is enough to restrict to an open affine around that point.