Consider the following expression: $$ \sqrt{a_1} \pm \sqrt{a_2} \pm \dots \pm \sqrt{a_n} = 0. $$ We want to find the number of ways to change each $\pm$ into $+$ or $-$, so that the equation is true. One way to approach this problem is to pick a sufficiently large random prime number $p$, then find all the square roots in $GF(p^2)$ (they always exist), and then count the number of ways to satisfy the equation in $GF(p^2)$. With high probability, the answer in $GF(p^2)$ will be the same as in $\mathbb R$. But at the same time, it seems much harder to actually recover such combinations in $\mathbb R$ if they're known in $GF(p^2)$. That being said, assume that you know for sure that a particular combination of square roots in $GF(p^2)$ satisfies the equation. Is there any way to, using this information, recover any such combination that satisfies it in $\mathbb R$? I guess, what I'm actually asking is, given $p$, I want to algorithmically map each number from $1$ to $p-1$ to one of its two square roots in $GF(p^2)$ so that by substituting each $\sqrt{a_i}$ via this mapping in the expression above, I will be able to check with high probability that this specific way of changing $\pm$ to $+$ or $-$ is also valid in $\mathbb R$.