TITLE: This polynomial has integer coefficient
QUESTION [10 upvotes]: In another question, someone discussed about the fact that, if $p_1,\ldots,p_n$ is a list of integer, then the polynomial $$f=\prod_{e_1,\ldots,e_n\in\{\pm1\}}(x+e_1\sqrt{p_1}+\cdots+e_n\sqrt{p_n})$$ has integer coefficient. Can someone explain better this to me?
edit: the link of the previous question is Minimal Polynomial of $\sqrt{2}+\sqrt{3}+\sqrt{5}$, and you have to multiple factor for every possible choice of $e_1,\ldots,e_n\in\{\pm1\}$

REPLY [5 votes]: 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.