# Hartshorne Exercise III 3.2: $X$ is affine iff every component is affine

I'm trying to solve the following exercise frome Hartshorne's Algebraic Geometry:

Exercise III 3.2. Let $$X$$ be a reduced noetherian scheme. Show that $$X$$ is affine if and only if each irreducible component is affine

Clearly, if $$X$$ is affine, the compoents are closed subschemes so affine as well.

For the converse, I guess one has to use the following Proposition, because the chapter is rather short, but contains this strong criterion to be affine:

Proposition III 3.7. A noetherian scheme $$X$$ is affine iff $$H^1(X, \mathcal{I}) = 0$$ for every (coherent) sheaf of ideals $$\mathcal{I} \subset \mathcal{O}_X$$ iff $$H^1(X, \mathcal{F}) = 0$$ for all quasi-coherent sheaves $$\mathcal{F}$$.

But I don't know how to relate sheaf cohomology on $$X$$ to the cohomology the components. Two thoughts I had:

1. If $$i: Z \hookrightarrow X$$ is an irreducible compoent with ideal sheaf $$I_Z \subset \mathcal{O}_X$$, then the cohomology of the quotient sheaf $$i_*\mathcal{O}_Z = \mathcal{O}_X / I_Z$$ vanishes, because I can take an injective resolution $$\mathcal{O}_Z \to \mathcal{I}^*$$ on $$Z$$, and take the push-forward $$i_*\mathcal{I}^*$$ of this. Then the sheaves $$i_*\mathcal{I}^k$$ remain flasque, and I still get a resolution of $$i_*\mathcal{O}_Z$$, which can be checked on the stalks. So we can use this resolution to commute the cohomology groups of $$i_*\mathcal{O}_Z$$ on $$X$$, which will be the same as cohomology of $$\mathcal{O}_Z$$ on $$Z$$, i.e. $$0$$.

Is that reasoning correct?

1. Do I have to use Exercise 2.3 and 2.4? That seems to give a tool to compute cohomology on $$X$$, when cohomology on the components can be computed, but I'm not sure what the relation between $$H^i_Y(X, \cdot)$$ and $$H^i(Y, \cdot)$$ is. If part 1. here is correct, then I think $$H^i_Y(X, i_*\mathcal{F}) = H^i(Y, \mathcal{F}) = H^i(X, i_*\mathcal{F})$$ is true, because all three groups can by computed by taking the resolution $$i_*\mathcal{I}$$.

But even if 1. and 2. work out, I still don't know how to show that $$H^1(X, I) = 0$$ for all ideal sheaves $$I$$.

Let $$\mathscr{F} \subset \mathcal{O}_X$$ be a quasi-coherent sheaf on $$X$$, and let $$\mathscr{I}_1,\dotsc,\mathscr{I}_n$$ be the ideal sheaves associated to the irreducible and reduced compontents $$X_1,\dots,X_n \subset X$$. Consider the filtration $$\mathcal{F} \supset \mathscr{I}_1 \cdot \mathscr{F} \supset \mathscr{I}_1 \mathscr{I}_2 \cdot \mathscr{F} \supset \dotsb \supset \mathscr{I}_1 \dotsb \mathscr{I}_n \cdot \mathscr{F} = 0.$$ The last equality iholds because $$X$$ is reduced, so $$\mathcal{I}_1 \dots \mathcal{I}_n = 0$$.
Let $$\mathscr{G}_k$$ denote the $$k$$-th quotient of this filtration. It is a quasi-coherent module on $$X_k$$, so its cohomology groups (on $$X_k$$) vanish.
But if $$\mathscr{G}$$ is any quasi-coherent sheaf on $$X_k \xrightarrow{i} X$$, then the cohomology groups of $$i_* \mathscr{G}$$ and $$\mathscr{G}$$ are the same. This is a special case of Exercise III 8.2, and can also be seen as follows. Take any injective resolution $$0 \to \mathscr{G} \to \mathscr{I}^*$$. Because $$X_k$$ is a subspace of $$X$$, the push-forward is exact in this situation: The stalks at points in $$X_k$$ are the same, and the stalks outside of $$X_k$$ are all $$0$$. So $$0 \to i_* \mathscr{G} \to i_* \mathscr{I}^*$$ is a resolution, and the $$i_* \mathscr{I}^*$$ are flasque, so we can use them to compute cohomology. But applying $$\Gamma(X, \cdot)$$ just reproduces $$\Gamma(X_k, \mathscr{I}^i)$$, so $$H^i(X, i_* \mathscr{G}) = H^i(X_k, \mathscr{G})$$.
If we apply the long exact sequence to the sequences $$0 \to \mathscr{I}_1 \dotsm \mathscr{I}_{k-1} \cdot \mathscr{F} \to \mathscr{I}_1 \dotsm \mathscr{I}_{k} \cdot \mathscr{F} \to \mathscr{G}_k \to 0,$$ we get a surjection $$H^1(X, \mathscr{I}_1 \dotsm \mathscr{I}_{k-1} \cdot \mathscr{F}) \to H^1(X, \mathscr{I}_1 \dotsm \mathscr{I}_{k} \cdot \mathscr{F}) \to 0$$. Composing the surjections for all $$k$$ we get a surjection $$0 = H^1(X, \mathscr{I}_1\dotsm\mathscr{I}_n \cdot \mathscr{F}) \to H^1(X, \mathscr{F})$$, hence $$H^1(X, \mathscr{F}) = 0$$.