# Relation between local cohomology and open immersions

Let $X$ be a noetherian scheme $U \subset X$ an open subset with complement $Z = X- U$. Assume $Z$ is cut out by the ideal sheaf $\mathcal{I} \subset \mathcal{O}_X$. We have exact sequences:

$$0 \to \mathcal{I}^n \to \mathcal{O}_X \to \mathcal{O}_X/\mathcal{I}^n \to 0$$

Here's what i'd like to be able to say:

Consider it now as an exact sequence of functors:

$$0 \to RHom(\mathcal{O}_X/\mathcal{I}^n,-) \to RHom(\mathcal{O}_X,-) \to RHom(\mathcal{I}^n,-) \to 0$$

Plugging in a sheaf gives a long exact sequence relating cohomologies of the complexes. Assuming $X$ affine and using the fact that $\lim_nRHom(\mathcal{I}^n,-) \cong RHom(\mathcal{O}_U,-)$ (and the long exact sequence) we see that local cohomology is isomorphic (after shift) to what you get by pushing-pulling (in derived sense) via the open immersion $U \to X$.

Is this argument valid? Is the conclusion even true?

This is true. The functor $RHom(\mathcal{O}_X/\mathcal{I}^{n+1},-)$ is in fact a different name for $j^!$ when $j: Z_n \to X$. Where $Z_n$ is the $n$-truncated formal neighborhood of $Z$ in $X$. In the limit we get a kind of $j^!$ too only now for the inclusion of the formal scheme $\widehat X_Z$ (formal neighborhood of $Z$ in $X$) into $X$. When $i:U \to X$ is the inclusion of the complement we have an exact triangle in the derived category
$$0 \to j_*j^! \to Id \to i_*i^* \to 0$$
So for the case of $X$ affine we indeed have that local cohomology is identified with the shifted version of the pull push along $U \to X$.