Scheme Theoretic Image (Hartshorne Ex.II.3.11.d) The exercise asks to establish that given a morphism of schemes $f: Z \rightarrow X$, there is a unique closed subscheme $Y \rightarrow X$, such that 1) $f$ factors through $Y$, and 2) whenever $Y'$ is another closed subscheme of $X$ such that $f$ factors through $Y'$, then  $Y \rightarrow X$ factors through $Y'$.
Most of the treatments of this problem i came across use a sheaf-of-ideals approach. Instead, i have been thinking about two more direct approaches (direct in the sense that Hartshorne poses this problem prior to introducing sheaves of ideals). 
First Aproach: As a topological space, let $Y$ be the topological closure in $X$ of the image of $f$. Let $i: Y \rightarrow X$ be the inclusion map, and assign to $Y$ the sheaf $\mathcal O_Y:=i^{-1} \operatorname{im}f^{\#}$, where $f^{\#}: \mathcal{O}_X \rightarrow f_* \mathcal{O}_Z$. Then the morphism of sheaves $\mathcal{O}_X \rightarrow i_* \mathcal{O}_Y$ is the one given by composing $f^{\#}$ with the canonical morphism $\operatorname{im}f^{\#} \rightarrow i_* i^{-1} \operatorname{im}f^{\#}$, and it is surjective by construction. Denoting by $f'$ the morphism $f$ with target $Y$, one gives a morphism $ \mathcal{O}_Y \rightarrow f'_* \mathcal{O}_Z$, by starting with the inclusion $\operatorname{im}f^{\#} \rightarrow f_* \mathcal{O}_Z$, and then passing to $\mathcal{O}_Y=i^{-1}\operatorname{im}f^{\#} \rightarrow i^{-1} f_* \mathcal{O}_Z = f'_* \mathcal{O}_Z$. One similarly checks the commutation of the diagram on the level of sheaves and the universal property of $Y$. Do you agree with this approach?
Second Aproach: If $X = \operatorname{Spec} A$ is affine, then we can cover $Z$ by open affines $\operatorname{Spec} B_i$ and the morphism $f$ is given locally by ring homomorphisms $\phi_i : A \rightarrow B_i$. Then we can take $Y$ to be $\operatorname{Spec} (A/\cap_i\operatorname{ker} \phi_i)$. If $X$ is not affine, then it is reasonable to cover it by open affines $X = \bigcup \operatorname{Spec} A_j$, define $Y$ locally at each $\operatorname{Spec} A_j$ as above, and then glue the $Y_j$. However, this might be problematic because the union of all $Y_j$ might not even be a closed set of $X$. How can this difficulty be surpassed? 
 A: Unfortunately, neither of these two approaches can work because the underlying set of the scheme-theoretic image is not in general the closure of the set-theoretic image of $f:X\to Y$. Here is an example, taken from Vakil's text:
Let $X=\coprod_{n\geq 0} \operatorname{Spec} k[x]/(x^n)$, let $Y=\operatorname{Spec} k[x]$, and define $f:X\to Y$ by the obvious map $\operatorname{Spec} k[x]/(x^n) \to \operatorname{Spec} k[x]$ on each component. Then the set-theoretic image of $f$ is just $(x)$, but the scheme-theoretic image is all of $Y$: the statement about factorization means we're looking to find the kernel $I$ of the map $k[x]\to \prod_{n\geq 0} k[x]/(x^n)$, and then the closed subscheme which is the scheme-theoretic image is $\operatorname{Spec} k[x]/I$. It is straightforward to see that $I$ must be zero: if a polynomial in $x$ is zero modulo every $x^n$, it must be zero.
If you're looking to solve this problem without dealing quite so heavily in sheaves of ideals, here is an outline of how you might be able to do it. First, the set of closed subschemes through which $f$ factors is nonempty, because $Y$ is in it: $id:Y\to Y$ is a closed immersion. Next, given any collection of closed subschemes $\{Z_i\}_{i\in I}$ through which $f$ factors, prove that $f$ also factors through the scheme-theoretic intersection $\bigcap_{i\in I} Z_i$. (It seems to me that you kind of have to think at least a little about ideal sheaves here in order to define the structure sheaf on this, but we don't have to say quasi-coherent here in contrast to something like Stacks Project's proof.) We can now conclude that $\bigcap_{i\in I} Z_i$ is the smallest such closed subscheme essentially by construction.
(One piece of commentary on exercise II.3.11: I think it would be more natural to develop the theory of quasi-coherent sheaves first. Sections II.3 and II.5 don't actually depend on each other that much, and I think you could put II.5 before II.3 without too much trouble.)
