I've began to study AG to prepare for grad school and I'm stuck with the following problem in Hartshorne. The problem statement is as follows (found on p. 22 in Hartshorne's AG):
Let $Y\subseteq X$ be a subvariety. Let $\mathcal{O}_{Y,X}$ be the set of equivalence classes $\langle U,f\rangle$, where $U\subseteq X$ is open, $U\cap Y\neq \emptyset$, and $f$ is a regular function on $U$. We say that $\langle U,f\rangle$ is equivalent to $\langle V,g\rangle$, if $f=g$ on $U\cap V$. Show that $\mathcal{O}_{Y,X}$ is a local ring, with residue field $K(Y)$ and dimension = $\dim X-\dim Y$.
I consulted a few solution sets for Hartshorne that can be found online, but they both handwaved the part that I'm stuck with. The solutions sets are the following:
http://www.math.northwestern.edu/~jcutrone/Work/Hartshorne%20Algebraic%20Geometry%20Solutions.pdf
http://math.berkeley.edu/~reb/courses/256A/1.3.pdf
My approach to solve the problem is as follows. Look at the following ideal:
$\mathfrak{m}=\{\langle U,f\rangle \mid f(P)= 0 \; \forall P\in U\cap Y\}$
It's easy to show that any element not contained in it is invertible. We then have a canonical map $\mathcal{O}_{Y,X}\to K(Y)$ given by
$\langle U,f\rangle \mapsto \langle U\cap Y,f\rangle$
and the kernel of this map is obviously $\mathfrak{m}$. However, I'm totally stuck with proving that this map is surjective, which is required in order to prove that the residue field is $K(Y)$. This part seems to be handwaved by both of the solutions provided above. In other words, I would need to show that if $f$ is regular on an open set $U\subset Y$, then $f$ extends to a regular function on some open $V\subset X$ s.t. $U\supset V\cap Y$.