TITLE: Is being finitely generated a local property?
QUESTION [11 upvotes]: 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!

REPLY [3 votes]: 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.