Definition of the Ideal Sheaf Let $Y$ be a closed subscheme of a scheme $X$ and let $i:Y \rightarrow X$ be the inclusion morphism. Then the ideal sheaf of $Y$ is defined to be the kernel of the morphism of sheafs $i^{\#}: \mathcal{O}_X \rightarrow i_* \mathcal{O}_Y$ (Hartshorne p.115). My question is: why is the ideal sheaf defined for a closed subscheme, and not more generally, i.e. for any morphism of schemes $f:Y \rightarrow X$ as the kernel of the morphism of sheafs $f^{\#}: \mathcal{O}_X \rightarrow f_* \mathcal{O}_Y$?
 A: A closed subscheme of $X$ corresponds to a closed subspace $|Y|$ together with a quasicoherent sheaf of ideals $\mathcal I_Y$ of $\mathcal O_X.$ In this situation, the sheaf of ideals is naturally identified as the kernel of the sheaf morphism $\mathcal O_X\to f_*\mathcal O_Y\cong\mathcal O_X/\mathcal I_Y.$ 
More generally, any morphism of schemes $f:Y\to X$ comes with a sheaf morphism $f^\sharp:\mathcal O_X\to f_*\mathcal O_Y,$ but this need not be surjective, and the geometric meaning of the kernel may not be obvious (we are now considering $\operatorname{Ann}(f_*\mathcal O_Y)$). For a very simple example, consider the structure morphism $f:\mathbb A^1_k\to\operatorname{Spec}(k)$ induced by $f^\sharp:k\to k[x]$ over a field $k.$ The sheaf morphism $f^\sharp$ has trivial kernel, so the corresponding closed subscheme is $\operatorname{Spec}(k)$ which corresponds to the support of $k[x]$ as an $\mathcal O_{\operatorname{Spec}(k)}$-module.  
Have a look at Hartshorne Exercise II.5.6 for more details.
