Let $R$ be a noetherian integral domain and $K$ the quotient field of $R.$ Suppose $f \in K.$ Suppose for each maximal ideal $M$ of $R,$ we can find $h,k\in R$ so that $f = h/k$ and $k \not\in M$. Show $f \in R.$
Note: $R$ is not assumed a UFD!
My attempt: I tried to prove that the summation of ideals generated by all the k that are not in some maximal ideals is the whole ring. But I dont know how to use that to move on. Also, I do not understand how to show an element is in the ring. I tried to prove that k has to divide h, but since R is not a UFD, I am not sure to achieve that.
Define $I=\{a\in R: af\in R\}\subseteq R$. This is clearly an ideal of $R$. If we can show that $I=R$ then it means $1\in I$ and so $f\in R$, as we want. So suppose $I\ne R$. Then $I$ is contained in some maximal ideal $M$. By assumption, there are $h,k\in R$ such that $f=\frac{h}{k}$ and $k\notin M$. But then note that:
$kf=k\frac{h}{k}=h\in R$
And so $k\in I\subseteq M$, a contradiction.
Note that you don't even need $R$ to be Noetherian.