TITLE: Ring of Regular functions on $\Bbb{A}^2 - \{(0,0)\}$
QUESTION [6 upvotes]: Suppose I want to determine the ring of regular functions on  $U = \Bbb{A}^2 - \{(0,0)\}$. Now I can do this assuming the following fact:


Fact: If $f$ is regular on $U$, then we can write $f = g/h$ with $g,h$ polynomials in $k[x,y]$ such that $h(p) \neq 0$ on all of $U$. 


How does this come from the definition of $f$ being regular on $U$? The definition (at least the one given in Hartshorne 1.3 ) is:


Definition: Let $Y$ be an open subset of an affine variety. A function $f : Y \to k$ is regular at $P \in Y$ if there is an open neighbourhood $V$ with $P \in V \subseteq Y$ and polynomials  $g,h \in k[x_1,\ldots,x_n]$ such that $h$ is non-zero on $U$ and $f = g/h$ on $V$. We say $f$ is regular on $Y$ if it is regular at every point in $Y$.


Now I am a little confused as to how the fact I claim comes from this definition. In my mind, I have the following hazy interpretation.


My thoughts: Suppose we pick any open subset $W \subseteq U = \Bbb{A}^2 - \{(0,0)\}$. Then I can write $f = g/h$ for some polynomials $g,h$ at least on $W$. I claim that that actually $f = g/h$ on the whole of $U$. Indeed, pick any other non-empty open subset $W' \subseteq U$ and suppose $f = g'/h'$ on $W'$. Then because $W,W'$ are two dense open subsets they have a non-empty intersection, so that when we restrict to $W \cap W'$, 
    $$ \frac{g}{h}= f|_{W \cap W'}  = \frac{g'}{h'}.$$
    Thus $g/h $ and $g'/h'$ agree on a dense open subset and thus are equal on all of $U$. So it makes sense to set $f = g/h$ on all of $U$.


I think my understanding is correct, but I'm interested in different ways of understanding the fact I quote above.

REPLY [2 votes]: Let $r\in k(x,y).$ Define $J_r := \{ G\in k[X,Y] \mid \overline{G} r \in k[X,Y] \}.$ Then the pole set of $r$ is $V(J_r).$ If $r$ was regular on $U$ but not $\mathbb{A}^2$ then we would have $V(J_r) = V(X,Y) \implies \sqrt{J_r}=(X,Y).$ This implies that there are integers $m,n$ such that $$r= \frac{f_1(x,y)}{x^n} = \frac{f_2(x,y)}{y^m}$$ where $x, y$ are comprime to $f_1, f_2$ respectively, which contradicts the UFD property of $k[X,Y].$