# Relation of Function Field of a scheme to the Local Ring of its Prime Divisor

Refer to p. 130 in Hartshorne: Let $X$ be a noetherian, integral separated scheme, regular in codimension 1, and let $Y$ be a prime divisor of $X$, with generic point $\eta$. Let $\xi$ be the generic point of $X$ and $K=\mathcal{O}_{X,\xi}$ is the function field of $X$. I can see that $\mathcal{O}_{X,\eta}$ is an integral domain and that it can be injected into $K$. But why is $K$ the quotient field of $\mathcal{O}_{X,\eta}$?

-
Pick an affine open $U=\mathrm{Spec}(A)$ containing $\eta$. Then $\mathscr{O}_{X,\eta}$ is the localization of $A$ at the prime ideal $\mathfrak{p}\in\mathrm{Spec}(A)$ corresponding to $\eta$. Also, since the generic point $\xi$ is in $U$, and necessarily corresponds to the generic point of $\mathrm{Spec}(A)$, i.e., the zero ideal, the local ring at the generic point is $A$ localized at the zero ideal, i.e., the field of fractions of $A$. Now you just have to prove that any localization of $A$ has the same field of fractions as $A$. Or more precisely, the canonical map $S^{-1}A\rightarrow\mathrm{Frac}(A)$ identifies the target as the field of fractions of the source for any multiplicative set $S\subseteq A$.
If $X$ is any scheme, $x\in X$, and $U\subseteq X$ is open with $x\in U$, then the canonical open immersion $U\hookrightarrow X$ induces an isomorphism $\mathscr{O}_{X,x}\cong\mathscr{O}_{U,x}$. So we can identify the local ring of $X$ and $x$ and the local ring of $U$ at $x$. Now assume $X$ is integral with generic point $\xi$ and that $U$ is affine open (as long as $U\neq\emptyset$ it is automatic that $\xi\in U$). Now $U=\mathrm{Spec}(A)$ is an integral affine scheme, meaning $A$ is a domain, and $\xi\in U$ is its generic point, which means that it corresponds to the zero ideal. –  Keenan Kidwell Oct 22 '12 at 18:04
The definition of the structure sheaf of $\mathrm{Spec}(A)$ is such that at a prime $\mathfrak{p}$, the local ring is $A_\mathfrak{p}$. In a particular, taking $\mathfrak{p}=(0)$, the zero ideal, the local ring at the generic point is $A_{(0)}=\mathrm{Frac}(A)$ (by definition). So the function field of $X$ can be identified with the field of fractions of the ring of sections of any non-empty affine open. –  Keenan Kidwell Oct 22 '12 at 18:05