Condition for a morphism of schemes to factor through a closed subscheme Suppose $f\colon Y\to X$ is a morphism of schemes. Suppose $Z\hookrightarrow X$ is a closed subscheme defined by the quasi-coherent ideal $\mathcal J\subset \mathcal O_X$. The Stacks Project claims that $f$ factors through the inclusion $Z\hookrightarrow X$ precisely if the morphism $f^\ast \mathcal J\to f^\ast \mathcal O_X=\mathcal O_Y$ is the zero morphism. As far as I can tell, this is equivalent to the condition that $\mathcal J\hookrightarrow \mathcal O_X\to f_\ast \mathcal O_Y$ is the zero morphism, since the adjunction should preserve the zero morphisms. 
However, this is never stated anywhere, which makes me suspicious, since I find my condition more straightforward than the one on the Stacks Project, so I don't know why it is not mentioned.
I would very much appreciate if anybody is willing to verify (or falsify) my thoughts.
 A: As one knows, a morphism of schemes is a pair $(f,f^{\sharp}):(Y,\mathcal{O}_Y)\to(X,\mathcal{O}_X)$ where $f:Y\to X$ is a map of topological spaces and $f^{\sharp}:\mathcal{O}_X\to f_{*}\mathcal{O}_Y$ is a morphism of (quasi-coherent) sheaves; let $\mathcal{I}=\ker f^{\sharp}$ be, it is a quasi-coherent ideal sheaf and one has the factorization
\begin{equation*}
0\to\mathcal{I}\hookrightarrow\mathcal{O}_X\underbrace{\xrightarrow{i^{\sharp}}\mathcal{O}_{X\displaystyle/\mathcal{I}}\hookrightarrow}_{f^{\sharp}}f_{*}\mathcal{O}_Y\to0
\end{equation*}
where $i^{\sharp}$ is a locally surjective morphism of (quasi-coherent) sheaves; I mean, for any $y\in Y,\,i^{\sharp}_{f(y)}:\mathcal{O}_{X,f(y)}\to\left(\mathcal{O}_{X\displaystyle/\mathcal{I}}\right)_{f(y)}$ is a surjective morphism of (local) rings.
Applying the $\mathbf{Spec}$ functor to previous right-exact sequence of quasi-coherent $\mathcal{O}_X$-algebras, one has the sequence of schemes
\begin{equation*}
Y\underbrace{\to\mathbf{Spec}\left(f_{*}\mathcal{O}_Y\right)\to\mathbf{Spec}\left(\mathcal{O}_{X\displaystyle/\mathcal{I}}\right)\cong V(\mathcal{I})\hookrightarrow}_f\mathbf{Spec}(\mathcal{O}_X)=X
\end{equation*}
where $V(\mathcal{I})$ is the support of $\mathcal{I}$, and it is a closed subscheme of $X$.
For more details, see S. Bosch - Algebraic Geometry and Commutative Algebra (2013) Springer-Verlag; exercise 7.1.4, propositions 7.3.4 and 7.3.14.
