Tuesday 20 February 2018

Fundamental Theorem on Sums of Two Squares

Today I achieved some further insights regarding what conditions allow a number to be expressed as a sum of two squares and then, if these conditions are met, to determine the number of ways in which this can be done. This useful site provided clear answers to these two matters. Firstly, the French mathematician Albert Girard had determined in 1632 (according to Leonard Dickson) that the numbers expressible as a sum of two integral squares were:
  • every square
  • every prime \( 4n+1 \)
  • a product formed of such numbers 
  • the double of one of the foregoing
The fundamental theorem on sums of two squares is:

Let \(n=2^kp_1^{a_1} \dots p_r^{a_r}q_1^{b_1} \dots q_s^{b_s}\) , where the \( p_i  \) are distinct primes with \( p_i \equiv 1 \pmod{4} \) and the \( q_i \) are distinct primes with \( q_j \equiv 3 \pmod{4} \). Then \(n \) is the sum of two squares if and only if all the \( b_j \) are even. In that case, the number of distinct solutions is \( \lceil \frac{\scriptstyle{1}}{\scriptstyle{2}} (a_1+1)(a_2+1) \dots (a_r+1) \rceil \), where \( \lceil x \rceil \) is the ceiling function, the smallest integer greater than or equal to \( x \).

What's of particular interest here is that the number of distinct solutions can be calculated. For example, consider the number \( 5^2 \times 13 \times 17 \times 29 = 160225 \) which can be represented as a sum of two squares because all the prime factors are of the form \( 4k+1 \). The number of distinct solutions can be found by adding 1 to all the indices of the factors, multiplying them together and dividing by 2. This gives \( 3 \times 2 \times 2 \times 2 \) divided by 2 which is 12. So there are twelve distinct ways in which this number can be expressed as a sum of two squares. 

The two square calculator provided at the site mentioned earlier displays eleven of these but oddly enough misses out on a twelfth arrangement, namely \( 300^2+265^2 \):

In determining what is the smallest number expressible as the sum of two different squares in two, three, four ways and so on, the \( 4k+1 \) primes are the key. These primes are 5, 13, 17, 29, 37, 41, ... and so the smallest number to be expressible on the sum of two squares in two different ways is 65 = 5 x 13, viz. \( 8^2+1^2 \text{ and } 7^2 + 4^2 \). Of course, I'm ignoring 25 which can be written as \( 3^2+4^2 \text{ and }0^2+5^2 \) because I'm only considering positive integers here. Similarly, the smallest number expressible as the sum of two squares in three different ways is 325 = 5 x 5 x 13:


Throwing 2's or 4k+3 primes into the factorisation doesn't increase the number of ways in which the number can be written as a sum of two squares. For example, 650 = 2 x 5 x 5 x 13 = 2 x 325 is still only expressible in three different ways:


It follows of course that every 4k+1 prime is expressible as a sum of two squares in one way only. For example, my birth year is \( 1949=10^2+43^2 \). My most recent prime day was \( 25153=57^2+148^2 \) and so it goes.

No comments:

Post a Comment