I have to solve the following exercise:
Let $R$ be a unique factorization domain and $f \in R[x]$ a polynomial with leading coefficient $a_n$ and constant coefficient $a_0$. Furthermore $p,q \in R$ coprime with $f(\frac{p}{q})=0$. Prove $p\vert a_0$ and $q\vert a_n$.
I have seen the proofs on wikipedia https://en.wikipedia.org/wiki/Rational_root_theorem) and in this thread Rational root theorem.
I understand the arguments but my concern is am I allowed to multiply with $q^n$ and shorten the fractions in an UFD? Especially what means $ \frac{p}{q}$ in a UFD? My guess was that this is an element of the quotientfield in it's unique reduced representation. But isn't this mixing of elements of different types then?
The rational root theorem for UFDs is this:
The proof is the same as for $D=\mathbb Z$.