If restricted morphism of ringed spaces are equal, then they are actually equal Given any two ringed spaces $(X, \mathcal O_X)$ and $(Y, \mathcal O_Y)$, let $\{ U_\lambda\}_{\lambda \in \Lambda}$ be an open covering of the topological space $X$. If $$f,g: (X, \mathcal O_X) \to (Y, \mathcal O_Y)$$ are morphism of ringed spaces such that $$f|_{\lambda} = g|_{\lambda}, \ \forall \lambda \in \Lambda,$$ then prove that $$f=g.$$
I'm stuck after writing definitions in detail. Any help or hint will be appreciated.
 A: First, I should hope its clear that if two maps of topological spaces agree on an open cover then they are equal (since maps of topological spaces are functions, so if they agree on any cover of their domain, they are equal as functions).
Thus the key part is to show that $f^\sharp=g^\sharp$ as morphisms from $\newcommand\calO{\mathcal{O}}\calO_Y\to f_*\calO_X=g_*\calO_X$.
Let $V$ be an open subset of $Y$. Let $a\in\calO_Y(V)$. Let $\newcommand\inv{^{-1}}U=f\inv(V)=g\inv(V)$. Then $f^\sharp(a),g^\sharp(a)\in \calO_X(U)$ by definition. Then $\{U_\lambda\cap U\}_{\lambda\in\Lambda}$ gives an open cover of $U$, and since $f|_{U_\lambda}=g|_{U_\lambda}$, we have that $f^\sharp(a)|_{U\cap U_\lambda}=g^\sharp(a)|_{U\cap U_\lambda}$. Then since $f^\sharp(a)$ and $g^\sharp(a)$ are equal on an open cover of $U$, we must have that $f^\sharp(a)=g^\sharp(a)$ since $\calO_X$ is a sheaf. Thus since $a$ and $V$ were arbitrary, $f^\sharp=g^\sharp$.
Edit in response to comment:
To clarify why $f^\sharp(a)$ agreeing with $g^\sharp(a)$ on an open cover of $U$ implies that they are equal, this is one of the axioms of sheaves. On wiki, this is the locality axiom. The axiom says that if $F$ is a sheaf, and $a,b\in F(U)$, and $\{U_i\}$ is a cover of $U$, then if $a|_{U_i}=b|_{U_i}$ for all $i$, then $a=b$.
