Quadratic Character
In this post I want to write a bit about the following:
- Let p=4k+1 then −1 is a square mod p.
- Let p=3k+1 then −3 is a square mod p.
- Let p=8k±1 then 2 is a square mod p.
Background theory about polynomials
First we need a few generic theorems about polynomials, We'll apply them in Z, Fp and it's algebraic closure.
Theorem Let p be a polynomial with root p(α)=0 then (x−α)∣p(x).
Proof: This can be seen using the Euclidean division algorithm: p(x)=Q(x)(x−α)+R(x) with R(x) has degree 0: it's a constant but it must be zero.
Consequences
- x2−1 has roots 1 an −1 so equals (x−1)(x+1)
- x3−1 has a root x=1 so dividing out x−1 we find it equals (x−1)(x2+x+1)
- x4−1 equals (x2)2−1=(x2−1)(x2+1)=(x−1)(x+1)(x2+1)
Theorem A degree
n polynomial has at most
n roots
Proof: each root may be factored out to produce a polynomial with lower degree.
Theorem In a finite field Fpr, αp=α implies that α∈Fp.
Proof: By Fermats little theorem we know αp−1=1 holds for all p−1 nonzero elements of Fp, so it cannot hold for any other elements.
Lemma In a finite field (x+y)p=xp+yp.
The character of -1 mod 4k+1
Let p=4k+1 then by Fermats little theorem x4k≡1(modp) has 4k roots and factors as ((xk)2−1)((xk)2+1)≡0(modp) and this equation is solved if one of
- (xk)2−1≡0(modp)
- (xk)2+1≡0(modp)
holds. Since they are of degree
2k each of them is solved half the time.
This leads to an "randomized" algorithm for finding a square root of -1 mod p: Just pick a random number x and xk will be a square root of -1 with probability 1/2.
You can show that there is no solution mod 4k+3 by checking congruences.
The character of -3 mod 3k+1
Let p=3k+1, by Fermats little theorem x3k≡1(modp) and this factors as
- xk−1≡0(modp)
- x2k+xk+1≡0(modp)
the second equation being solved 2/3s of the time, and it leads to a square root of -3 since
4⋅(x2k+xk+1)≡(2xk+1)2+3≡0(modp) hence
(2xk+1)2≡−3(modp)
You can show that there is no solution mod 3k+2 by checking congruences.
The character of 2 mod 8k+1
Let 8k+1, then similar to before we reach
- x2k−1≡0(modp)
- x2k+1≡0(modp)
- x4k+1≡0(modp)
the last of which is solved 1/2 the time:
x4k+1≡(x2k+1)2−2x2k≡0(modp)
and thus (setting y to be the inverse of x)
(yk⋅(x2k+1))2≡2(modp)
The character of 2 mod 8k+7
2 is also a square mod 8k+7 but we can't show this in the same sort of elementary way. The proof from Serre - Course in Arithemtic uses the algebraic closure of the finite field to work with 8th roots of unity:
Let α be a primitive 8th root of unity so that α4=−1 and define y=α+α−1 so that y2=2.
Since yp=αp+α−p=α7+α−7=α−1+α=y we see that y lies in Fp.
I'm not sure how this last calculation could be used as an algorithm to find square roots of 2 mod 8k+7.