Polynomial of squares vs polynomial of square root Let $f\in \mathbb{R}[X_1,\ldots,X_n]$ be a polynomial in $n$ variables such that for all $(a_1,\ldots,a_n),(b_1,\ldots,b_n) \in \mathbb{R}_{>0}^n$ with $f(a_1,\ldots,a_n)=0=f(b_1,\ldots,b_n)$ the following holds
$$
f(a_1 b_1,\ldots,a_n b_n)=0.
$$
Let $(a_1,\ldots,a_n) \in \mathbb{R}_{>0}^n$ with $f(a_1,\ldots,a_n)=0$. We can follow that $f(a_1^2,\ldots,a_n^2)=0$ holds (for $b=a$). Is it also true that
$$
f\left(\sqrt{a_1},\ldots,\sqrt{a_n}\right) = 0\text{ ?}
$$
The motivation comes from real algebraic Lie groups, where the entries in a diagonal matrix have to satisfy certain polynomials. An example for such a polynomial comes from the determinant $=1$ -condition and is given by 
$$
f(X_1,\ldots,X_n)=\prod_{i=1}^nX_i -1 .
$$
I have only managed to prove it for $n=1$, but I think it should always be true.
 A: For the case $N=2$. Write $f(x,y)=\sum_{i,j} c_{i,j}x^iy^j$. If $f(a,b)=0$, then by assumption $f(a^n,b^n)=0$ for all $n\in \mathbb{N}$. That is $\sum_{i,j}c_{i,j} (a^{i}b^{j})^n=0$ for all $n\in \mathbb{N}$. We can rearrange the indices to write the last equation in the simplified form $$\sum_i c_i \alpha_i^n=0.$$
If the $\alpha_i$'s are distinct, then the corresponding Vandermonde matrix is invertible, so $c_i=0$. Hence $c_{i,j}=0$, and consequently $f=0$. If the $\alpha_i$'s are not distinct, then $a^ib^j=a^kb^l$ for some $i,j,k,l$. That is $(a,b)=(a,a^t)$ for some $t=p/q\in \mathbb{Q}$, $q>0$. Consider (eventually a Laurent polynomial) $$g(x)=\sum_{i,j} c_{i,j} x^{qi+pj}.$$
We have $g(a^n)=0$ for all $n\in \mathbb{N}$. If $a\neq 1$, then $g$ has infinitely many roots, so $g=0$. In particular $f(\sqrt{a},\sqrt{b})=f(\sqrt{a},a^{t/2})=g(a^{1/2q})=0.$
Thus, in general, if $f(a^n,b^n)=0$ for all $n\in\mathbb{N}$ then $f(\sqrt{a},\sqrt{b})=0$.
I don't see how to generalize this to $N>2$. As for the examples of polynomials satisfying the above property, there is the family $f_{k,l}(x,y)=x^k-y^l$. Is there any other that is nontrivial?
