TITLE: exact sequence of ideal sheaves (Hartshorne Theorem III.3.7)
QUESTION [7 upvotes]: Let $X$ be a scheme and $Y$ a closed subscheme. Let $i : Y \hookrightarrow X$ be the inclusion.
Then, we define the ideal sheaf of $Y$, denoted $\mathcal {I}_Y$to be the kernel of the morphism $i^{\sharp} : \mathcal{O}_X \rightarrow i_{*} \mathcal{O}_Y$.
Let $P$ be a closed point of $X$, let $U$ be an affine open subet of $X$ containing $P$,and let $Y=X-U$.
Then is the following sequence exact??
$$0 \rightarrow \mathcal{I}_{Y\cup \{P\} } \rightarrow \mathcal{I}_Y \rightarrow k(P) \rightarrow 0$$
where $k(P)=\mathcal{O}_P/\mathcal{m}_P$.

REPLY [2 votes]: Seth's answer is excellent, and i wish to complement it a bit.
Let $i_1: Y \rightarrow X$, $i_2: Y \cup \{P\} \rightarrow X$ be the inclusion maps. Suppose we give to $Y$ and $Y \cup \{P\}$ the reduced induced closed subscheme struture. That is, for every open set $Y \cap U$ of $Y$ that corresponds to an open affine set $U = \operatorname{Spec}(A)$ of $X$, we set $\mathcal{O}_Y(Y \cap U) = A / J$, where $J = \bigcap_{Q \in Y\cap U} Q$, and similarly for $Y \cup \{P\}$. Since $P$ is a closed point, the stalks $\mathcal{O}_{Y,Q}, \, \mathcal{O}_{Y \cup \{P\},Q}$ are equal for any point $Q \in Y$. This implies that $(i_{1*}\mathcal{O}_Y)_Q = (i_{2*}\mathcal{O}_{Y \cup \{P\}})_Q, \, \forall Q \in Y$. Moreover, these latter stalks are also equal for any $Q \not\in Y \cup \{P\}$, since for such a $Q$ they are equal to zero. This implies that $\mathcal{I}_{Y,Q} = \mathcal{I}_{Y \cup \{P\},Q}$ for any $Q \neq P$. Since for such a $Q$ the skyscraper sheaf $k(P)$ is zero, exactness needs to be checked only at $P$. 
Let $U = \operatorname{Spec}(A)$ be an open affine subset of $X$ containing $P$. Then $Y \cap U =\operatorname{Spec}(A/J)$, where $J = \bigcap_{Q \in Y\cap U} Q$. Moreover, $(Y \cup \{P\}) \cap U =\operatorname{Spec}(A/J\cap m)$, where $m$ is a maximal ideal of $A$ not containing $J$ that represents $P$ in $\operatorname{Spec}(A)$. Then $\mathcal{I}_Y|_{Y \cap U} = \tilde{J}$, and $\mathcal{I}_{Y \cup \{P\}}|_{(Y \cup \{P\}) \cap U} = \tilde{(J \cap m)}$. Computing the stalks at $P$ is the same as localizing at $m$, which gives $\mathcal{I}_{Y,P} = J A_m = A_m$, and $\mathcal{I}_{Y \cup \{P\},P}= J \cap m A_m = m A_m$. Their quotient is $k(P) = A_m / mA_m$. 
An interesting note: As Seth says, the specific closed subscheme structure given to $Y, Y \cup \{P\}$ is not of particular relevance for the purpose of the proof of Theorem III.3.7 in Hartshorne. For example, we may work with the inverse image sheaves $i_1^{-1} \mathcal{O}_{X},i_2^{-1} \mathcal{O}_{X}$, in which case our exact sequence will change to $0 \rightarrow \mathcal{I}_{Y \cup \{P\}} \rightarrow \mathcal{I}_{Y} \rightarrow \mathcal{O}_{X,P} \rightarrow 0$. Then it can be checked that the rest of the arguments in the proof still apply.