Ideal sheaf of the intersection of a projective scheme with a hypersurface Suppose $X$ is a closed subscheme in $\mathbb{P}^n$ and $H$ is a hypersurface in $\mathbb{P}^n$ with degree $d$, if $H$ does not contain the associate points of $X$, then $H \cap X$ is an effective Cartier divisor in $X$. Is its ideal sheaf in $X$ is $O_{\mathbb{P}^n}(-d)|_X$ (or just $O_X(-d)$ )? but I do not see why, could anyone explain this to me?
Or this is true only when $X$ is already a complete intersection?
 A: Let $i: X \hookrightarrow \mathbb P^n$ and $j: H \hookrightarrow \mathbb P^n$ be the closed immersions. We consider the base change and get the following Cartesian diagram:
\begin{array}{ccc}
      X \cap H& \xrightarrow{i_H} & H \\[3pt]
      \downarrow {j_H} & & \downarrow{j} \\
      X& \xrightarrow{i} & \mathbb P^n
\end{array}
We have an exact sequence
$$0 \to \mathcal O_{\mathbb P^n}(-d) \to \mathcal O_{\mathbb P^n} \to j_*\mathcal O_{H} \to 0.$$
The condition on the associated points is equivalent to the statement, that this sequence remains left-exact (*) (of course it always remains right-exact) after applying the functor $i^*$ (Which we will also write commonly as $(-)_{|X}$), thus we get an exact sequence
$$0 \to \mathcal O_{\mathbb P^n}(-d)_{|X} \to \mathcal O_{X} \to i^*j_*\mathcal O_{H} \to 0.$$
Note that we have $i^*j_*\mathcal O_{H} = {j_H}_*i_H^*\mathcal O_H = {j_H}_* \mathcal O_{X \cap H}$, i.e. we have the exact sequence
$$0 \to \mathcal O_{\mathbb P^n}(-d)_{|X} \to \mathcal O_{X} \to {j_H}_* \mathcal O_{X \cap H} \to 0,$$
hence - by definition - $\mathcal O_{\mathbb P^n}(-d)_{|X}$ is the ideal sheaf of the closed immersion $X \cap H \hookrightarrow X$.

Proof of (*):
We can check the exactness locally, hence we only have to check the following:
Let $\operatorname{Spec}(A) \subset \mathbb P^n$ be an affine open. Given a local equation $f \in A$ for $H$ and the ideal $I \subset A$ for $X$, we have to check that the map $A \xrightarrow{f \cdot } A$ remains injective after tensoring with $A/I$, i.e. the map $A/I \xrightarrow{f \cdot } A/I$ is injective. The condition on the associated points translates into $\operatorname{Ass(A/I)} \cap \operatorname{Spec}(A/(f)) = \emptyset$, hence the following proposition from commutative algebra completes the proof:

Let $M$ be an $A$-module and $f \in A$. Then $f$ is $M$-regular if and
  only if $\operatorname{Ass(M)} \cap \operatorname{Spec}(A/(f)) = \emptyset$

The one direction is trivial. If $\mathfrak p$ happens to be in the intersection $\operatorname{Ass(M)} \cap \operatorname{Spec}(A/(f))$, we have $f \in \mathfrak p = \operatorname{Ann}(m)$ for some $m \neq 0$, i.e. $fm=0$ and $f$ is not $M$-regular.
Conversely assume $f$ is not $M$-regular, i.e. $f \in \operatorname{Ann}(m)$ for some $m \neq 0$. It is well known that a maximal element of the set $\{\operatorname{Ann}(n) ~|~ \operatorname{Ann}(n) \supset \operatorname{Ann}(m)\}$ is an associated prime, say $\mathfrak p$. We have $f \in \operatorname{Ann}(m) \subset \mathfrak p$, i.e. $\mathfrak p$ is contained in $\operatorname{Ass(M)} \cap \operatorname{Spec}(A/(f))$. This completes the proof.
