TITLE: Sheaf cohomology with support vanishes
QUESTION [5 upvotes]: I am trying to solve the exercise 2.4 chapter III in Hartshorne's "Algebraic Geometry". For this I would like to prove for a sheaf $F$ of Abelian groups on a topological space $X$ and $U$ open subset of $X$ with complement $Z$ the following
$$ H^{i}_{Z}(X,j_{.}(F\mid_{U})) = 0$$
where $j:U \longrightarrow X$ the inclusion and $j_{.}$ meaning the extension of a sheaf on U to a sheaf on X by zero. I have proven exercise 2.3 chapter III, so I can use this.
Does anyone know a nice proof for this? Or maybe a counterexample if this doesn't hold? I was able to reduce/adapt this case to proving $H^{i}(X,j_{.}(F\mid_{U})) \cong H^{i}(U,F\mid_{U})$ but I also haven't a rigorous proof for this. Also for it is quite clear because $H^{0}_{Z}(X,j_{.}(F\mid_{U})) =0$, it is just for the higher order groups I have't an argument. (Or maybe this all doesn't hold?).
Thanks in advance!
(Not sure if this is supposed to be on mathstack, but there I have not yet received an answer on this).

REPLY [3 votes]: This is not true.
Example. Let $X$ be an irreducible topological space with $|X| \geq 2$ that has a closed point $x \in X$. For example, we may take $X = \operatorname{Spec} R$ for $R$ a domain that is not a field, and $x = \mathfrak m$ for $\mathfrak m \subseteq R$ a maximal ideal. Let $Z = \{x\}$, and let $U = X \setminus Z$.
Then the constant sheaf $\mathbb Z_X$ is flabby on $X$ [Hart, Exc. II.1.16(a)]. We have a short exact sequence [Hart, Exc. II.1.19(c)]
$$0 \to j_!\mathbb Z_U \to \mathbb Z_X \to i_*\mathbb Z_Z \to 0,$$
since $\mathbb Z_X|_U = \mathbb Z_U$ and $\mathbb Z_X|_Z = \mathbb Z_Z$ are the constant sheaves on $U$ and $Z$ respectively. Taking sections with support on $Z$ gives a long exact sequence
$$0 \to \Gamma_Z(X,j_!\mathbb Z_U) \to \Gamma_Z(X,\mathbb Z_X) \to \Gamma_Z(X,i_*\mathbb Z_Z) \to H^1_Z(X,j_!\mathbb Z_U) \to \ldots.$$
But $\Gamma_Z(X,\mathbb Z_X) = 0$, since all nonzero sections of $\mathbb Z_X$ are supported everywhere. On the other hand, $\Gamma_Z(X,i_*\mathbb Z_Z) = \mathbb Z$, since all sections of $i_*\mathbb Z_Z$ are supported on $Z$. Thus, the map
$$\Gamma_Z(X,\mathbb Z_X) \to \Gamma_Z(X,i_*\mathbb Z_Z)$$
is not surjective, so $H^1_Z(X,j_!\mathbb Z_U)$ cannot be zero.
Remark. Your statement that $H^i(X,j_!(\mathscr F|_U)) = H^i(U,\mathscr F|_U)$ is also false. This already fails for $H^0$, because $\Gamma(X,j_!(\mathscr F|_U)) = 0$ if $U \subsetneq X$, by the definition of extension by $0$.

References. 
[Hart] Hartshorne, Robin, Algebraic geometry, Graduate Texts in Mathematics 52. Springer-Verlag, New York-Heidelberg-Berlin (1977). ZBL0367.14001.