I’m trying to solve exercise II.2.17 of Hartshorne, which is stated as follows:
A scheme $X$ is affine if and only if there is a finite set of elements $f_1,\cdots,f_r\in A=\Gamma(X,O_X)$, such that the open subset $X_{f_i}$ are affine, and $f_1,\cdots,f_r$ generate the unit ideal in $A$.
Let $f\in\Gamma(X,O_X)$, we define $X_f$ to be the subset of points $x\in X$ such that the stalk $f_x$ of $f$ at $x$ is not contained in the maximal ideal $\mathfrak{m}_x$ of the local ring $O_x$.
I have almost solved this question using the given hint (Ex.2.16d)
Assuming that $X$ has a finite cover by open affines $U_i$ such that each intersection $U_i\cap U_j$ is quasi-compact, then $\Gamma(X_f,O_{X_f})\simeq A_f$.
But I cannot figure out why the intersection $X_{f_i}\cap X_{f_j}$ is quasi-compact in the given condition of exercise 2.17. Is the intersection of open affine subschemes quasi-compact?
The intersection of open affine subschemes need not be quasi-compact in general. For instance, consider $\Bbb A^\infty$ with a doubled origin - then the complements of each origin is an affine subscheme isomorphic to $\Bbb A^\infty$, and their intersection is $\Bbb A^\infty$ with the origin removed which is not quasi-compact.
The way to show that $X_{f_i}\cap X_{f_j}$ is quasi-compact here is to note that this is actually affine, hence quasi-compact: $X_{f_i}$ is affine by assumption, and $X_{f_i}\cap X_{f_j} = (X_{f_i})_{f_j|_{X_{f_i}}}$.