Proof of irreducibility in Z[x] when its reduction mod p has known factors Problem: 

Show that if a polynomial $f(x)$ in $\mathbb{Z}[x]$ of degree $n$ has no rational
  root, but for some prime $p$ its reduction mod $p$ has irreducible factors of
  degrees $1$ and $n - 1$, then $f$ is irreducible.

My attempt: Let $f(x) = a_0 +a_1 x+\ldots+a_n x^n$ and suppose that
its reduction modulo $p$, namely $g(x)$, has two factors of degree $1$ and $n-1$.  That is, degree of $g(x)$ is $n$, hence $p$ does not divide $a_n$. 
$f(x)$ has no rational root, and thus $g(x)$ has no rational root also ( I doubt myself on it).  Let $g(x) = g_1(x) g_2(x)$ where degree of $g_1$ is $1$ and degree of $g_2$ is $n-1$.  Now $g_1(x) = bx$ because if $g_1(x)$ has a constant term, then $g_1(x)$ has a rational root which leads to $g(x)$ has a rational root, and then $f(x)$ has a rational root also, contradiction. 
But I am not sure about it and do not know how to go further.
 A: Suppose for the sake of contradiction that $f(x)$ is reducible over $\mathbb {Z}[x]$.  That is $f(x)=f_1(x) f_2(x)$ for non-units $f_1(x),f_2(x)$.
Then taking residues mod $p$, we would have two factors of $g(x)$ congruent to $f_1(x),f_2(x)$ mod $p$. Since $g_1(x),g_2(x)$ are irreducible (prime) factors of $g(x)$, whose degrees sum to $n$, they must be associates of the reductions mod $p$ of $f_1(x),f_2(x)$.
Since the degrees of $f_1(x),f_2(x)$ also sum to $n$, it follows that their degrees also are $1$ and $n-1$. But having a factor of degree $1$ implies $f(x)$ has a rational root.  Contradiction.
A: Let$f(x) =a_0+a_1x+.....+a_nx^n\in Z[x]$
Suppose $f(x)$ is reducible and $f(x) = g(x) h(x)$ with degree of g, h < n. Further if degree of $g(x)$ is m then degree of $h(x)$ is n-m.
Let $\pi_pf(x)$ is polynomial reduction of $f(x)$ modulo p. $\pi_p f(x) =\pi_pg(x)*\pi_ph(x)$.WLOG degree of $\pi_pg(x)$ is n-1 and degree of $\pi_ph(x)$ is 1.
Hence, if $ h(x)=h_0+h_1x+h_2x^2+.....+h_{n-m}x^{n-m}$, and  $\pi_ph(x) = [h_0]+[h_1]x$.
That is $h_2,h_3,....,h_{n-m}$ divided by p.  
Moreover, the leading coefficient of $f(x)$ is $a_n$, and $\pi_pf(x) $has degree n also. That is $p~is ~not|a_n$. 
On the other hand $a_n=h_{n-m}*g_m$ divided by p as shown. Contradiction, hence f(x) is irreducible.
Suppose $h(x) =h_0+h_1(x) $, then $x=\frac {h_0}{h_1}$ is a rational root of f(x) contradiction. Hence f(x) is irreducible.
If $h(x) = h_1x$, then $f(x)$ has no constant term, that leads to $\pi_p(g(x) $has no constant term also, or $[g_0]=0$. But then, $\pi_pg(x)$ is reducible, contradiction. 
Hence f(x) is irreducible
