Definition of closed subscheme Let $(X,\mathcal O_X)$ be a scheme. I'm using the following definition from Görtz-Wedhorn. A closed subscheme of $(X,\mathcal O_X)$ is a scheme $(Z,\mathcal O_Z)$, where $i\colon Z\hookrightarrow X$ is a closed subset of $X$, and for which there exists an ideal sheaf $\mathcal I\subset\mathcal O_X$ together with an isomorphism $\mathcal O_X/\mathcal I\cong i_*\mathcal O_Z$.
Elsewhere I've seen the definition that a closed subscheme is a scheme of the form $(Z,i^{-1}(\mathcal O_X/\mathcal I))$, where $Z\subset X$ is a closed subset and $\mathcal I\subset\mathcal O_X$ is an ideal sheaf.
It seems like these definitions are equivalent. Certainly the first implies the second, since $i^{-1}i_*\mathcal O_z=\mathcal O_Z$. How do I show the other implication?
 A: Suppose you have a closed subscheme $(Z,\mathcal{O}_Z)$ according to the second definition.  Let $\mathcal{J}$ be the ideal sheaf on $X$ defined by saying $f\in\mathcal{J}(U)$ iff for each $p\in U\cap Z$, $f_p\in\mathcal{I}_p$.  That is, $\mathcal{J}$ consists of sections of $\mathcal{O}_X$ which are locally in $\mathcal{I}$ at every point of $Z$.  We then have $i^{-1}(\mathcal{O}_X/\mathcal{J})\cong i^{-1}(\mathcal{O}_X/\mathcal{I})= \mathcal{O}_Z$ since $\mathcal{I}$ and $\mathcal{J}$ have the same stalks at points of $Z$, so $(Z,\mathcal{O}_Z)$ also satisfies the second definition with respect to $\mathcal{J}$.  I claim that $(Z,\mathcal{O}_Z)$ satisfies the first definition with respect to $\mathcal{J}$.
The isomorphism $F:i^{-1}(\mathcal{O}_X/\mathcal{J})\to\mathcal{O}_Z$ induces a homomorphism $G:\mathcal{O}_X/\mathcal{J}\to i_*\mathcal{O}_Z$.  We wish to show $G$ is an isomorphism.  To prove this, we look at stalks.  If $p\in Z$, then the stalk of $i_*\mathcal{O}_Z=i_*i^{-1}(\mathcal{O}_X/\mathcal{J})$ at $p$ is just the stalk of $\mathcal{O}_X/\mathcal{J}$ at $p$, so $G$ is an isomorphism on the stalks at $p$.  If $p\in X\setminus Z$, then the stalk of $i_*\mathcal{O}_Z$ at $p$ is $0$, so it suffices to show the stalk of $\mathcal{O}_X/\mathcal{J}$ at $p$ is $0$.  But this is immediate from the definition of $\mathcal{J}$: $\mathcal{J}$ is all of $\mathcal{O}_X$ on $X\setminus Z$, since the test for $f$ to be an element of $\mathcal{J}(U)$ is vacuous if $U$ is disjoint from $Z$.
Note that it is not necessarily true that $(Z,\mathcal{O}_Z)$ satisfies the first definition with respect to $\mathcal{I}$.  For instance, if $Z=\emptyset$, then the second definition is satisfied for any ideal $\mathcal{I}$ at all, but the first definition can only be satisfied if $\mathcal{I}=\mathcal{O}_X$.  More generally, the first definition can only be satisfied if $\mathcal{I}$ is all of $\mathcal{O}_X$ on $X\setminus Z$, but the second definition doesn't care what $\mathcal{I}$ is outside a neighborhood of $Z$.
