I've started reading algebraic geometry by myself just a few days ago, so I apologize in advance if this question is stupid or non-sensical.
In Mumford's Red Book, he defines regular functions (although he doesn't use this notation, I'm assuming that he is defining the same thing; please correct me if I am wrong) as follows:
Definition 4 Let $X \subset k^n$ be an irreducible algebraic set, and let $R$ be its affine coordinate ring. Since $X$ is irreducible, $I(X)$ is prime and $R$ is an integral domain. Let $K$ be its field of fractions. Recall that $R$ has been identified with a ring of functions on $X$. For $x \in X$, let $m_x = \{f \in R | f(x) = 0\}$. This is a maximal ideal, the kernel of the homomorphism $R \to k$ given by $f \to f(x)$. Let $\underline{o}_x = R_{m_x}$. We have then $\underline{o}_x = \{f/g | f,g \in R, g(x) \ne 0\}$. Now, for $U$ open in $X$, let $$ \underline{o}_X(U) = \bigcap_{x \in U} \underline{o}_x.$$
I am assuming that $\underline{o}_X(U)$ is the set of regular functions on $U$ even though Mumford does not specify it. If I understand correctly, the rings $R_{m_x}$ are viewed by their embeddings in the field of fraction $K$, and the intersection is happening inside the field of fractions. Therefore, every element $\phi$ of $\underline{o}_X(U)$ is an element of the field of fractions $K$, and the way we view them as functions on $U$, say at a point $p$, is by first selecting $f, g \in R$ such that $\phi = f/g$ as elements of $K$ and $g(p) \ne 0$ when viewed as a function, and then defining $\phi(p) := f(p)/g(p) \in K$.
However, I became quite unsure about this after looking up other definitions. For example, Gathmann defines the set of regular functions on an open set $U$ of an affine variety $X$ as follows (I'll try to use the same notation as above here):
Definition 3.1 Let $X$ be an affine variety, and let $U$ be an open subset of $X$. A regular function on $U$ is a map $\phi: U \to k$ with the following property. For every $a \in U$, there are polynomial functions $f, g \in R$, with $g(x) \ne 0$, and $$ \phi(x) = \frac{f(x)}{g(x)}$$ for all $x$ in an open subset $U_a$ with $a \in U_a \subset U$.
In this definition, the function $\phi$ is no longer required to be given by an element of $K$; we only know that it is locally given by a quotient of two polynomials, and I am wondering if this quotient can be different as elements of the field of fractions $K$ at different points of $X$. I would like to know if these two definitions are saying the same thing. To be more specific, my question is:
Given such a regular function $\phi$ in the sense of the second definition, can we find an element $\phi' \in \underline{o}_{X}(U) \subset K$, such that $\phi = \phi'$ as functions on $U$?
Thanks for reading this long post.
These two definitions are indeed the same. Recall the sheaf of regular functions $\mathcal{O}_X$, as defined in Gathmann's notes, and the following standard theorem.
Using this theorem, it will suffice to show the following.
Claim: Let $U \subset X$ be an open subset. Then $\mathcal{O}_X(U) = \bigcap_{x \in U} \mathcal{O}_{X, x}$.
Proof: First, let's show that the restriction map $\varphi \mapsto [(\varphi, U)] \in \mathcal{O}_{X, x}$ is injective, so that we can view all the rings above as subrings of $K$, the fraction field of $A(X)$. This will also show the $\subseteq$ direction.
Let $\varphi$ and $\psi$ map to the same element of $\mathcal{O}_{X, x}$. Then, as functions they agree in a neighborhood $V \subset U$ of $x$. Then, $\varphi - \psi$ is a regular function on $U$ which vanishes on a dense open subset $V$ (since $U$ is irreducible in the subspace topology!) so it must vanish on all of $U$, since the vanishing locus of a regular function is closed.
(In Gathmann's notes, the above argument appears as the 'identity theorem for regular functions' in remark $3.5$.)
Next, we must show the reverse direction. Let $\varphi \in K$ be in the intersection above. Then, $\varphi$ is regular in a neighborhood of each $x \in U$, since $\varphi \in \mathcal{O}_{X, x}$. This implies that $\varphi$ is regular on $U$ by the definition of a regular function, which concludes the proof.