Let $R$ be an integral domain, and let $X=\operatorname{Spec}(R)$. Show that all local rings $\mathcal{O}_X(U)$ - for nonempty open subsets $U\subseteq X$ - are subrings of the field of fractions $Q(R)$ of $R$.
I tried to use the definitions $\mathcal{O}_X(U)=\cap_{P\in U}\{f/g:f,g\in A(X),g(P)\neq 0\}$ where $A(X)$ is the coordinate ring of the variety $X$ and the ring of fractions $Q(R)=\{a/b:a,b\in R, b\neq 0\}$, but could not proceed further. Any hint would be highly appreciated. Thank you.
Well the field of fractions is the consisting of elements of the form $f/g, f,g \in A(X),$ with the ring operations defined as the usual operations on fractions. You've noted the definition of $\mathcal{O}_X(U)$ - it consists of things of the form $f/g, f,g \in A(X)$ plus some extra conditions, so it's certainly a subset. You want to show that it is a subring, so you need to further confirm that it 1) contains $1$ 2) is closed under addition and 3) is closed under multiplication. I'll do 3) and leave the rest to you.
Suppose we have two elements $f/g$ and $f'/g'$ of $\mathcal{O}_X(U).$ By definition, $g(P), g'(P)\neq 0 $ for all $P\in U.$ The product is equal to $\dfrac{ff'}{gg'}.$ Since $R$ is an integral domain, the fact that $g(P), g'(P)\neq 0 $ for all $P\in U$ implies that $(gg')(P) = (g(P))(g'(P))\neq 0$ for all $P\in U,$ and so $\dfrac{ff'}{gg'} \in \mathcal{O}_X(U).$