Well definition of multiplicity of a root in a polynomial of ring. Let $R$ be a conmutative ring with identity, let $\displaystyle f=\sum_{k=0}^{n}a_k x^k \in R[x]$ and $r\in R$. If $f=(x-r)^m g$, $m\in\mathbb{N}$ and $g\in R[x]$ with $g(r)\neq 0$, then the root $r$ is said to have $multiplicity\,\,\, m$. If the multiplicity is 1 the root is called simple.
How to prove that the above definition of the multiplicity of a root is well defined?
 A: we will prove that the map $(x-r)\cdot -: R[x] \to R[x]$ is injective, then from $(x-r)^m g = (x-r)^{m'} h$ with $m \le m'$ say, we can conclude $g = (x-r)^{m'-m}h$ but $g(r) \ne 0$, hence $m'-m = 0$,  so $m = m'$.
Let $p= \sum_{k=0}^n a_kx^k \in R[x]$ with $a_n \ne 0$, then $(x-r)p = a_n x^{n+1} + g$ with $\deg g \le n$. As $a_n \ne 0$, $(x-r)p \ne 0$. So $(x-r)\cdot -$ is injective, as we wanted to prove.
A: Theorem. Let $R$ be a commutative ring with $1$, and let $g(x)$ be a polynomial whose leading coefficient is not a zero divisor in $R$. Then for all nonzero polynomials $q(x)$, $\deg(qg) = \deg(q)+\deg(g)$.
Proof: Let $g(x) = a_nx^n+\cdots + a_0$, $q(x) = b_mx^m+\cdots+b_0$, where $b_m\neq 0$. The putative leading term of $q(x)g(x)$ is $a_nb_mx^{n+m}$; since $a_n$ is not a zero divisor, and $b_m\neq 0$, then $a_nb_m\neq 0$, so the degree of $qg$ is indeed $n+m$, as claimed. $\Box$
Corollary. Let $R$ be a commutative ring with $1$, and let $g(x)$ be a polynomial whose leading coefficient is not a zero divisor. If $q(x)g(x) + r(x) = q'(x)g(x)+r'(x)$, where each of $r$ and $r'$ is either $0$ or has degree strictly smaller than $g$, then $q(x)=q'(x)$ and $r(x)=r'(x)$.
Proof. We have $(q(x)-q'(x))g(x) = r'(x)-r(x)$. If $q\neq q'$, then the degree of the left hand side is at least $\deg(g)$, but the degree of the right hand side is strictly smaller than $\deg(g)$, a contradiction. So $q=q'$, hence $r'(x)=r(x)$, as desired. $\Box$
Corollary. If $(x-a)^nq(x) = (x-a)^mq'(x)$, with $q(a)\neq 0$, $q'(a)\neq 0$, and $n,m$ positive integers, then $n=m$.
Proof. Without loss of generality, assume $n\leq m$. Then we have $(x-a)^nq(x)+0 = (x-a)^n\Bigl( (x-a)^{m-n}q'(x)\Bigr) + 0$. Therefore, $q(x)=(x-a)^{m-n}q'(x)$; evaluating at $a$, we get $q'(a)(x-a)^{m-n}=q(a)\neq 0$, so $m-n=0$. $\Box$
Corollary. The notion of multiplicity of a root in a polynomial ring over a commutative ring with $1$ is well-defined.
A: More generally, for $\rm\!\ c\in R\!\ $ any ring, every $\rm\!\ r\ne 0\,$ may be written uniquely in the form $\rm\!\ r = c^n\,\! b,\,$ where $\rm\,c\nmid b,\,$ assuming $\rm\,c\,$ is cancellable, and only $0\,$ is divisible by arbitrarily high powers of $\rm\,c.\,$  Indeed,  by hypothesis there exists a largest natural $\rm\,n\,$ such that $\rm\,c^n\,|\,r,\,$ hence $\rm\,r = c^n\, b,\ c\nmid b.\,$ Suppose $\rm\,r = c^k\:\! d,\ c\nmid d.\,$ If $\rm\,k < n,\,$ then cancelling $\rm\,c^k\,$ in $\rm\,c^n\:\! b = c^k\:\!d\,$ yields $\rm\,c^{n-k}\:\!b = d,\,$ so  $\rm\,c\,|\,d,\,$ contra hypothesis. Thus $\rm\,k = n,\,$ so cancelling $\rm\,c^k\,$ yields $\rm\,b = d,\,$ thus uniqueness. $\bf\small QED$
Your special case follows by applying the above to the cancellable element $\, {\rm c} = x-r\in R[x],\,$ which clearly satisfies the bounded divisibility hypothesis: $\,(x\!-\!r)^n\,|\,f\ne0\,\Rightarrow\, n\le \deg\ f.$
