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.
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.