This polynomial has integer coefficient

Hint:   by induction, using nothing more than the identity $\,(a+b)(a-b)=a^2-b^2\,$:

$$ \prod_{e_1,\ldots,e_n\in\pm1}(x+e_1\sqrt{p_1}+\cdots+e_n\sqrt{p_n}) = \prod_{e_1,\ldots,e_{\color{red}{n-1}}\in\pm1} \big((x+e_1\sqrt{p_1}+\cdots+e_{n-1}\sqrt{p_{n-1}}+\sqrt{p_n})(x+e_1\sqrt{p_1}+\cdots+e_{n-1}\sqrt{p_{n-1}}-\sqrt{p_n})\big) = \prod_{e_1,\ldots,e_{n-1}\in\pm1} \big((x+e_1\sqrt{p_1}+\cdots+e_{n-1}\sqrt{p_{n-1}})^2 - p_n\big) $$

Repeat the same in order to prove that the base of the squared term has integer coefficients.


The polynomial $$p(x,y_1,y_2,...,y_n)=\prod_{e_i\in\{\pm1\}}(x+e_1y_1+...+e_ny_n)$$

satisfies $p(x,y_1,...,y_n)=p(x,e_1y_1,...,e_ny_n)$ for all $e_i\in\{\pm1\}$.

Therefore, $$p(x,y_1,...,y_n)=\frac{1}{2}\left(p(x,y_1,...,y_i,...,y_n)+p(x,y_1,...,-y_i,...,y_n)\right)$$

doesn't have terms in which $y_i$ appears to odd powers, since in the right-hand side all such terms are cancelled.

The coefficients of $P(x)=p(x,y_1,...,y_n)$ are polynomials in $y_1,...,y_n$ with integer coefficients. This is clear from the definition of $p$, since the coefficients are just sums and products of $\pm y_i$.

Therefore, $f(x)=p(x,\sqrt{p_1},...,\sqrt{p_n})$ has integer coefficients.


I assume that the question is: let $f\in \mathbb{Q}[x]$ such that $f$ has the given factorization in $\mathbb{C}[x]$. Show that $f\in \mathbb{Z}[x]$. Or maybe you are considering the product over all possible signs, which will be in $\mathbb{Q}[x]$ (explained in the comments). In any case, you can argue as follows:

The roots of $f$, which are those linear combinations of (plus minus) square roots of primes, are integral elements over $\mathbb{Z}$, because a sum of integral elements is integral. You may assume that your polynomial $f$ is irreducible (if not, split it in irreducible factors and argue the same for each of them). But then, you are looking at the minimal polynomial of those integral elements. By definition, this minimal polynomial must have coefficients in $\mathbb{Z}$.