There is a lemma (maybe called Gauss's lemma) that states that if we have a polynomial $p \in Z[X]$: $p$ is irreducible in $Z[X] \iff p$ is irreducible in $Q[X]$
Can anyone help me with the proof of this theorem? The sufficient condition is trivial somehow but proving the necessary condition is more difficult.
I tried to prove it by supposing that $p(x)=f(x)\,g(x)$ and trying to prove that $\deg(f)=0$ or $\deg(g)=0$ But I couldn't do it.
Lemma. Let $q\in\Bbb Z$ be a prime, $f,g\in\Bbb Z[X]$ and assume that $fg\in q\Bbb Z[X]$. Then $f\in q\Bbb Z[X]$ or $g\in q\Bbb Z[X]$.
Proof. Assume otherwise. Write $f(X)=a_0+a_1X+\ldots +a_nX^n$, $g(X)=b_0+b_1X+\ldots +b_mX^m$. By assumptions, both polynomials have some coefficients $\notin q\Bbb Z$. So let $r$ be minimal wit $q\nmid a_r$ and $s$ minimal with $q\nmid b_s$. Then the coefficient of $X^{r+s}$ in $fg$ is $$a_0b_{r+s}+a_1b_{r+s-1}+\ldots +a_rb_s+\ldots+a_{r+s-1}b_1+a_{r+s}b_0.$$ The summands $a_ib_{r+s-i}$ with $i<r$ are multiples of $q$ because $p\mid a_i$; those with $i>r$ are multiples of $q$ because $r+s-i<s$ and so $p\mid b_{r+s-i}$. As the whole sum is a multiple of $q$, so must be the only remaining summand $a_rb_s$. As $q$ is prime, it follows that one of $a_r, b_s$ is a multiple of $q$, contradiction. $\square$
Now back to the Assume $p(X)=f(X)g(X)$ in $\Bbb Q[X]$, but $p$ is irreducible in $\Bbb Z[X]$, and(!) that the leading coefficient of $p$ is $1$. We may assume wlog. that the leading coefficients of $f$ and $g$ are $1$. Let $n_f$ be the smallest natural number with $n_f(X)\in \Bbb Z[X]$ (in other words, $n_f$ is the smallest common denominator of the coefficients of $f$). Similarly, define $n_g$. If $n_f=n_g=1$, we are done as that means that $f,g$ are in fact $\in\Bbb Z[X]$. Hence we can assume $n_fn_g>1$ and let $q$ be a prime dividing $n_fn_g$. Then $n_ff(X)\cdot n_gg(X)=n_fn_g p(X)\in q\Bbb Z[X]$. By the lemma, one of one of $n_ff(X)$, $n_gg(X)$ must be $\in q\Bbb Z[X]$. If $n_ff(X)\in q\Bbb Z[X]$, then in particular the leading coefficient of $n_ff(X)$ is a multiple of $q$. Hence $q\mid n_f$. Then $\frac{n_f}qf(X)\in\Bbb Z[X]$, contradicting the definition of $n_f$. The corresponding contradiction occurs if $n_gg(X)\in q\Bbb Z[X]$ instead. $\square$
Note that without the condition that $p$ has leading coefficient $1$ (i.e., that $p$ is monic), the original claim becomes false: $2X$ is irreducible in $\Bbb Q[X]$, but in $\Bbb Z[X]$ we can decompose into two non-unit factors $2X=2\cdot X$.