Coordinate ring of an open affine variety?

I have trouble understanding what the coordinate ring of an open affine variety, i.e. the ring of regular functions on that variety, is (in the classical sense). Let $$k$$ be algebraically closed.

If $$X \subseteq \mathbb A^n$$ is a closed affine variety, then the coordinate ring is defined as $$k[X] := k[x_1, \dots, x_n] / I(X)$$ where $$I(X) = (f_1, \dots, f_m)$$ is the finitely generated ideal of polynomials vanishing on $$X$$.

If $$D(f) \subseteq \mathbb A^n$$ is a distinguished open set for some $$f \in k[x_1, \dots, x_n]$$, then $$k[D(f)] = k[x_1, \dots, x_n, f^{-1}]$$ is the localisation at $$f$$.

Now for a general open affine variety $$U \subseteq \mathbb A^n$$, we can write them as $$U = \mathbb A^n \setminus X$$ for a closed variety $$X = V(f_1, \dots, f_m)$$ where $$X$$ is the vanishing set of $$f_1, \dots, f_m \in k[x_1, \dots, x_n]$$. How can I construct $$k[U]$$? Is it simply the $$k$$-algebra generated by the $$k[D(f_i)]$$ for $$i = 1, \dots, m$$, i.e. $$k[U] = k[x_1, \dots, x_n, f_1^{-1}, \dots, f_m^{-1}]$$?

• It is also called "ring of regular functions", as regular functions on $Y$ are polynomials -we're using only algebraic operations in algebraic geometry- in coordinates on $Y$. Taking a closed subvariety $Y\subseteq X$ corresponds to quotienting by functions on $X$ vanishing on $Y$, as such functions give no information/do not depend on coordinates on $Y$. All that is left are regular functions of coordinates, all of them, as we assume we had all such function on $X$, and those on $Y$ are just restrictions of those on $X$ -and by quotienting we prune out the indeterminacy. Last question: Yes.
– plm
Commented Jun 12 at 12:51
• [2/2] I should add that functions on the complement of $Y$ contain all functions defined on $X$, as a regular function is determined by its values on an open set, at least with an algebraically closed base field; but we can define more regular functions on $X\setminus Y$ than on $X$: all the functions vanishing only on $Y$ now have regular inverse, so we add the inverse of $f_i$ for each $i$, and those are all the extra regular functions on $U$ compared to $X$, so we get your formula for $k[U]$.
– plm
Commented Jun 12 at 13:05

If you have an open variety $$U \subsetneq {\mathbb A}^n$$ which is an affine variety, then the complement $$H:= {\mathbb A}^n \setminus U$$ is a hypersurface and thus the zero set of a polynomial $$f$$. It follows that the coordinate ring of $$U$$ is $$k[x_1,\ldots,x_n,f^{-1}]$$.
If $$X$$ is a normal variety and $$U \subset X$$ an open subset such that the complement $$X \setminus U$$ has codimension $$\geq 2$$ in $$X$$, then every regular function on $$U$$ extends to a regular function on $$X$$.