Quadratic Residues |
Let \(p\) be an odd prime and \(p\nmid a\) (which implies \(\gcd(a,p)=1\) ). Now we study those special values of \(a\) for which \(x^2 \equiv a \:\left(\mathrm{mod}\: p \right)\) has a solution, i.e., \(a\) is a square mod \(p\). If \(x^2 \equiv a \:\left(\mathrm{mod}\: p \right)\) has a solution, \(a\) is called a quadratic residue of \(p\) . Otherwise \(a\) is called a quadratic nonresidue of \(p\).
Example. Let us find quadratic residues of the odd prime \(p=7\). \[\begin{array}{llll} 1^2 &\equiv 6^2 &\equiv 1 &\:\left(\mathrm{mod}\: 7 \right)\\ 2^2 &\equiv 5^2 &\equiv 4 &\:\left(\mathrm{mod}\:7 \right)\\ 3^2 &\equiv 4^2 &\equiv 2 &\:\left(\mathrm{mod}\:7 \right) \end{array}\] So \(x^2 \equiv a \:\left(\mathrm{mod}\: 7 \right)\) has a solution when \(a=1,2,4\) and no solution when \(a=3,5,6\). Thus quadratic residues of \(p=7\) are \(1,2,4\) and quadratic nonresidues of \(p=7\) are \(3,5,6\).
Observation. Let \(p\) be an odd prime and \(p\nmid a\). Then \(p\) has exactly \((p-1)/2\) residues and \((p-1)/2\) nonresidues among \(1,2,\ldots,p-1\). The reason is \(x^2 \equiv a \:\left(\mathrm{mod}\: p\right)\) has either no or two solutions.
Theorem.(Euler's criterion, 1748) Let \(p\) be an odd prime and \(p\nmid a\). Then \(a\) is a quadratic residue of \(p\) if and only if \[ a^{\frac{p-1}{2}} \equiv 1 \:\left(\mathrm{mod}\: p \right).\]
Note that for an odd prime \(p\nmid a\), \[\left(a^{\frac{p-1}{2}}-1\right) \left(a^{\frac{p-1}{2}}+1\right)\equiv a^{p-1}-1\equiv 0 \:\left(\mathrm{mod}\: p \right).\] Then either \(p\vert \left(a^{\frac{p-1}{2}}-1\right)\) or \(p\vert \left(a^{\frac{p-1}{2}}+1\right)\). Because if \(p\) divides both, then \(p\vert 2=(a^{\frac{p-1}{2}}+1)-(a^{\frac{p-1}{2}}-1)\), a contradiction. Thus either \(a^{\frac{p-1}{2}} \equiv 1 \:\left(\mathrm{mod}\: p \right)\) or \(a^{\frac{p-1}{2}} \equiv -1 \:\left(\mathrm{mod}\:p \right)\).
Corollary. Let \(p\) be an odd prime and \(p\nmid a\). Then \(a\) is a quadratic nonresidue of \(p\) if and only if \[ a^{\frac{p-1}{2}} \equiv -1 \:\left(\mathrm{mod}\: p \right).\]
Example. Let us see whether \(a=4\) is a quadratic residue of \(p=7\). Since \(4^{\frac{7-1}{2}}\equiv 64 \equiv 1 \:\left(\mathrm{mod}\: 7 \right)\), So \(4\) is a quadratic residue of \(7\). Similarly for \(a=5\), \(5^{\frac{7-1}{2}}\equiv 125 \equiv 6\equiv -1 \:\left(\mathrm{mod}\: 7 \right)\). So \(5\) is a quadratic nonresidue of \(7\).
Last edited