Suppose $a_0,a_1,\dots,a_n$are integers and $a_0\neq 0$ and $a_n\neq 0$.Consider the polynomial
$f(x)=a_0x^n+a_1x^{n-1}+\dots+a_{n-1}x+a_n$.
If $p\neq 0,q>0$ are coprime integers and $p/q$ is a rational root of equation $f(x)=0$,then show that $p|a_n$ and $q|a_0$, and that if $q>1$,then $p-mq$ divides $f(m)$ for any integer $m$.
Plug in
Then move $a_n$ to the RHS and clear denominators
Since $p$ divides the LHS it divides the RHS. Since $p\not\mid q$ it must be that $p|a_n$. Similarly by moving the first term over instead of the last we get
Again $q\not\mid p$ so $q\mid a_0$.
For the second part we just expand
Now subtract $q^nf(p/q)=0$ from $q^n$ times this.
$$q^nf(m)=q^nf(m)-q^nf(p/q)=a_0 \big((mq)^n-p^n\big)+a_1q\big((mq)^{n-1}-p^{n-1}\big)+\ldots+q^{n-1}a_{n-1}\big((mq)-p\big).$$
Then $q^nf(m)$ is divisible by $p-mq$ because
Clearly $\gcd(p-mq, q)$ divides $q$ and $p$ since $p=(p-mq)+m(q)$ hence coprimality implies this gcd is $1$. Hence $p-mq$ divides $f(m)$ if the former is a non-zero integer by the fundamental theorem of arithmetic--or a slightly weaker theorem that says $a|bc$ and $\gcd(a,b)=1$ implies $a|c$. Since $q>1$ we have that $p-mq\ne 0$ for all $m$ and the rest is history.