# if $p$ is a prime such that $p \equiv 1 \pmod 4$ then the product of all the quadratic residues $\pmod p$ is congruent to $1$ mod $p$.

prove or disprove :

if $p$ is a prime such that $p \equiv 1 \pmod 4$ then the product of all the quadratic residues $\pmod p$ is congruent to $1$ mod $p$.

I think it is false statement for $p=5$ and all the quadratic residues will be look like $n^2$ where $n$ from $1$ and $2$

so $1 \cdot 4 =4 \equiv 4 \not \equiv 1 \pmod 5$ but I do not know how can I explain that , could you please help me?

• Perhaps you have misread. For prime $p\equiv 1 \bmod 4$, the product of the quadratic residues should be congruent to $-1 \bmod p$. – Joffan Dec 8 '17 at 2:58
• For $p=5$, the quadratic residues are $1$ and $4$. – Lubin Dec 8 '17 at 3:09
• – Gerry Myerson Dec 8 '17 at 3:11

Since $x$ is a quadratic residue iff $x^{-1}$ is a quadratic residue, any residue which is not self-inverse will cancel out with its inverse. Thus the product of all quadratic residues is equal to the product of all quadratic residues which are equal to their own inverse. The only possible such values are $\pm 1$, so this product is equal to $-1$ if $-1$ is a quadratic residue and $+1$ if it is not.
We will prove that this product is congruent $-1\pmod p$.
Let $p=4k+1$. Let $g$ be a primitive root modulo $p$. All quadratic residues modulo $p$ have form $g^{2s}$ for some $0\leq s\leq 2k-1$. Hence, product of all quadratic residues equal to $g^{\sum_{s=0}^{2k-1}2s}$, or $g^{2k(2k-1)}$. Note that $g^{2k}\equiv -1 \pmod p$, since $g$ is primitive root modulo $p$. Therefore, product of quadratic residues equal to $-1$.
Here is a proof putting the accent on the condition $p\equiv 1$ mod $4$, which means that $-1$ is a square in $\mathbf F_p^*$ (because $\mathbf F_p^*$ is a cyclic group of order $p-1$). In this case, $\mathbf F_p^*$ is the disjoint union of two subsets of cardinal $(p-1)/2$, ${\mathbf F_p^*}^2$ = {classes of quadratic residues} and its complement $C$ = {classes of non-residues}, and the "squaring" map $\pi: x\to x^2$ is a bijection of $C$ onto ${\mathbf F_p^*}^2$. The key remark is that $x^2=-x(p-x)$ in $\mathbf F_p$, so that the product in $\mathbf F_p^*$ of all the residues is $(p-1)!$ because $\frac {p-1}2$ is even, or equivalently $-1$ because of Wilson's theorem.