## Finding (guessing) roots

Let $P(x) = a_n x^n + a_{n-1} x^{n-1} + \cdots + a_1 x + a_0$ be a polynomial of degree $$n$$ with integer coefficients (i.e. all $$a_i$$ are integers). Assume that $$P(x)$$ has a rational root $$c = \frac pq$$, where $$\frac pq$$ is an irreducible fraction. Prove that $$a_0$$ is divisible by $$p$$ and $$a_n$$ is divisible by $$q$$.
Expand the equation $$P(p/q) = 0$$.
If we expand $$P(p/q) = 0$$, we obtain $a_n \frac{p^n}{q^n} + a_{n-1}\frac{p^{n-1}}{q^{n-1}} + \cdots + a_1 \frac pq + a_0 = 0$ or $a_n p^n + a_{n-1}p^{n-1}q + \cdots + a_1 pq^{n-1} + a_0q^n = 0.$ All terms $$a_i p^i q^{n-i}$$ are divisible by $$p$$ for $$i \geq 1$$. So even the last term $$a_0 q^n$$ is divisible by $$p$$. But the values $$q^n$$ are relatively prime to $$p$$, because $$p/q$$ is an irreducible fraction. So $$a_0$$ is divisible by $$p$$. Similarly we can show that $$a_n$$ is divisible by $$q$$.