The product of both quadratic residues and non residues in a residue system modulo prime p

prime numbersprimitive-rootsproductsquadratic-residuesreduced-residue-system

Compute the product of all the quadratic residues $a$ where $(a, p) = 1$ in a residue system modulo $p$ where $p$ is prime. Similarly, compute the product of all the quadratic nonresidues in a residue system modulo $p$.

My attempt:
Since $p$ is prime, we know there exists a primitive root $g.$ The quadratic residues are the even powers of $g$ $(g^2, g^4, … g^{p-1})$. All these residues have greatest common denominator with $p$ equal to $1.$ The quadratic nonresidues are the odd powers of $g$ $(g^1, g^3, … g^{p-2})$. I am stuck at this point, as I am not sure how to use these ideas to express the product of the quadratic residues and nonresidues.

Best Answer

If $p=2$, both products are $1$, so we assume that $p$ is odd. By rules of exponents, the product of the quadratic residues is $$R=g^{(p-1)(p+1)/4}$$ and the product of the quadratic non-residues is $$N=g^{(p-1)(p-1)/4}.$$ Note that the product of all the residues is $-1$. (Each element $x$ cancels with its inverse unless $x$ is its own inverse, and $x^2=1$ has only the solutions $x=\pm 1$.)

If $n\equiv1\pmod4$, then $\frac{p-1}{4}$ is an integer $k$, so that $N=\left(g^{p-1}\right)^k=1$ and therefore, $R=-1$. Similarly, if $n\equiv3\pmod4$, then $\frac{p+1}{4}$ is an integer, so $R=1$ and $N=-1$.