I don't think the definition of variety that you choose is important here, but in case you want mine, here it is: an algebraic variety over $k$ is a $k$-space $(X,\mathcal{O}_X)$ such that for all $x\in X$ there is an open $U\subset X$ such that $x\in U$ and $(U, \mathcal{O}_X|_U)$ is isomorphic (in $k$-spaces) to $(Y,\mathcal{O}_Y)$ with $Y\subset \mathbb{A}^n$ closed for some $n$, and $\mathcal{O}_Y$ the sheaf of regular functions.
Now that we've clarified this, let $(X,\mathcal{O}_X)$ be an algebraic variety. I have this definition for the function field of $X$: $$K(X)=\{ (U,f):U\subset X \text{ open dense }, f\in \mathcal{O}_X(U)\}\backslash\sim$$ where $(U,f)\sim(V,g)$ if and only if $f=g$ on $U\cap V$.
I am told that this is the fraction field of $\mathcal{O}_{X,P}$. I don't understand why this is true. Can someone help me see this?
Edit This is how I define $\mathcal{O}_{X,P}$. Pick an arbitrary $P\in U$. We define the local ring of $X$ at $P$ as follows:
$$\mathcal{O}_{X, P}:=\left\{(U, f): U \subset X\right. \text{ is open, } P \in U, \text{ and }\left.f \in \mathcal{O}_X(U)\right\} / \sim,$$
Please beware that I am not familiar with scheme theory.
This claim is only true when $X$ is irreducible, so we assume that was just omitted from the problem statement.
First we reduce to the case $X$ affine. Since $X$ is irreducible, any nonempty open subset is dense and any two nonempty open subsets meet, so if $X'\subset X$ is a nonempty open subset, then $K(X)\cong K(X')$ by the map $(U,f)\mapsto (U\cap X',f|_{U\cap X'})$ for $U\subset X$ and $(U',f')\mapsto(U',f')$ for $U'\subset X'$. Similarly, for any open $X'$ also containing $P$, we have $\mathcal{O}_{X,P}\cong\mathcal{O}_{X',P}$ via the map $(U,f)\mapsto (U\cap X',f|_{U\cap X'})$ for $U\subset X$ containing $P$ and $(U',f')\mapsto(U',f')$ for $U'\subset X'$ also containing $P$.
Next we show that for $X$ affine, $K(X)=\operatorname{Frac} \mathcal{O}_X(X)$. There's a map $\mathcal{O}_X(X)\to K(X)$ by $f\mapsto(X,f)$ which induces an injective morphism $\operatorname{Frac} \mathcal{O}_X(X)\to K(X)$, and we need to show this is surjective. Let $(U,f)\in K(X)$, and let $Z = X\setminus U$, the closed complement of $U$ in $X$. Then $Z=V(I)$ for some nonzero ideal $I\subset\mathcal{O}_X(X)$, and picking a nonzero $g\in I$, we have $\emptyset\neq D(g)\subset U$ . So we may assume $f\in\mathcal{O}_X(D(g))=(\mathcal{O}_X(X))_g$, and therefore every element of $K(X)$ can be represented as $f/g$ for $f,g\in\mathcal{O}_X(X)$ and $g\neq 0$. But that's exactly $\operatorname{Frac} \mathcal{O}_X(X)$.
Now since every $f\in\mathcal{O}_X(X)$ defines an element of $\mathcal{O}_{X,P}$ via $f\mapsto (X,f)$ and every $(U,f)\in\mathcal{O}_{X,P}$ defines an element of $K(X)$ via $(U,f)\mapsto(U,f)$, we have a chain of injective maps $\mathcal{O}_X(X)\to\mathcal{O}_{X,P}\to K(X)=\operatorname{Frac} \mathcal{O}_X(X)$ so that the composite is equal to the natural inclusion of $\mathcal{O}_X(X)$ in its field of fractions. But this implies that $\operatorname{Frac}\mathcal{O}_{X,P} = \operatorname{Frac} \mathcal{O}_X(X) = K(X)$ too.