Section 18.2 Three Questions, Again
ΒΆDefinition 18.2.1.
Let r(n) be the number of (all!) ways to write n as a sum of (two) squares. (This was called r2(n) when first encounteredβ1βAlthough we briefly considered other \(r_k\) in Example 14.2.3, and we will see another example in the remarkable Theorem 25.8.1, it is usually more convenient to simplify the notation. in Exercise 13.7.7.)
Example 18.2.2.
For instance, r(25)=12. Why? Because you can write it using the pairs
Remember, we count all solutions, positive or negative, and in any particular order possible, in determining the value of r(n).
Subsection 18.2.1 Formulas
ΒΆIn Exercise 13.7.7, we saw that r(2m)=4. But we didn't discuss it enough to question whether there might be a formula that was easier to compute than the process of counting all possible sums! As an encouragement to our search for answers to our three questions, I will give you a (totally unmotivated!) formula. To see what it looks like, we use an extension of the Fundamental Theorem of Arithmetic.Fact 18.2.3.
Write the prime factorization of n as
where we write primes of the form 4k+1 as p, and primes of the form 4k+3 as q. Then
Proof.
Unfortunately, it turns out that every single proof of this is not very elementary. They all either go into some detail regarding factorization of Gaussian integers (recall our allusion to this in Fact 14.1.8), or they do some lengthy divisibility and congruence analysis. So we will skip the proof.
Sage note 18.2.4. Review quiz.
You can use various tools we've already seen to compute this with Sage, such as factoring and multiplication. Try it!
xxxxxxxxxx
β
Subsection 18.2.2 Relations
ΒΆWe just saw an impressive relation among values of Ο(n). As an example of it, Ο(5)Ο(3)=Ο(15), since the inputs are coprime. Similarly, there are some relations with multiplying for r, though it certainly isn't multiplicative.Example 18.2.5.
Indeed, now that we have a formula, we can compute this.
-
For instance,
r(3)r(5)=r(15)because both sides are zero!
For the same reason, r(8)r(7)=r(56).
-
On the other hand,
r(25)r(13)=12β 8=96β 24=r(325) Similarly, r(25)r(4)=12β 4=48β 12=r(100).
In these examples, the inputs are relatively prime but it doesn't multiply. What might still be true? See Exercise Group 18.3.1β2.
Sage note 18.2.6. Explore here.
Feel free to explore here!
xxxxxxxxxx
β
Subsection 18.2.3 Limits (and summation)
ΒΆIn Subsection 18.1.3 we saw that (for Ο) even though we couldn't yet address long term behavior, we could at least see some patterns, and could say something about summing values. In this subsection, we will try to directly address long-term, average behavior for r(n). To be precise, we will talk about limits with functions. Yes, limits in number theory! Observe the following graphic. It has as its basic content the circle with radius βn and blue lattice points representing all pairs (x,y) such that x2+y2β€n. There is a little box of area one around each such lattice point.
xxxxxxxxxx
def _(n=(5,[1..100])):
viewsize=ceil(math.sqrt(n))+2
a=(math.sqrt(n)+1/math.sqrt(2))^2
b=(math.sqrt(n)-1/math.sqrt(2))^2
g(x,y) = x^2+y^2
P=Graphics()
P += implicit_plot(g-n, (-viewsize,viewsize), (-viewsize,viewsize), plot_points = 200)
P += implicit_plot(g-a, (-viewsize,viewsize), (-viewsize,viewsize), linestyle='--',plot_points = 200)
P += implicit_plot(g-b, (-viewsize,viewsize), (-viewsize,viewsize), linestyle='--',plot_points = 300)
grid_pts = [[i,j] for i in [-viewsize..viewsize] for j in [-viewsize..viewsize]]
P += points(grid_pts,rgbcolor=(0,0,0),pointsize=2)
lattice_pts = [coords for coords in grid_pts if (coords[1]^2+coords[0]^2<=n)]
P += points(lattice_pts, rgbcolor = (0,0,1),pointsize=20)
squares=[line([[k-1/2,l-1/2], [k+1/2,l-1/2],[k+1/2,l+1/2], [k-1/2,l+1/2],[k-1/2,l-1/2]], rgbcolor=(1,0,0)) for [k,l] in lattice_pts]
for object in squares:
P += object
show(P, figsize = [5,5], xmin = -viewsize, xmax = viewsize, ymin = -viewsize, ymax = viewsize, aspect_ratio=1)
pretty_print(html("There are $%s$ boxes with a circle of radius $%s$"%(len(squares),math.sqrt(n))))
pretty_print(html("The ratio of the area of boxes to the square of the radius is $\\approx%s$"%(len(squares)/(math.sqrt(n)^2))))
Fact 18.2.8.
Observe that the boxes neither cover nor are covered by the circle in question. However, we can say two things about them.
These boxes will entirely cover a disk of radius βn minus half the diagonal length of the boxes, namely 1β2, which is the inner circle above.
Likewise, they are completely contained in a disk of radius βn plus half the diagonal length of the boxes.
Proof.
Geometry.
First, the limit as n goes to β of the lower and upper bounds with each of these inequalities exists. In fact, the limit of the bounds in both cases is Ο.
-
Then, the beloved squeeze theorem from calculus implies that
limnββ1nnβk=0r(k)=Ο. Finally, note that r(0)=1, so its presence or absence will not affect the average in the limit at all.
Fact 18.2.9.
The average number of representations of a positive integer as a sum of squares is Ο.
But it's true. And there's more to come.WHAT?!