Section 16.3 Quadratic Residues
Subsection 16.3.1 Some definitions
We first introduce two definitions, a little more formal in nature.Definition 16.3.1.
Assume that
If there is a solution of
(mod ) we say that is a quadratic residue of (or a QR).If there is not a solution of
(mod ) we say that is a quadratic nonresidue of
Although some authors also define this notion for composite moduli (as does Sage, see Sage note 16.3.3), we will go with the majority of them and reserve these terms for prime moduli.
Remark 16.3.2.
By the way, the terminology is explained by the fact (recall Section 4.4) that the equivalence classes
Sage note 16.3.3. Quadratic residues.
Sage can calculate these for us, of course.
xxxxxxxxxx
quadratic_residues(17)
Notice that Sage counts zero as a quadratic residue (since
A separate function gives the smallest nonresidue, in case you need it.
xxxxxxxxxx
least_quadratic_nonresidue(17)
Subsection 16.3.2 First try for new square roots
To get more of a flavor for this, let's explore for whichxxxxxxxxxx
def _(odd_primes_up_to=50):
for p in prime_range(3,odd_primes_up_to):
solutions=solve_mod([x^2==2],p)
if len(solutions)!=0:
pretty_print(html(r"$x^2\equiv 2\text{ (mod }%s)$ has solutions $%s$ and $%s$"%(p,solutions[0][0],solutions[1][0])))
else:
pretty_print(html("No solutions modulo $%s$"%p))
Question 16.3.4.
What do you think? Do you see any patterns in when a square root of two exists?
Subsection 16.3.3 Some history
In fact, it is even hard to conjecture patterns for harder cases unless you are quite clever. Euler was one of the first to do so. In a very unusual paper, he included nary a proof, just closely related conjectures to this question. We list here three links related to the paper. Note that if you read it carefully, you will have hints to a solution of Question 16.3.4 in the previous subsection; look for numbers of the formEuler archive listing for original paper
Euler archive translation of the paper into English
Euler's work in this paper explained by Ed Sandifer (focusing on the cases
)
In Figure 16.3.5, Lagrange is referring to integers of the form
In Figure 16.3.6, Lagrange is referring to divisors of integers of the form
See also Theorem 42 of Euler's paper, and Theorem 16.7.1 where we will confirm this pattern.
Historical remark 16.3.7. Joseph-Louis Lagrange.
Originally from what is now Italy, Lagrange was Euler's successor in Berlin in the court of Frederick the Great, after Euler went back to Russia under the stable (if despotic) regime of Catherine the Great. One interesting point to make about him is that Lagrange gave proofs of many of the patterns in quadratic forms (what numbers look like
Although he isn't always mentioned quite as highly in the undergraduate literature as his contemporaries Euler or Gauss, note that we've already seen two of his theorems (7.4.1 and 8.3.12), and Euler himself anointed him as the best mathematician in Europe. Later he moved to France and remained quite influential (as well as managing to survive the Terror, which was not true for all academics at the time). And if you ever read any science fiction or space stuff that talks about stable places to orbit being called Lagrange points – that's him too!