Proof for rational roots Let $f(x) = a_0+a_1x+\cdots+a_nx^n$ be a polynomial of degree $n$ over $\Bbb Z$. A: If a rational number $\frac{p}{q}$ is a root of $f(X)$, show that $p\mid a_0$ and $q\mid a_n$. Assume $\gcd(p, q) = 1$. We've discussed in class how to proof this if $f(X) = a_0\cdot a_1X\cdot a_nX^n$, but I'm not sure how to do this since each piece is added together instead. Would I go about this by factoring something out?
Any help on how to think about this problem is helpful.
B: Use part A to find all rational roots of the following polynomials, and factor them into irreducible polynomials in $\Bbb Q[X]$:
$$f(x) = 9x^3+18x^2-4x-8\tag{a}$$
$$g(x) = 6x^4-7x^3+8x^2-7x+2\tag{b}$$
I included part B, but am interested in solving A first (obviously).
Thank you
A: 
Part A:

Given $\frac pq$ is a rational root of a polynomial$$f(x)=a_nx^n+x_{n-1}x^{n-1}+\ldots a_0\tag1$$
Where $a_n\in\mathbb{Z}$. We wish to show that $p|a_0$ and $q|a_n$. Since $\frac pq$ is a root$$0=a_n\left(\frac pq\right)^n+\ldots+a_0\tag2$$
Multiplying by $q^n$, we have$$a_np^n+\ldots+a_0q^n=0\tag3$$
Examining this in module $p$, we have $a_0q^n\equiv 0(\text{mod} \text{ p})$. As $q$ and $p$ are relatively prime, we have $p|a_0$. And with the same logic for module $q$, we have $q|a_n$. Which completes the proof.
Note that this theorem is called the Rational Root Theorem!


Part B:
  Roots of $9x^3+18x^2-4x-8=0$

By the Rational Root Theorem, we have the possible roots as$$\begin{align*} & \pm1\pm2\pm4\pm8\\ & \pm1\pm3\\ & \implies\pm\frac 13,\pm\frac 23,\pm\frac 43,\pm\frac 83,\pm1,\pm2,\pm4,\pm8\end{align*}\tag4$$
Testing out the points, we find that $-2$ is a root. Thus, we can factor out $x+2$ from the polynomial to get$$(x+2)(9x^2-4)=0\tag5$$
For which we see the roots as $x=-2,x=\pm\frac 23$.


Part B:
  Roots of $6x^4-7x^3+8x^2-7x+2=0$

Using our handy Rational Root Theorem, we have the possible roots as$$\begin{align*} & \pm1,\pm2\\ & \pm1\pm2\pm3\pm6\\ & \implies\pm1,\pm\frac 16,\pm\frac 13,\pm\frac 12\pm2\end{align*}\tag6$$
After some handy guesswork, we see that $\frac 12$ is a root. Thus, we can factor out $2x-1$ to get$$(2x-1)(3x^3-2x^2+3x-2)=0\tag7$$
Fortunately, we can factor $3x^3-2x^2+3x-2$ by hand. We get$$3x^3-2x^2+3x-2\implies x^2(3x-2)+3x-2\implies (x^2+1)(3x-2)$$
Thus, our quartic can be factored as$$(2x-1)(3x-2)(x^2+1)=0$$
With roots $x=\frac 12,\frac 23,\pm i$
A: Suppose $p/q$ with $(p,q)=1$ is a root. Then
$$
0=f(p/q)=a_0+a_1(p/q)+\cdots+a_n(p/q)^n
$$
Multiplying by $q^n$, we have
$$
0=a_0q^n+a_1pq^{n-1}+\cdots+a_{n-1}p^{n-1}q+a_np^n.
$$
Note that $p|0$ and $p$ divides every term $a_jp^jq^{n-j}$ for $j\geq 1$ on the RHS above. It must be that $p|a_0q^n$. Since $(p,q)=1$, we infer that $p|a_0$. Similarly, $q|0$ and $q|a_jp^jq^{n-j}$ for all $j<n$. It must be that $q|a_np^n$, which together with $(p,q)=1$ once more, implies $q|a_n$.
