In the simplest cases, the definition of KX is straightforward. If X is an affine algebraic variety, and if U is an open subset of X, then KX will be the field of fractions of the ring of regular functions on U. Because X is affine, the ring of regular functions on U will be a localization of the global sections of X, and consequently KX will be the constant sheaf whose value is the fraction field of the global sections of X. If X is integral but not affine, then any non-empty affine open set will be dense in X. This means there is not enough room for a regular function to do anything interesting outside of U, and consequently the behavior of the rational functions on U should determine the behavior of the rational functions on X. In fact, the fraction fields of the rings of regular functions on any open set will be the same, so we define, for any U, KX to be the common fraction field of any ring of regular functions on any open affine subset of X. Alternatively, one can define the function field in this case to be the local ring of the generic point.
General case
The trouble starts when X is no longer integral. Then it is possible to have zero divisors in the ring of regular functions, and consequently the fraction field no longer exists. The naive solution is to replace the fraction field by the total quotient ring, that is, to invert every element that is not a zero divisor. Unfortunately, in general, the total quotient ring does not produce a presheaf much less a sheaf. The well-known article of Kleiman, listed in the bibliography, gives such an example. The correct solution is to proceed as follows:
Further issues
Once KX is defined, it is possible to study properties of X which depend only on KX. This is the subject of birational geometry. If X is an algebraic variety over a field k, then over each open set U we have a field extensionKX of k. The dimension of U will be equal to the transcendence degree of this field extension. All finite transcendence degree field extensions of k correspond to the rational function field of some variety. In the particular case of an algebraic curveC, that is, dimension 1, it follows that any two non-constant functions F and G on C satisfy a polynomial equationP = 0.