Section 16.5 Euler's Criterion
As it happens, Fact 16.4.5 is a terrible way to actually find quadratic residues for a given
xxxxxxxxxx
import matplotlib.pyplot as plt
from matplotlib.ticker import IndexLocator, FuncFormatter
def power_table_plot(p=(13,prime_range(50)[2:])):
mycmap = plt.get_cmap('gist_earth',p-1)
myloc = IndexLocator(floor(p/5),.5)
myform = FuncFormatter(lambda x,y: int(x+1))
cbaropts = { 'ticks':myloc, 'drawedges':True, 'boundaries':srange(.5,p+.5,1)}
P=matrix_plot(matrix(p-1,[mod(a,p)^b for a in range(1,p) for b in srange(p+1)]), cmap=mycmap,colorbar=True, colorbar_options=cbaropts, ticks=[myloc,myloc], tick_formatter=[None,myform])
show(P,figsize=6)
Theorem 16.5.2. Euler's Criterion.
If
We obtain
Proof.
Let \(g\) be a primitive root of \(p\text{,}\) so that \(a\equiv g^i\) for some \(i\text{.}\) Then if we let \(h=g^{(p-1)/2}\text{,}\) Fermat's Little Theorem shows that
Since \(g\) is a primitive root, \(h\equiv 1\) is impossible, so \(h\equiv -1\text{.}\) But then
This is \(+1\) when \(i\) is even and \(-1\) when \(i\) is odd. Finally, according to Fact 16.4.5, this is precisely when \(a\) is a quadratic residue and nonresidue, respectively.
Example 16.5.3.
This immediately gives the result in Fact 16.1.2 that
Example 16.5.4.
Let's use this to confirm, for
First, that list included
as expected.
Can we confirm that
which correctly shows