Question about polynomials over rings and elements in different rings.

So I'm working on some problems from a book and my proof doesn't seem right to me because I'm not sure if theorems in $\mathbb{Z}$ work since I use an element from $\mathbb{Q}$. Anyhow the question is as follows:

Let $f(x)=a_0+a_1x+...+a_rx^r$. Suppose $m/n \in \mathbb{Q}$ with $(m,n)=1$. If $m/n$ is a root of $f(x)$, then $m|a_0$ and $n|a_r$.

My proof is something along the lines of the following:

Let $m/n$ be a root of f(x). We then have $0=f(m/n)=a_0+a_1(m/n)+...+a_r(m/n)^r$. By some algebra we have $-na_0=m(a_1+...+a_r(m/n)^{r-1})$. Clearly $m|-na_0$, but (m,n)=1 and so $m|a_0$. To show that $n|a_r$ we would keep doing that algebra and see that $-(na_0/m)-(na_1/m)-...-(na_{r-1}/m)=a_r$....

I would proceed in the same way as the first half and show that $n|ma_r$ but (m,n)=1.

Does this work? Or would it fall apart because m/n is in $\mathbb{Q}$?

• No, you hve to clear the denominators to deduce divisibility in $\,\Bbb Z,\,$ e.g. see here for a common proof of the Rational Root Test. Or you can do it by induction on the degree using Bezout - see here. – Bill Dubuque Mar 9 '15 at 22:48

The claim that $\,m\,$ divides $\,-na_0\,$ is incorrect, because you have not proved that the quotient $\,a_1 + \cdots + a_r (m/n)^{r-1}\!\in \Bbb Z.\,$ The idea of reducing the degree can be made to work as follows.
$0\, =\, n f(\frac{m}n)\, =\, \color{#0a0}{na_0\! + a_1 m} + m a_2 (\frac{m}n) +\cdots + \color{#c00}{a_r m} (\frac{m}n)^{r-1}.\,$ By induction on the degree, $\, n\mid \color{#c00}{a_r m},\,$ so $\,n\mid a_r\,$ (by applying Euclid's Lemma, using $\,\gcd(n,m)=1)\,$ and, furthermore, $\,m\mid \color{#0a0}{na_0+a_1m},\,$ so $\,m\mid n a_0,\,$ so $\, m\mid a_0,\,$ again by Euclid. $\ \$ QED
Remark $\$ This proof of the Rational Root Test is closely related to a common proof, which trades off the above induction on degree for an induction in Euclid's Lemma, instead using $\,n\mid a_r m^r\,\Rightarrow\, n\mid a\,$ by inductive application of Euclid's Lemma. We can also use Bezout's Lemma in various ways to give a proof by induction on degree, e.g. see here.