Sums of Two Squares
This is Lab 4 from Clint by Hugh Montgomery, edited by Elad Zelingher. All rights reserved to Hugh Montgomery.
Problem 1
Apply the program PolySolv to the polynomial . Take the modulus to be a prime number , and note that the congruence has no solution as proved in Theorem 2.12 of NZM. Take to be a prime . How many solutions are there? How are they related to each other? Try several different primes . Is the number of solutions always the same? Form a conjecture (This conjecture can be proved by applying Corollary 2.27, or by taking in Corollary 2.30 of NZM.). How many solutions are there when ? Let denote the number of solutions of the congruence . Use PolySolv to determine the value of , and for several small values of . Does a pattern emerge?
Problem 2
The program SumsPwrs will find all representations of as a sum of -th powers, by exhaustive searching. If is large compared with then the time required for this increases very rapidly with . Use SumsPwrs with input . Let denote the number of representations of as a sum of two squares. That is, the number of ordered pairs of integers such that . (Note that and/or may be negative.) Thus from SumsPwrs we find that . A representation is called proper if . Let denote the number of proper representations of . Using Factor, PolySolv, and SumsPwrs, determine entries for the table below:
Factorization | ||||
---|---|---|---|---|
5 | ||||
13 | ||||
17 | ||||
65 | ||||
91 | ||||
1105 |
The functions and are closely related. Can you spot the connection? (These functions are discussed in of NZM, as an application of the theory of binary quadratic forms.) Theorem 2.15 of NZM asserts that one can determine whether is a sum of two squares by inspecting the canonical factorization of . Is your data above consistent with this description?
Problem 3
Choose a prime number , and set . Use FctrlTab to find the value of . Then use WolframAlpha to confirm that . This is computationally slow when is large, because of the large number of multiplications required to evaluate the factorial. A much faster method for finding solutions of this congruence is found at the top of p. 111 of NZM. Once the congruence has been solved, the representation of as a sum of two squares can be found quickly, either by using the theory of binary quadratic forms (see Example 3 in of NZM), or by using continued fractions (as described in Problem 6. at the end of of NZM).
Problem 4
Let . If then has exactly one root for which . Let run over a collection of such primes. How are the numbers distributed in the interval ? It has long been conjectured that these quantities approach uniform distribution as runs over all primes , with tending to infinity. One could write a program to test how rapidly the distribution approaches uniformity. This conjecture was finally proved in 1994 (see W. Duke, J. B. Friedlander, and H. Iwaniec, Equidistribution of roots of a quadratic congruence to prime moduli, Annals of Math. (2) 141 (1995), 423-441). The proof is quite sophisticated, as it depends on the spectral theory of modular forms.
Problem 5
Let , as in Problem 3 above. What is , if ? Use FctrlTab to investigate, and recall Problem 18 on p. 57 of NZM. Of the two possibilities that occur here, it seems not to be known that both occur for infinitely many , although one might conjecture that each occurs asymptotically the time. One could write a program to generate statistical data. D. H. Lehmer showed that the two possibilities are connected to whether or , where is a class number of binary quadratic forms, as defined in Problem 13 on p. 163 of NZM..
In view of the definition of , it is clear that the sum is equal to the number of lattice points in the disk of radius centered at the origin. As the number of lattice points within a convex body differs from the area of that body by an amount that is at most proportional to the perimeter of that body. That is, . Applying this to the disk, we deduce that
Let denote the number of integers that can be expressed as a sum of two squares. One might think that the relation above suggests that as tends to infinity (i.e., the sums of two squares form a set of positive asymptotic density). However, Landau proved that
as tends to infinity. Here is a certain positive constant. The apparent discrepancy between these results is reconciled by recognizing that is usually 0 , but if then is likely to be large. The tools required to prove (2) are similar to those used in the analytic proof of the Prime Number Theorem: Dirichlet series, Euler products, contour integration, etc. For an exposition of this, see W. J. LeVeque, Topics in Number Theory, vol. II, Addison-Wesley, Reading, 1956, pp. 257-263.
It is known that the limiting approximation in (2) is approached only slowly. A more accurate approximation to could be constructed by introducing a second term on the right hand side of (2), of the form . Here is some appropriate constant. Still greater accuracy would be achieved by introducing a term , and so on. This is discussed by D. Shanks, The second-order term in the asymptotic expansion of , Math. Comp. 85 (1964), 75-86. It turns out that the constant in (2) is
where the product is taken over all prime numbers .