condition for $f(x)$ to be irreducible in $\mathbb{Q}$ when it is reducible in $\mathbb{Z}$ I have to find a condition on a polynomial $f(x) \in \mathbb{Z}[x]$ such that $f(x)$ is reducible in $\mathbb{Z}[x]$ but irreducible over $\mathbb{Q}$.
My attempt:        Let $f(x)$ be reducible over $\mathbb{Z}$ then for some  $a(x), b(x) \in \mathbb{Z} [x]$, we have $$f(x)=a(x). b(x)$$
           where $0\leq$deg($a(x)$), deg($b(x)$) $&lt;n$ ,and neither $a(x)$ nor $b(x)$ unit in $\mathbb{Z}[x]$
and I know that units in $\mathbb{Z}[x]$ are $1, -1$.
To ensure that this polynomial is reducible over $\mathbb{Z}$ but not over $\mathbb{Q}$ at least one of $a(x)$ or $b(x)$ has to be a constant different from $1,-1$
which clearly means that $f(x)$ cannot be primitive, because if it were so then it wasn't possible to write it as a product of a non unit constant integer and a polynomial with the same degree.
So, $f(x)$ has to be a non primitive polynomial
But, at the back of the textbook I'm using the answer is given"$f(x)$ is primitive"
Can someone tell me what I did wrong to arrive  at the opposite conclusion?

Thanks a lot!

P.S.: Alternate solutions/hints are welcome.
The polynomial $f(x)=2x-2$ is reducible in $\mathbb{Z}[x]$, because both $2$ and $x-1$ satisfy the definition.

On the other hand, $2x-2$ is irreducible in $\mathbb{Q}[x]$.

So it should be easy to find the condition: can there be other cases?

(Probably the book missed a “not”.)



Let's assume that $f(x)\in\mathbb{Z}[x]$ is irreducible when considered in $\mathbb{Q}[x]$, but not in $\mathbb{Z}[x]$. Then we can write a proper factorization
$$
f(x)=a(x)b(x)
$$
in $\mathbb{Z}[x]$, with neither $a(x)$ nor $b(x)$ being invertible. Since this is also a factorization in $\mathbb{Q}[x]$, one of the two factors (we can assume it is $a$) is invertible in $\mathbb{Q}[x]$, so it is a non zero constant in $\mathbb{Z}$.

Therefore the constant $a$ divides all coefficients of $f$ in $\mathbb{Z}$ and so $f$ is not primitive.

Conversely, a non primitive polynomial of positive degree is always reducible in $\mathbb{Z}[x]$.
It is true that the only way an irreducible polynomial over the rationals can be reducible over the integers is that it is not primitive. 

Maybe check if you did reproduce the question exactly. The answer in the textbook would answer: give a criterion for an irreducible polynomial over the rationals to be irreducible over the integers, which is almost but not quite the same.