Show that if $ R $ is an integral domain then a polynomial in $ R[X] $ of degree $ d $ can have at most $ d $ roots
It is only mildly clear; you have to show that, when $R$ (and hence $R[x]$) is an integral domain, the degree function does in fact satisfy $$\text{deg}(fg)=\text{deg}(f)+\text{deg}(g).$$ Then you can argue that (by the factor theorem), if $a_1,\ldots,a_n$ were roots of $f$, then $f=(x-a_1)\cdots(x-a_n)g$ for some $g\in R[x]$, so that $\deg(f)=n+\deg(g)$ and $\deg(g)\geq0$, hence $\deg(f)\geq n$.
When $R$ is not an integral domain, we might have $\text{deg}(fg)<\text{deg}(f)+\text{deg}(g)$ (do you see why?)
Note $\, a_i\ne a_j\, \Rightarrow\, x\!-\!a_i\ $ are nonassociate primes in $R[x]$ since $ R[x]/(x\!-\!a_i) \cong R\:$ is a domain.
Hence $\ x\!-\!a_1\ |\ f(x),\, \ldots,\, x\!-\!a_n\ |\ f(x)\, \Rightarrow\ \ (x\!-\!a_1)\cdots (x\!-\!a_n)\ |\ f(x) $
since LCM = product for nonassociate primes. But this is contra degree if $\ n > \deg f$.
Remark $ $ When $\rm\:R\:$ is not a domain this argument fails since then $\: x\! -\! c\:$ is no longer prime, e.g. $\ (x\!-\!1)\, (x\!+\!1)\, =\, (x\!-\!3)\, (x\!+\!3)\ $ over $\rm\:\mathbb Z/8,\:$ so none of the factors are prime. Generally we have $\, D\,$ is a domain $\!\iff\!$ every polynomial $\,f(x)\neq 0\in D[x]\, $ has at most $\, \deg f $ roots in $\,D.\,$ For the simple proof see here, where I illustrate it constructively in $\,\Bbb Z/m\, $ by showing that given any $\,f(x)\,$ with more roots than its degree,$\:$ we can quickly compute a nontrivial factor of $\,m\,$ via a simple gcd computation. The quadratic case of this result is at the heart of many integer factorization algorithms, which try to factor $\:m\:$ by searching for a square root of $1$ that's $\not\equiv \pm1\,$ in $\: \mathbb Z/m$.