# Finiteness of quasiprojective mappings as local property

I'm trying to understand the following result, which is from Basic Algebraic Geometry, Shafarevic

Theorem If $f:X\longrightarrow Y$ is a regular map of affine varieties and every point $x\in Y$ has an affine neighbourhood $U$ containing $x$ such that $V:=f^{-1}(U)$ is affine and $f:U\longrightarrow V$ is finite, then $f$ itself is finite.

proof Set $k[X]=B$ and $k[Y]=A$. We can take a neighbourhood $U$ of any point in $Y$ such that $U$ is a principal open (which means that it has the form $D(f)=Y-V(f)$, the complementary set of the set of zeros of a polynomial) and satisfies the assumptions of the theorem. Let $D(g_{\alpha})$ be a family of such open sets, which we can take to be finite.

Then $Y=\bigcup D(g_{\alpha})$, that is, the ideal generated by the $g_{\alpha}$ is the whole of $A$. In our case, $V_{\alpha}=f^{-1}(D(g_{\alpha}))$, $k[D(g_{\alpha})]=A[\frac{1}{g_{\alpha}}]$ and $k[V_{\alpha}]=B[\frac{1}{g_{\alpha}}]$.

By assumption, $B[\frac{1}{g_{\alpha}}]$ has a finite basis $\omega_{i,\alpha}$ over $A[\frac{1}{g_{\alpha}}]$. We can assume that $\omega_{i,\alpha}\in B$, since if the basis consisted of elements $\frac{\omega_{i,\alpha}}{g_{\alpha}^{m_i}}$ with $\omega_{i,\alpha}\in B$ then the elements $\omega_{i,\alpha}$ would also be a basis. We take the union of all the bases $\omega_{i,\alpha}$ and prove that they form a basis of $B$ over $A$.

An element $b\in B$ has an expression

(*)$\ \ \ \ \ \ \ \ \ \ \ b=\sum_i\frac{a_{i,\alpha}}{g_{\alpha}^{n_{\alpha}}}\omega_{i,\alpha}$

for each $\alpha$. Since the $g_{\alpha}^{n_{\alpha}}$ generate the unit ideal of $A$, there exist $h_{\alpha}\in A$ such that $\sum_{\alpha}g_{\alpha}^{n_{\alpha}}h_{\alpha}=1$. Hence

$$b=b\sum_{\alpha}g_{\alpha}^{n_{\alpha}}h_{\alpha}=\sum_i\sum_{\alpha}a_{i,\alpha}h_{\alpha}\omega_{i,\alpha}$$

which proves the theorem.

What I can't understand:

1) Why do $g_{\alpha}$ generate $A$

2) Why every $b\in B$ can be expressed as in (*)

3) why do the $g_{\alpha}^{n_{\alpha}}$ generate the unit ideal.

1. That $(g_\alpha)$ is the unit ideal is equivalent to $\{D(g_\alpha)\}$ covering $Y$. Indeed, suppose $(g_\alpha)$ is contained in some maximal ideal $m$. Then each $D(g_\alpha)$ does not contain the closed point corresponding to $m$.
2. The expression (*) is an immediate consequence of the definition of $B[1/g_\alpha]$ being a finitely generated module over $A[1/g_\alpha]$. Also, note that you are identifying $g_\alpha \in A$ with $g_\alpha \in B$ via the map $A \rightarrow B$ (there is nothing wrong with this as long as you realize that it's happening).
3. In general, $(r_1, \dots, r_n)$ generate the unit ideal in a ring $R$ if and only if $(r_1^{m_1}, \dots, r_n^{m_n})$ generate the unit ideal for any $n_i \in \mathbb{Z}_{> 0}$. To prove this assertion, start with an expression $a_1r_1 + \dots + a_nr_n = 1$, raise both sides to a sufficiently high power, and use the binomial theorem.