TITLE: Definition of a morphism of locally ringed spaces
QUESTION [8 upvotes]: Let $(X, \mathcal O_X), (Y, \mathcal O_Y)$ be locally ringed spaces.  A morphism of ringed spaces is defined to be a pair $(f,f^{\#}):(X, \mathcal O_X) \rightarrow (Y, \mathcal O_Y)$, where $f:X \rightarrow Y$ is continuous, and $f^{\#}: \mathcal O_Y \rightarrow f_{\ast} \mathcal O_X$ is a morphism of sheaves.  We consider $(f,f^{\#})$ to also be a morphism of locally ringed spaces if for each $x \in X$, the homomorphism on the stalks $$f_x^{\#}: \mathcal O_{Y,f(x)} \rightarrow \mathcal O_{X,x}$$ is a local homomorphism (preimage of the unique maximal ideal remains maximal).  My question is, what exactly is the map $f_{x}^{\#}$?  I know since $f^{\#}$ is a morphism of sheaves, we have a homomorphism on the stalks $$f_{f(x)}^{\#}: \mathcal O_{Y,f(x)} \rightarrow (f_{\ast} \mathcal O_X)_{f(x)}$$ Are we getting $f_x^{\#}$ by composing $f_{f(x)}^{\#}$ with some homomorphism $(f_{\ast} \mathcal O_X)_{f(x)} \rightarrow \mathcal O_{X,x}$?

REPLY [2 votes]: There is another way to describe $f^{\#}_x: \mathcal{O}_{Y,f(x)}\rightarrow \mathcal{O}_{X,x}$
Let $(X, \mathcal{O}_X)$ and $(Y,\mathcal {O}_Y)$ be two schemes. 
A map between  between $(X, \mathcal{O}_X)$ and $(Y,\mathcal {O}_Y)$  is a pair 
1)$f:X\rightarrow Y$ and 
2)$f^{\#}:\mathcal{O}_Y\rightarrow f_{*}\mathcal{O}_X$
such that the induced map  $f_x^{\#}: \mathcal O_{Y,f(x)} \rightarrow \mathcal O_{X,x}$ is a local homomorphism of rings.
Let us try to write down the induced map-
Note, $\mathcal{O}_{Y,f(x)}=\varinjlim_{ f(x)\in V}\mathcal{O}_Y(V)$
Now by 2) we have map $f^{\#} (V):\mathcal{O}_Y(V)\rightarrow f_{*}\mathcal{O}_X(V)=\mathcal {O}_X(f^{-1}(V))$
Now, as $f(x)\in V \implies x\in f^{-1}(V)$. Therefore, there exist maps $g_x(f^{-1}(V)):\mathcal {O}_X(f^{-1}(V))\rightarrow \mathcal{O}_{X,x}$ (property of direct limit)
Therefore the composition of this two maps 
$\mathcal{O}_Y(V)\xrightarrow{f^{\#} (V)}\mathcal {O}_X(f^{-1}(V))\xrightarrow{g_x(f^{-1}(V))} \mathcal{O}_{X.x}$
Now, by the universal property of direct limit of $\mathcal{O}_{Y,f(x)}$ one gets an induced map from $\mathcal{O}_{Y,f(x)}\rightarrow \mathcal{O}_{X,x}$ which is the desired map $f^{\#}_x$ which we need to be local ring homomoorphsim

Universal Property of direct limit cum definition: Let $\{M_\lambda, f_{\lambda \mu}\}_{\lambda \in I}$ where $f_{\lambda \mu}:M_\lambda \rightarrow M_\mu$ for all $\lambda \leq \mu$ be a directed system of rings. A ring $M$ is said to be the directed limit of the directed system if 

There exists maps $g_{\lambda}:M_\lambda \rightarrow M$ for all $\lambda\in I$ such that $g_\lambda=g_\mu \circ f_{\lambda \mu}$ for all $\lambda\leq \mu$
If there exists another ring $M'$ with maps $g'_{\lambda}:M_\lambda \rightarrow M'$ for all $\lambda\in I$ such that $g'_\lambda=g'_\mu \circ f_{\lambda \mu}$ for all $\lambda\leq \mu$

Then there exists a unique map from $M\rightarrow M'$