if $f$ and $g$ compose with a dominant morphism are the same, show that they agrees on a open dense subset as morphisms of schemes To be specific about my question, let $A$ be a valuation ring (so local and integral) and $K$ be the fraction field of $A$.
The injection $A\rightarrow K$ induces $i: \mathrm{Spec} \ K\rightarrow\mathrm{Spec}\ A$. Clearly the image (the zero ideal) is dense.
Let $X$ be a scheme over $A$, and $f,g:\mathrm{Spec}\ A\rightarrow X$ be two morphisms of $A$-schemes s.t. $f\circ i=g\circ i$.
We want to show that there exists a non-empty open dense subset $U$ of $\mathrm{Spec}\ A$ s.t. $f|_U=g|_U$ as morphisms of schemes.
Does it hold for more general case, where $i$ is any dominant morphism?
 A: I figured out the proof for my specific case.
Denote $l=f\circ i=g\circ i$. Denote $s$ as the unique point of $\mathrm{Spec} K$.
Let $\mathrm{Spec}\ B$ be an affine open subset of $X$ containing $l(s)$. So $l^{-1}(\mathrm{Spec}\ B)\ne \emptyset$, we can further deduce that $l^{-1}(\mathrm{Spec}\ B)=\mathrm{Spec}\ K$, and similarly $f^{-1}(\mathrm{Spec}\ B)\ne \emptyset$ and $g^{-1}(\mathrm{Spec}\ B)\ne \emptyset$.
Since $A$ is an integral domain, $\mathrm{Spec}\ A$ is integral (i.e. reduced and irreducible). In particular, every non-empty open subset is dense and every pair of non-empty open subset have non-empty intersection.
Apply it to $f^{-1}(\mathrm{Spec}\ B)$ and $g^{-1}(\mathrm{Spec}\ B)$, we have that $\emptyset \ne f^{-1}(\mathrm{Spec}\ B)\cap g^{-1}(\mathrm{Spec}\ B)\subset \mathrm{Spec}\ A$. Since principal open sets form a base, assume $D(t)=\mathrm{Spec}\ A_t\subset f^{-1}(\mathrm{Spec}\ B)\cap g^{-1}(\mathrm{Spec}\ B)$ for some $t\in A\backslash \{0\}$.
This $D(t)$ is our potential candidate of dense open subset. Since $t\notin (0)$, the image (the zero ideal) lies in $D(t)$, hence the map $i:\mathrm{Spec}\ K \rightarrow \mathrm{Spec}\ A$ does factor through $D(t)$.
Note that $l^{-1}(\mathrm{Spec}\ B)=i^{-1}f^{-1}(\mathrm{Spec}\ B)=i^{-1}g^{-1}(\mathrm{Spec}\ B)$
Now $l|_{l^{-1}(\mathrm{Spec}\ B)}=f|_{f^{-1}(\mathrm{Spec}\ B)}\circ i|_{i^{-1}f^{-1}(\mathrm{Spec}\ B)}=g|_{g^{-1}(\mathrm{Spec}\ B)}\circ i|_{i^{-1}g^{-1}(\mathrm{Spec}\ B)}$.
Consider the following diagram (commutes in every square)
$\require{AMScd}$
\begin{CD}
    @.f^{-1}(\mathrm{Spec}\ B)@= f^{-1}(\mathrm{Spec}\ B)@>f|_{f^{-1}(\mathrm{Spec}\ B)}  >>\mathrm{Spec}\ B\\
    @. @AA inclu_1 A@VV inclu_3 V@VVV\\
    \mathrm{Spec}\ K @>i'>> \mathrm{Spec}\ A_t@>inclu_5 >> \mathrm{Spec}\ A@.X\\
    @. @VV inclu_2 V@AA inclu_4 A@AAA\\
 @.g^{-1}(\mathrm{Spec}\ B)@= g^{-1}(\mathrm{Spec}\ B)@>g|_{g^{-1}(\mathrm{Spec}\ B)}  >>\mathrm{Spec}\ B
\end{CD}
We have $i|_{i^{-1}f^{-1}(\mathrm{Spec}\ B)}=inclu_1 \circ i'$ and $i|_{i^{-1}g^{-1}(\mathrm{Spec}\ B)}=inclu_2 \circ i'$. Hence
$$l|_{l^{-1}(\mathrm{Spec}\ B)}=f|_{f^{-1}(\mathrm{Spec}\ B)}\circ inclu_1 \circ i'=g|_{g^{-1}(\mathrm{Spec}\ B)}\circ inclu_2 \circ i'$$
Furthermore we have
$$f|_{\mathrm{Spec}\ A_t} \circ i'=g|_{\mathrm{Spec}\ A_t} \circ i'$$
Let $\phi_f ,\phi_g:B\rightarrow A_t,\ \phi_{i'}:A_t\hookrightarrow K$ be the corresponding maps on rings.
The above equality implies $\phi_{i'}\circ\phi_f=\phi_{i'}\circ\phi_g$. Since $\phi_{i'}$ is injective, we must have $\phi_f=\phi_g$, which implies $f|_{\mathrm{Spec}\ A_t}=g|_{\mathrm{Spec}\ A_t}$. The result follows.
