Help proving polynomials division algorithm in $R[x]$ where $R$ is a domain. 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

 A: If the exercise given to you is

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)$.

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.
A: Hint If $\, \deg r,\deg R < \deg\,f\,$ and $\,qf+r=Qf+R\,$ then $\,\color{#c00}{(Q−q)f}=\color{#0a0}{r−R}.\,$ If $\,Q\neq q\,$ then, by lead coef of $f$ is a unit, $\,\deg\rm \color{#c00}{LHS} \ge \deg f > \deg {\rm\color{#0a0}{ RHS}}\Rightarrow\!\Leftarrow\,$ So $\,Q=q\,$ so $\,r−R=0$
A: You're supposed to prove that if one can write
\begin{cases}g(x)q(x)f(x)+r(x),\quad & r=0\;\text{ or }\;\deg r<\deg f,\\
g(x)q'(x)f(x)+r'(x),\quad & r=0\;\text{ or }\;\deg r'<\deg f
\end{cases}
in two ways, then $q=q'$ and $r=r'$.
Hint: deduce from these equalities that
$$\bigl(q(x)-q'(x)\bigr)f(x)=r'(x)-r(x).$$
Suppose $r\ne r'$and compare the degrees of both sides.
