Question about proof of Hartshorne book Lemma III.2.4 Let $(X,\mathcal{O}_X)$ be a ringed space. For any open subet $U \subseteq X$, Let $\mathcal{O}_U$ denote the sheaf $j_!(\mathcal{O}_X|_U)$ which is the restriction of $\mathcal{O}_X$ to $U$, extended by zero outside $U$.
Let $\mathcal{I}$ be an injective $\mathcal{O}_X$-module.
Then, why ${\rm Hom}_\mathcal{O_X}(\mathcal{O}_U, \mathcal{I})=\mathcal{I}(U)$??
 A: If $H$ is a presheaf and $G$  a sheaf on a toplogical space $X$, we have the characteristic relation for the sheafification $H^s$ of $F$:  $$\text {Hom}(H,G)=\text {Hom}(H^s,G)$$
Applying this to the presheaf $H=j_? \mathcal F$ whose sheafification is $H^s=j_!F$ (cf. Hartshorne exercise 1.19 (b): we have $(j_?\mathcal F)(V)=\mathcal F(V)$ if $V\subseteq U$ and $H=(j_?\mathcal F)(V)=0$ else), we are reduced to proving $$\text {Hom}_X(j_?(\mathcal O_X\mid U),\mathcal I)=\mathcal I(U)$$
which is easy, and has nothing to do with the injectivity of $\mathcal I$ !
[To spell it out : given a section $s\in \mathcal I(U)$, you get for any $V\subseteq U$ the morphism $\mathcal O_X(V)\to \mathcal I(V):\phi\mapsto \phi\cdot s\mid V$ and this yields an isomorphism $\mathcal I(U)\stackrel {\cong}{\to}   \text {Hom}_X (j_?(\mathcal O_X\mid U),\mathcal I)  $]
A: I don't think you need injectivity of $\mathscr{I}$.  Since the functor $j_!$ is left adjoint to restriction, there is a bifunctorial isomorphism
$$ \mathrm{Hom}(j_!(\mathscr{O}_X|_U), \mathscr{I}) \stackrel{\sim}{\to} \mathrm{Hom}(\mathscr{O}_X|_U, \mathscr{I}|_U). $$
Since a $\Gamma(V, \mathscr{O}_X)$-module homomorphism from $\Gamma(V, \mathscr{O}_X)$ to $\Gamma(V, \mathscr{I})$ is determined by the image of the identity, it follows that giving a homomorphism $\varphi : \mathscr{O}_X|_U \to \mathscr{I}|_U$ is the same as giving for each open $V \subset U$ a section $s_V \in \Gamma(V, \mathscr{I})$ in such a way that they agree on intersections; in other words it is equivalent to giving a section $s \in \Gamma(U, \mathscr{I})$.
