Prove that sheaf hom is a sheaf.

Suppose $\mathcal{F}$ and $\mathcal{G}$ are sheaves on $X$. The sheaf hom from $\mathcal{F}$ to $\mathcal{G}$ is defined by $U \mapsto $ Hom($\mathcal{F}|_{U}$,$\mathcal{G}|_{U}$), where the Hom is taken in the category of presheaves, i.e., Hom($\mathcal{F}|_{U}$,$\mathcal{G}|_{U}$) is the set of all natural transformations from $\mathcal{F}|_{U}$ to $\mathcal{G}|_{U}$.

To verify the sheaf hom is a sheaf , I have to show that it is a presheaf. So I need to define a restriction map from Hom($\mathcal{F}|_{U}$,$\mathcal{G}|_{U}$) to Hom($\mathcal{F}|_V$,$\mathcal{G}|_V$) if $V$ is an open subset of $U$. There seems a natural restriction map by using the restriction maps for $\mathcal{F}$ and $\mathcal{G}$. But how can you describe it explicitly?


Step $-1$ (unnecessary). Show that the set of sections Hom$(\mathscr F|_U,\mathscr G|_U)$ over an open subset $U\subset X$ is an abelian group (so that $\mathcal Hom(\mathscr F,\mathscr G)$ will be a sheaf of abelian groups). This is easy.

Step $0$. $U\mapsto \textrm{Hom}(\mathscr F|_U,\mathscr G|_U)$ is a presheaf (note: as pointed out in a comment, a section of this presheaf is a morphism of sheaves!). The restriction is defined as follows: for fixed $U$, and an open subset $V\subset U$, a section $\sigma\in\textrm{Hom}(\mathscr F|_U,\mathscr G|_U)$ goes to $\sigma|_V\in \textrm{Hom}(\mathscr F|_V,\mathscr G|_V)$, where $\sigma|_V$ is the morphism of sheaves on $V$ defined by $\sigma|_V(W)=\sigma(W):\mathscr F(W)\to\mathscr G(W)$ for any open subset $W\subset V$ (which is also open in $U$! for this reason, the squares that must commute, over $V$, do commute because they already commuted over $U$).

Step $1$. The first sheaf axiom. Let $U=\bigcup_{i\in I} U_i$ be an open covering of an open subset $U\subset X$. Let $\sigma: \mathscr F|_U\to\mathscr G|_U$ be a section such that $\sigma_i:=\sigma|_{U_i}=0$ for all $i\in I$. We want to show that $\sigma=0$.

Let $g\in\mathscr F(U)$ be a fixed section. Then look at the (zero!) morphisms of abelian groups $$ \sigma_i(U_i):\mathscr F(U_i)\to\mathscr G(U_i) \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,g_i\mapsto 0. $$ Now, because $\mathscr{G}$ is a sheaf and the image of the section $g$ under $\sigma(U)$ restricts to zero on every open set in an open cover $\{U_i \}$ (recall the usual commutative diagram for morphisms of (pre)sheaves/natural transformations), it has the property $$ \sigma(U)(g)=0. $$ Because this holds for every $g\in\mathscr F(U)$, we conclude that $\sigma(U)=0$, hence $\sigma=0$, as claimed.

Step 2. The second sheaf axiom. Let again $U=\bigcup_{i\in I} U_i$ be an open covering of an open subset $U\subset X$, and let $\{\phi_i:\mathscr F|_{U_i}\to\mathscr G|_{U_i}\}_{i\in I}$ be a family of sections such that $\phi_i=\phi_j$ on $U_{ij}$. We want a global $\phi$ (section over $U$) such that $\phi|_{U_i}=\phi_i$.

If $V\subset U$, then $A_i:=U_i\cap V$ cover $V$. So let us fix a section $g\in \mathscr F(V)$ and let us set $g_i:=g|_{A_i}$. We can give a name (say $t_i$) to the image of $g_i$ under $\phi(A_i)$, namely $$ \phi_i(A_i):\mathscr F(A_i)\to\mathscr G(A_i) \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,g_i\mapsto t_i. $$ The compatibility of the $\phi_i$'s implies that of the $t_i$'s, and since $\mathscr G$ is a sheaf there exists a global section $t\in \mathscr G(V)$ such that $t|_{A_i}=t_i$ for every $i$. We can define the $\phi$ that we are looking for by $$ \phi(V):\mathscr F(V)\to\mathscr G(V) \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, g\mapsto t. $$ for every $V\subset U$. In this way, by construction, $\phi|_{U_i}=\phi_i$, as wanted.