TITLE: Compactness of $\operatorname{Spec}(A)$
QUESTION [23 upvotes]: In an exercise in Atiyah-Macdonald it asks to prove that the prime spectrum $\operatorname{Spec}(A)$ of a commutative ring $A$ as a topological space $X$ (with the Zariski Topology) is compact. 
Now because the basic open sets $X_f = \{\mathfrak{p} \in \operatorname{Spec} (A) : \{f\} \not\subseteq \mathfrak{p} \}$ form a basis for the Zariski Topology it suffices to consider the case when 
$$X = \bigcup_{i \in I} X_{f_i}$$ 
where $I$ is some index set. Then taking the complement on both sides we get that 
$$\emptyset = \bigcap_{i \in I} X_{f_i}^c$$
so there is no prime ideal $\mathfrak{p}$ of $A$ such that all the $f_i$'s are in $\mathfrak{p}$. Now from here I am able to show that the ideal generated by the $f_i$'s is the whole ring as follows. Since there is no prime ideal $\mathfrak{p}$ such that all the $f_i \in \mathfrak{p}$, it is clear that there is no $\mathfrak{p}$ such that $(f_i) \subseteq \mathfrak{p}$ for all $i \in I.$ Taking a sum over all the $i$ then gives $$\sum_{i \in I} (f_i) = (1).$$
Now here's the problem:


How do I show from here that there is an equation of the form $1 = \sum_{i \in J} f_ig_i,$ where $g_i \in A$ and $J$ some finite subset of $I$? 


This part has been giving me a headache. I am not sure if the finiteness bit has to do with algebra, topology or the fact that we are dealing with prime ideals.
This is not a homework problem but rather for self-study.
$\textbf{Edit:}$ I have posted my answer below after the discussion with Dylan and Pierre.

REPLY [9 votes]: Here is a way to prove that $X$ is quasi-compact without invoking the fact the $X_f:=X\setminus V(f)$ generate the topology of $X:=\text{Spec}A$. 
Let $(\mathfrak a_i)_{i\in I}$ be a family of ideals satisfying 
$$
\bigcap_{i\in I}V(\mathfrak a_i)=\varnothing,
$$
and observe successively
$\bullet\quad\displaystyle V\left(\sum_{i\in I}\mathfrak a_i\right)=\bigcap_{i\in I}V(\mathfrak a_i)=\varnothing,$
$\bullet\quad\displaystyle\sum_{i\in I}\mathfrak a_i=(1),$
$\bullet\quad\displaystyle\sum_{i\in F}\mathfrak a_i=(1)$ for some finite subset $F$ of $I$,
$\bullet\quad\displaystyle\bigcap_{i\in F}V(\mathfrak a_i)=V\left(\sum_{i\in F}\mathfrak a_i\right)=V(1)=\varnothing$.
EDIT. The purpose of this edit is (a) to state and prove Proposition I.$1.1.4$ page $195$ in the Springer version of EGA I (see reference below), and (b) to perform the mental experiment consisting in defining the Zariski topology on the prime spectrum of a commutative ring in terms of open (instead of closed) subsets.
Precise reference: Éléments de Géométrie Algébrique I, Volume $166$ of Grundlehren der mathematischen Wissenschaften in Einzeldarstellungen mit besonderer Berücksichtigung der Anwendungsgebiete, A. Grothendieck, Jean Alexandre Dieudonné, Springer-Verlag, $1971$.
Let $A$ be a commutative ring and $X$ the set of its prime ideals. For any subset $M$ of $A$ we write 
$$
U(M)
$$
for the set of those prime ideals of $A$ which do not contain $M$. 
If $\mathfrak a$ is the ideal generated by $M$, then $U(M)=U(\mathfrak a)=U(r(\mathfrak a))$. 
We have the nice formulas 
$$
M\subset N\implies U(M)\subset U(M),
$$
$$
U\left(\bigcup_{i\in I}\ M_i\right)=\bigcup_{i\in I}\ U(M_i),
$$
and, for ideals $\mathfrak a$ and $\mathfrak b$,
$$
U(\mathfrak a\cap\mathfrak b)=U(\mathfrak a)\cap U(\mathfrak b).
$$
More generally we have 
$$
U(0)=\varnothing,\quad U(1)=X,
$$
$$
U\left(\bigcup_{i\in I}M_i\right)=U\left(\sum_{i\in I}M_i\right)=\bigcup_{i\in I}\ U(M_i),
$$
$$
U(\mathfrak a\cap\mathfrak b)=U(\mathfrak a\mathfrak b)=U(\mathfrak a)\cap U(\mathfrak b),
$$
which shows that the $U(M)$ form a topology. Note 
$$
U(\mathfrak a)\subset U(\mathfrak b)\iff r(\mathfrak a)\subset \mathfrak b.
$$
The equality 
$$
U(\mathfrak a)=\bigcup_{f\in\mathfrak a}\ U(f)\qquad(*)
$$
shows that the $U(f),f\in A$, form a basis for our topology.
Proposition I.1.1.4 of the Springer version of EGA I says

$U(\mathfrak a)$ is quasi-compact $\iff$ $U(\mathfrak a)=U(f_1,\dots,f_n)$ for some $f_1,\dots,f_n$ in $A$.

Proof.
$\Longrightarrow:\ $ This follows immediately from $(*)$. 
$\Longleftarrow:\ $ As $U(f_1,\dots,f_n)$ is the union of the $U(f_j)$, it suffices to prove that $U(f)$ is quasi-compact. If 
$$
U(f)\subset\bigcup_{i\in I}\ U(\mathfrak a_i),
$$
then some power $f^k$ of $f$ is in $\sum_{i\in I}\mathfrak a_i$. But then $f^k$ is in $\sum_{i\in F}\mathfrak a_i$ for some finite subset $F$ of $I$, implying 
$$
U(f)\subset\bigcup_{i\in F}\ U(\mathfrak a_i).
$$