Section 13.3 A Lemma About Square Roots Modulo
We'll continue our formal investigation of what numbers are sums of two squares by taking a look at a seemingly unrelated lemma about square roots. In Section 14.1 we'll see that square roots of negative one (thinking of Definition 13.3.1.
We say that a number
Fact 13.3.2.
For an odd prime
Proof.
We will use group theory to prove this.
Assume there is a square root \(f\text{,}\) so that
Then the order of \(f\) in \(U_p\) is four, since
We know that the order
but then Lagrange's (group theory) Theorem 8.3.12 says that four divides \(p-1\text{.}\)
Given that, the only possible kind of prime \(p\) solving this is the form \(4k+1\text{.}\)
Lemma 13.3.3.
For an odd prime
Proof of Lemma 13.3.3.
Pair up the numbers from \(1\) to \(p-1\) in a product, in pairs of additive inverses (mod \(p\)):
This makes sense because \((p-1)/2\) is an integer halfway between \(1\) and \(p\text{,}\) as \(p\) is odd.
If we rethink things (mod \(p\)), we can rewrite this in a more suggestive way. Let \(\left(1\cdot 2\cdot 3\cdots \frac{p-1}{2}\right)\) be called \(f\text{.}\) This is also \(\left(\frac{p-1}{2}\right)!\text{,}\) of course. Then, keeping in mind that \(\frac{p+1}{2}=p-\frac{p-1}{2}\text{,}\)
Remember that our hypothesis is \(p\equiv 1\) (mod \(4\)). Then \(p=4k+1\) for integer \(k\text{,}\) so \(\frac{p-1}{2}=2k\) is even and by Wilson's Theorem
xxxxxxxxxx
def _(p=(13,[q for q in prime_range(200) if q%4==1])):
f=mod(factorial((p-1)/2),p)
pretty_print(html(r"The potential square roots of $-1$ are $\pm \left(\frac{%s-1}{2}\right)!=%s,%s\text{ (mod }%s)$"%(p,f,-f,p)))
pretty_print(html(r"And we can compute that ${0}^2\equiv{1}$ and ${2}^2\equiv {3}$ modulo ${4}$".format(f,f^2,-f,(-f)^2,p)))
Remark 13.3.4. A class act.
An observant reader may have noticed that when
xxxxxxxxxx
def _(p=(11,[q for q in prime_range(200) if q%4==3])):
f=mod(factorial((p-1)/2),p)
pretty_print(html(r"The potential square roots of $1$ are $\pm \left(\frac{%s-1}{2}\right)!=%s,%s\text{ (mod }%s)$"%(p,f,-f,p)))
pretty_print(html(r"And we can compute that ${0}^2\equiv{1}$ and ${2}^2\equiv {3}$ modulo ${4}$".format(f,f^2,-f,(-f)^2,p)))
Here comes the interesting part. If you play around with the interact, you will notice that sometimes
But there is a formula. Foreshadowing Definition 14.1.2, if we define the number system
The default setting of the interact above is for
There is a similar, but more complicated, formula when