Help doing an exercise on a criterion for affiness from Hartshorne So far I have managed to do all the exercises in section 2 of chapter 2 of Hartshorne's algebraic geometry except for question 2.16c. In fact, I have even looked at solutions to it and am unable to follow them, so I really don't know where to begin with giving an attempt. The setup of the question is as follows:
Let $X$ be a scheme and let $f \in \Gamma(X, \mathcal{O}_{X})$ be a global section. Define $X_{f}$ to be the set of points of $x \in X$ such that the stalk $f_{x}$ of $f$ is not contained in the maximal ideal $\mathfrak{m}_{x}$ of the local ring $\mathcal{O}_{X, x}$. 
Part (a) asks: If $U = \text{Spec} B$ is an open affine subscheme of $X$ and if $\tilde{f} \in B = \Gamma(U, \mathcal{O}_{X}|_{U})$ is the restriction of $f$ to $U$, then show that $U \cap X_{f} = D(\tilde{f})$. Conclude that $X_{f}$ is an open subset of $X$.
Part (b) asks: Assume that $X$ is quasi-compact. Let $A = \Gamma(X, \mathcal{O}_{X})$ and let $a \in A$ be an element whose restriction to $X_{f}$ is $0$. Show that for some $n>0$, $f^{n}a = 0$.  
Part (c) asks: Now assume that $X$ has a finite cover by open affines $\{ U_{i} \}$ such that each intersection $U_{i} \cap U_{j}$ is quasi-compact. Let $b \in \Gamma(X_{f}, \mathcal{O}_{X_{f}})$. Show that for some $n > 0$, $f^{n}b$ is the restriction of an element of $A$.
I know that we need to use the fact that the intersections of open affines are quasi-compact and apply part (b), but I haven't been able to actually do this. There are three solutions online that I have been looking at but they haven't been particularly helpful, the best one being here.
Is someone able to give me some more details as to how to do this?
Thanks
 A: I apologize for the poorly worded question, I admit I was a bit rushed. I'd like to post my own answer though now that I have finally figured it out as well as fix up the question. I thought this might be useful since I found it very insightful and the solutions online seem to be lacking a lot of detail. 
Suppose we have a finite cover $\{ U_{i} = \text{Spec} B_{i}  \}$ for $X$. This then provides an affine (by part a) cover $\{ X_{f} \cap \text{Spec} B_{i} \}$ for $X_{f}$. Let $b \in \Gamma(X_{f}, \mathcal{O}_{X_{f}})$. Denote the restriction of $f$ to $U_{i}$ by $f_{i}$. Since, by part (a), $U_{i} \cap X_{f} = D(f_{i})$, for each $i$ we have
$$
b|_{X_{f} \cap U_{i}} = \frac{b_{i}}{f_{i}^{d_{i}}} \quad \text{with } b_{i} \in B_{i} .
$$
Denote the restriction of $f_{i}$ to $ U_{i} \cap U_{j}$ by $f_{ij}$. Then we may write
$$
b_{i}|_{X_{f} \cap U_{i} \cap U_{j}} = f_{ij}^{d_{i}} \left(  b|_{X_{f} \cap U_{i} \cap U_{j}}  \right).
$$
Note that we have abused notation slightly: By $f_{ij}^{d_{i}}$, we mean the restriction of this to $U_{i} \cap U_{j} \cap X_{f}$. Then there holds
$$
f_{ij}^{d_{j}}b_{i}|_{X_{f} \cap U_{i} \cap U_{j}} - f_{ij}^{d_{i}}b_{j}|_{X_{f} \cap U_{i} \cap U_{j}} = \left( f_{ij}^{d_{i}+d_{j}} - f_{ij}^{d_{j}+d_{i}} \right) \left(  b|_{X_{f} \cap U_{i} \cap U_{j}}  \right) = 0.
$$
But the above section is precisely the restriction of the section 
$$
a_{ij}:=f_{ij}^{d_{j}+d_{i}} b_{i}|_{U_{i} \cap U_{j}} - f_{ij}^{d_{i}+d_{j}}b_{j}|_{U_{j} \cap U_{j}}.
$$
So by part (b) of the question, since $U_{i \cap U_{j}}$ is quasi-compact, there is some integer $N_{ij}$ such that $f_{ij}^{N_{ij}}a_{ij} = 0$. Since there are only finitely many of the $U_{i}$, we can choose the largest such $N_{ij}$ which we will call $M$. Then for any intersection $U_{i} \cap U_{j}$ of affine open sets in the cover, there holds
$$
f^{M}a_{ij} = f_{ij}^{d_{j}+d_{i}+M} b_{i}|_{U_{i} \cap U_{j}} - f_{ij}^{d_{i}+ d_{j}+M} b_{j}|_{U_{i} \cap U_{j}} = 0.
$$
This is still dependent on the $i, j$. However, since there are only finitely many of these, we can define
$$
d:= \sum_{i} d_{i}
$$
so that for any intersection $U_{i} \cap U_{j}$ of affine open sets in the cover, there holds,
$$
f^{M}a_{ij} = f_{ij}^{d+M} b_{i}|_{U_{i} \cap U_{j}} - f_{ij}^{d+M} b_{j}|_{U_{i} \cap U_{j}} = 0.
$$
In other words, on the intersection $U_{i} \cap U_{j}$, we have the agreement
$$
f_{ij}^{d+M} b_{i}|_{U_{i} \cap U_{j}} = f_{ij}^{d+M} b_{j}|_{U_{i} \cap U_{j}}.
$$
By the gluing property for sheaves, this allows us to glue across the affine cover such that
$$
f^{M+d}b = 0,
$$
which completes the proof.
