Q:

$\text{Hom}_{\mathcal{O}_X}(\mathcal{O}_Z, \mathcal{O}_Z) \cong H^0(\mathcal{O}_Z)$?

I was wondering why for a closed subscheme $Z \subset X$ we have $\text{Hom}_{\mathcal{O}_X}(\mathcal{O}_Z, \mathcal{O}_Z) \cong H^0(\mathcal{O}_Z)$? How does one construct such an isomorphism?

A:

One should note that technically $\operatorname{Hom}_{\mathcal O_X}(\mathcal O_Z, \mathcal O_Z)$ means $\operatorname{Hom}_{\mathcal O_X}(i_*\mathcal O_Z, i_*\mathcal O_Z)$ where $i: Z \hookrightarrow X$ is the closed immersion.
The adjunction between $i^*$ and $i_*$ yields a natural isomorphism
$$\operatorname{Hom}_{\mathcal O_X}(i_*\mathcal O_Z, i_*\mathcal O_Z) = \operatorname{Hom}_{\mathcal O_Z}(i^*i_*\mathcal O_Z,\mathcal O_Z)$$
and we conclude by the fact that the natural map
$$i^*i_*\mathcal O_Z \to \mathcal O_Z$$
is an isomorphism. This can be checked affine locally and there it is just the isomorphism $$R/I \otimes_R R/I \to R/I.$$
In particular we have a natural isomorphism
$$\operatorname{Hom}_{\mathcal O_X}(i_*\mathcal O_Z, i_*\mathcal O_Z) = \operatorname{Hom}_{\mathcal O_Z}(i^*i_*\mathcal O_Z,\mathcal O_Z) = \operatorname{Hom}_{\mathcal O_Z}(\mathcal O_Z,\mathcal O_Z) = H^0(Z,\mathcal O_Z).$$

