Is being finitely generated a local property? I am trying ot figure out a proof of the following fact, that I believe is true, but it seems to me that something is lacking.
Suppose we have commutative, unitary rings $A,B$ and a (unit preserving) homomorphism $\varphi \colon A \rightarrow B$ which makes $B$ an $A$-algebra. Suppose also we have elements $f_1,\dots,f_n \in B$ which generate the unit ideal and such that $B_{f_i}$, namely the localisation of $B$ with respect to $f_i$, is a finitely generated $A$-algebra. Show that then $B$ is a finitely generated $A$-algebra.
Could someone give me a rigorous proof of this fact (or a counterexample, if this is false)?
Thank you!
 A: Dear Andrea, the fact you mention is indeed true. Consider the associated morphism of affine schemes $Spec (\phi)  = f :  X=Spec B \to Y=Spec A$. Your hypothesis on unit ideal generation translates into the fact that the open subsets $U_i= Spec B_{f_i}$ cover $X$. The finite generation of  $B_{f_i} $  as an $A$-algebra shows that the scheme $U_i$ is of finite type over $Y$. Hence $X$ is of finite type over $Y$ according to Definition (6.3.1) on page 144 in EGA I.  The result you request, that $B$ is finitely generated over $A$, follows from
 Proposition (6.3.3) on page 145 [ heartfelt thanks to roman who spotted that my initial references were mixed up] 
Of course one could unpack all this and give a purely algebraic proof. But I think it is nice to see things geometrically and, in case you don't know elementary scheme theory yet, this might motivate you to learn it . At the level used here it is little more than a language in which to speak of algebra. [ By the way, don't be afraid of the hypothesis that the morphisms appearing in this context be quasi-compact: all morphisms between affine schemes are quasi-compact !]
A: To supplement these expert answers, I want to give one that at least to me shows how to use geometry to think of the algebraic proof.  Not being an algebraic thinker this sort of thing is crucial for me, and indeed by thinking in these terms I was able to do this initially puzzling, although elementary, computation in my head.  The key idea is that of a partition of unity, that allows one to decompose a global element into a sum of local elements.
I apologize for revisiting this old and elementary question, but it is basic and I think it is worth trying again, as Georges did, to expose the geometric idea behind the algebra.
To prove: if R is an S algebra and spec(R) has an open covering by basic open sets Ufj j=1,...m, such that each affine ring Rfj is finitely generated as S algebra, where the functions fj generate the unit ideal in R, then R is also finitely generated as S algebra.
proof: To take advantage of the hypothesis, we want to restrict an element h of R, thought of as a function on spec(R), to each open set Ufj, then write each restriction in terms of a finite number of elements of R, and add back up to get h itself in terms of a finite number of elements of R.  But since the sets Ufj overlap, the naive restrictions will not add back to h.  Thus we want to use the more subtle restriction obtained from a “partition of unity”.  I.e. if we write the constant 1 as a sum of functions each supported in the Uj, then by multiplying h by these functions, we can write h also as such a sum. 
Since the fj generate the unit ideal we have functions gj such that f1g1+...+fmgm = 1.  Thus given h = h.(f1g1)+...+h.(fmgm), it suffices to write each “restriction” h.(fjgj) as an S linear combination of monomials in terms of a finite number of elements of R, which are independent of h.
If we restrict h to Uj in the naive sense, we have by hypothesis that h is an S linear combination of monomials involving a fixed finite number of elements of form r/fj^s, with r in R; hence for some t, h.fj^(s+t) is an S linear combination of monomials in a fixed finite set of elements of R, if we add fj to the finite set of elements r.
Now using the fact that 1^N = 1, for any N, we can form our partition of unity using any power of the fj.  Thus for any n, we can write h = h.(f1^n.G1)+...+h.(fm^n.Gm) where each h.(fj^n) is an S linear combination of monomials in a given finite number of elements of R, hence (after including the Gj among the finite set of elements) also h.(fj^n.Gj), hence also h.
A: Suppose we have an element $x\in B$. Then it's image in $B_{f_i}$ is equal to some $F^i( \frac{b^i_1}{f_i^{k^i_1}} ,\ldots ,\frac{b^i_{j_i}}{f_i^{k^i_{j_i}}})$, where $\frac{b^i_j}{f_i^{k^i_j}}$ are the finite set of generators of $B_{f_i}$ over $A$, with $b^i_j\in A$, and $F^i$ some polynomials with coefficients in $A$. After multiplying by a large power of $f_i$ this gives us $n$ equalities in $B$ looking like $f_i^{N}x=F'^i(b^i_1,\ldots,b^i_{j_i},f_i)$, again with coefficients in $A$. But as $f_i$ generate unit ideal in $B$, there is an expression of 1 in terms of $f_i$: $a_1f_1+\cdots+a_nf_n=1$, with $a_i\in B$. Exponentiate it to the nN-th power and multiply by $x$, and you'll get $x=G(f_1,\ldots,f_n,a_1,\ldots,a_n,\ldots b^i_j \ldots)$, with $G$ polynomial with coefficients in $A$ (because after exponentiation each monomial of $a_i,f_i$ include at least one $f_j$ in power greater or equal to $N$, so after multiplying by x we could substitute $F'^j$ for $xf_j^N$). So any $x\in B$ can be expressed as a polynomial of $a_i,f_i,b^i_j$ with coefficients in $A$, which means that $B$ is finitely-generated $A$-algebra.
Looking it up in EGA as Georges suggests is also a good idea, I just thought you might not be ready for that yet.
