Why doesn't Hom commute with taking stalks?

Here's an answer to your call for examples. Take $p$ to be a non-isolated closed point in your favorite topological space $X$. Let $H$ be a non-trivial abelian group.

$Hom(F,G)_p\to Hom(F_p,G_p)$ fails to be surjective

Let $G$ be the constant sheaf $H$, and let $F$ be the skyscraper sheaf at $p$ with stalk $H$. Then $Hom(F,G)$ is the zero sheaf: any section of $F$ is trivial away from $p$, so a homomorphism would take it to a section of $G$ which is trivial away from $p$, but any section of $G$ which is trivial away from $p$ must be trivial, so every section of $F$ must be taken to the trivial section of $G$. So $Hom(F,G)_p=0$, but $Hom(F_p,G_p)=Hom(H,H)\neq 0$.

$Hom(F,G)_p\to Hom(F_p,G_p)$ fails to be injective

Let $V=X\setminus p$, and let $F=G$ be the extension by zero of the constant sheaf $H$ on $V$ (i.e. it's the constant sheaf $H$ on $V$ and $F(U)=0$ if $U\not\subseteq V$). Then $F_p=G_p=0$, but $Hom(F,G)(U)$ contains a natural copy of $Hom(H,H)\neq 0$ for any $U$, so $Hom(F,G)_p$ contains a natural copy of $Hom(H,H)\neq 0$, so it's not zero.


This bad behavior is due to the righthand coordinate of Hom not commuting with colimits (direct limits are a special type of filtered colimit, so this addresses your question), and the lefthand coordinate flips them into limits (this is a general phenomenon in category theory and follows from the definition of the limit (resp. colimit)).

I should also note that you're trying to turn two colimits into one, and I don't really see why you would expect this to work.

For instance, the following deduction is valid: $Hom(F_p,G_p)\cong Hom(colim_{p\in U}F(U),G_p)\cong lim_{p\in U}Hom(F(U),G_p)$. However, this looks like a very different mathematical object than the one you mentioned. Assuming, for the sake of argument, that $F(U)$ is finitely presented for all $U$, we can pull the colimit out front as well, but this doesn't really get us any closer to our stated goal.


Here is a somewhat abstract explanation giving a "deeper reason" for why Hom doesn't commute with taking stalks. In categorical logic, it is well known that in general, only so-called geometric constructions commute with taking inverse image under geometric morphisms. Calculating the stalk at a point is an example of such a process of taking an inverse image.

Anton's answer shows that the Hom construction is not geometric in general.

But there is a very general situation in which $\mathcal{H}om(F, \cdot)$ is geometric. Namely, it suffices for $F$ to be an $\mathcal{O}_X$-module on a ringed space $X$ which is of finite presentation around $x \in X$, i.e. such that there is a short exact sequence $$ \mathcal{O}_X^n \longrightarrow \mathcal{O}_X^m \longrightarrow F \longrightarrow 0 $$ on an open neighbourhood of $x$. (You can use the constant sheaf $\underline{\mathbb{Z}}$ as the structure sheaf $\mathcal{O}_X$ if you want to stay in the setting of sheaves of abelian groups.) This is because in this case, $\mathcal{H}om(F, G)$ is canonically isomorphic to $$\left\{ x \in G^m \,\middle|\, \sum_i a_{ij} x_i = 0 \in G, j = 1,\ldots,n \right\},$$ where $A = (a_{ij}) \in \mathcal{O}_X^{m \times n}$ is the presentation matrix and $G$ is an arbitrary $\mathcal{O}_X$-module, and this construction is patently geometric.