TITLE: The induced map on stalks is well-defined
QUESTION [9 upvotes]: $\require{AMScd}$ Let $\phi:\mathscr{F\to G}$ be a morphism of sheaves on $X$, let $\mathscr F_P$ be a stalk of $\mathscr F$ at $P\in X$, and let the stalk map $\phi_P:\mathscr F_P\to\mathscr G_P$ take the class containing $(U,f)$ to the class containing $(U,[\phi(U)(f)])$. We aim to show that this defines a function, by showing that it is well-defined. The requirement is to show that if $(U,f)\sim(V,g)$ then $(U,\phi(U)(f))\sim(V,\phi(V)(g))$. The assumption implies that there is an open set $W\subseteq U\cap V$ such that $f|_W=g|_W$. From the definition of morphism, we have commutative diagrams $$\begin{CD}
\mathscr F(U) @>\phi(U)>> \mathscr G(U)\\
@VV\rho_{UW}V @VV\rho'_{UW}V\\
\mathscr F(W) @>\phi(W)>> \mathscr G(W)
\end{CD}\qquad\qquad
\begin{CD}
\mathscr F(V) @>\phi(V)>> \mathscr G(V)\\
@VV\rho_{VW}V @VV\rho'_{VW}V\\
\mathscr F(W) @>\phi(W)>> \mathscr G(W)
\end{CD}$$
which imply $$\rho'_{UW}\circ\phi(U)=\phi(W)\circ\rho_{UW}\qquad\qquad\rho'_{VW}\circ\phi(V)=\phi(W)\circ\rho_{VW}.$$ This gives $$\phi(U)(f)|'_W=\rho'_{UW}(\phi(U)(f))=\phi(W)(\rho_{UW}(f))=\phi(W)(g|_W)$$ and $$\phi(V)(g)|'_W=\rho'_{VW}(\phi(V)(g))=\phi(W)(\rho_{VW}(g))=\phi(W)(g|_W)$$ so that $\phi(U)(f)$ agrees with $\phi(V)(g)$ on $W$ in the sheaf $\mathscr G$, and hence the well-definedness is verified.
Is this rather ugly calculation the best way of showing this simple result? More generally, do most sheaf-related problems ultimately reduce to such computations without sufficient abstraction?

REPLY [9 votes]: Let me just elaborate on what Hoot said in the comments. We can view $\mathscr{F}_{p}$ as a certain colimit, namely: 

We have a map $\theta_{U}:\mathscr{F}(U)\to \mathscr{F}_{p}$ for every open set $U\subseteq X$ containing $p$, which commutes with the restriction maps $\mathscr{F}(U)\to\mathscr{F}(V)$ for $V\subseteq U$. 
If $A$ is any abelian group (or object in whatever category your sheaf has values in) together with maps $\gamma_U:\mathscr{F}(U)\to A$ which commutes with the restriction maps, then there is a unique map $\gamma:\mathscr{F}_{p}\to A$ such that $\gamma\circ \theta_U = \gamma_U$ for every open set $U$ containing $p$. 

Now, the stalk $\mathscr{F}_{p}$ is defined as the set of equivalence classes $[(U, f)]$ where $f\in\mathscr{F}(U)$, in which we identify $(U, f)\sim (U, g)$ if there exists $W\subseteq U\cap V$ such that $f|_{W}=g|_{W}$. How do we see that $\mathscr{F}_{p}$ enjoys the universal property of the colimit? It is clear what the maps $\theta_U: \mathscr{F}(U)\to\mathscr{F}_{p}$ should be! It should send a section $f$ over $U$ to the class of $(U, f)$ in $\mathscr{F}_{p}$. This commutes with restriction maps as you can easily check. 
Now, let's check the property in the second bullet. What should be the map $\gamma: \mathscr{F}_{p} \to A$? The condition $\gamma\circ\theta_{U} = \gamma_U$ forces $\gamma([(U, f)]) = \gamma_{U}(f)$. This information also defines what $\gamma$ should be. You can immediately check that it is well-defined in a sense that if you choose a different representative $(V, g)$ for the same class (germ), you would have $\gamma_{U}(f) = \gamma_{V}(g)$. This is where you will need the fact that $\gamma_{U}$s commute with the restriction maps of the sheaf.
So we have verified that $\mathscr{F}_p$ enjoys the universal property of the colimit above. Now, suppose that $\phi: \mathscr{F}\to\mathscr{G}$ is a morphism of sheaves. Let $\gamma_U: \mathscr{F}(U)\to\mathscr{G}(U)\to \mathscr{G}_{p}$ be the composition. Then I claim that $\gamma_{U}$ commutes with the restriction maps $\rho_{U,V}:\mathscr{F}(U)\to\mathscr{F}(V)$, that is $\gamma_{V}\circ\rho_{U, V} = \gamma_{U}$. Why? Precisely because $\phi$ is a morphism of sheaves! Thus, by the universal property of the colimit, there is a unique map $\gamma:\mathscr{F}_{p}\to\mathscr{G}_{p}$ that $\gamma_{U}$ factors through. This last map is exactly the map $\mathscr{F}_{p} \to\mathscr{G}_{p}$ defined by $[(U, f)]\mapsto [(U, \phi(U)(f))]$.