Let $f(x), g(x) \in R[x]$ where $R$ is a domain, if the leading coefficient in $f(x)$ is a unit in $R$ then the division algorithm gives a quotient $q(x)$ and a remainder $r(x)$ after dividing $g(x)$ by $f(x)$. Prove that $q(x)$ and $r(x)$ are uniquely determined by $g(x)$ and $f(x)$.
I understand this Rotman exercise as a proof for the division algorithm for $R[x]$ where $R$, is a domain, I suppose it refers to an integer domain. But for the division algorithm for $f(x), g(x) \in R[x]$ where $R$ is a domain we don't use the fact $K$ is a field, just the fact that the leading coefficient in $f(x)$ is a unit in $R$ in the existence part. Im troubled because the hint for this exercise mention as a hint using $\operatorname{Frac}(R)$ so maybe I didn't understand what Im supposed to prove. Any help showing me what I'm supposed to prove and how to do it? Thanks

If the exercise given to you is
then first of all there is a lot of sloppy notation; the symbols $x$ and $X$ are not interchangeable. Also, it seems to be implicit that $\deg r<\deg f$.
Second, it seems to be assumed that the division algorithm in $R[X]$ works, i.e. that it gives $q,r\in R[X]$ such that $g=qf+r$ and $\deg r<\deg f$. The question only asks to prove that these $q$ and $r$ are unique. That is to say, if $q',r'\in R[X]$ are such that $g=q'f+r'$ and $\deg r'<\deg f$, then $q'=q$ and $r'=r$.
To prove uniqueness, let $q,q,r,r'\in R[X]$ with $\deg r<f$ and $\deg r'<f$ be such that $$g=qf+r\qquad\text{ and }\qquad g=q'f+r'.$$ Then subtracting the two from eachother shows that $$(q-q')f=r'-r.$$ Of course $\deg(r'-r)<f$. Because $R$ is a domain, if $q-q'\neq0$ then $\deg\left((q-q')f\right)\geq\deg f$, a contradiction. Hence $q=q'$, from which it immediately follows that $r=r'$.
Note that this proof makes no use of the fraction field, but only of the fact that $R$ is a domain.