Skip to main content
Logo image

Section 13.1 Some First Ideas

Subsection 13.1.1 A first pattern

Let’s assume you’ve done some exploration on your own. Here’s a first pattern that you may have noticed, similarly to patterns in the past.
You should be able to prove this pretty easily based on things you already know about squares modulo 4. (See Exercise 13.7.1)
The next thing to note is that Sage has a nice command to tell us an answer.
If a representation doesn’t exist, we get an error. If it does, Sage returns two numbers \((a,b)\) such that \(a^2+b^2=\) your number.
In the next cell, I pick a number for which \(n\equiv 1\text{ (mod }4)\text{,}\) but this number cannot be written in this form. Thus Fact 13.1.1 doesn’t just take care of all cases.
Show that \(12\text{,}\) \(21\text{,}\) and \(6\) are not. (See Exercise 13.7.2.)
You can use this interact to explore while avoiding the errors.

Sage note 13.1.3. Handling errors.

Most computer languages have a way to “handle” errors if we don’t want to think of them as errors. In Python, this is the try/except syntax you see above. Basically, we are trying to use the two squares command, but if it hiccups, we instead just print a nice message.

Remark 13.1.4.

We have already addressed a very special case of writing numbers as a sum of squares. In fact, in Theorem 3.4.6 we saw a precise characterization of when a perfect square is a sum of two squares. We will mention this again briefly in Subsection 14.2.2.

Subsection 13.1.2 Geometry

Next, we can interpret this question very differently, relying on our geometric intuition. Figure 13.1.5 helps us visualize the problem.
Five as a sum of squares
Figure 13.1.5. Five as a sum of squares
In Figure 13.1.5, \(n=a^2+b^2\text{,}\) then \(n\) is the square of the radius of a circle which has \((a,b)\) as the coordinates of a point. So the sum of squares problem is actually a geometric one! Try it interactively below.
That is, we can rewrite Questions 13.0.1 and 13.0.5 like this.

Question 13.1.6.

  • Which circles around the origin do (or do not) have lattice points?
  • If a circle has lattice points, how many does it have?
We will choose to address these questions by connecting to geometry. There are many ways; for instance, in Section 20.1 we will connect to calculus ideas in number theory.

Subsection 13.1.3 Connections to some very old mathematics

The following identity was, separately, already known to Diophantus (remember Diophantine equations?) around 250, to Brahmagupta (about whom more in Historical remark 15.5.6 and Section 15.6) around 600, and to Leonardo of Pisa (known also as Fibonacci) around 1250.
This sort of identity may seem amazing to us, but to people used to needing lots of symbolic manipulation, it was just part of a toolkit by the time number theory began ascending with Fermat or Euler.

Historical remark 13.1.8. Fibonacci.

Leonardo of Pisa 4  grew up among Italian merchants in North Africa and learned much mathematics there; we have seen him a few times already in his eponymous numbers (Exercise 2.5.17) and in Exercise 5.6.22. However, while it seems pretty clear Fibonacci borrowed extensively from the Islamic mathematical heritage for many of his problems, not only was his Liber Abaci very influential for spreading our modern decimal system into Europe (from India via the Islamic world), but he did nontrivial original number theory work as well (see [E.5.3, Section 8-4]).
What is useful about this identity is that it implies the following.
A final question for the reader is to ponder why this means that we can really reduce the question to whether primes are writeable as a sum of squares.
mathshistory.st-andrews.ac.uk/Biographies/Fibonacci/