This is Question 19.8 of $Abstract\ Algebra:\ A\ First\ Course$ by Dan Saracino.
Let $\mathbb{F}$ be a fieald, $f(X) \in \mathbb{F}[X]$. If $a$ is a root of $f(X)$, then we can write $f(X)=(X-a)^mg(X)$, where $m \ge 1$ and $X-a$ does not divide $g(X)$. Show $m$ is uniquely determined by $f$ and $a$. That is if $f(X)=(X-a)^rh(X)$ and $X-a$ does not divide $h(X)$, then $m=r$.
Without loss of generality, I consider $r \ge m$. Then, $$(X-a)^m((X-a)^{r-m}h(X)-g(X))=0.$$ So $$\forall X\ne a,\ \ (X-a)^{r-m}h(X)=g(X).\ \ \ (1)$$
Now, one may say if $r>m$, then $X-a$ divides $g(X)$, which is a contradiction. Hence $r =m$. However, I think this argument does not work since (1) only works for $X \ne a$. Indeed, (1) does not imply $g(a)= 0$.
What should I do now to prove the statement?