I certainly have a deeper understanding now of what numbers can be expressed as a sum of two squares and in how many ways. See my earlier posts:
There's certainly some overlap in these posts but mostly they've dealt with numbers of the form \(x^2+y^2 \) rather than \(ax^2+by^2 \) where \(a \) and \(b \) are integers. It's the latter type of expression that I want to explore in this post. My interest was stimulated by today's diurnal age number, 25229, that happens to be a 4k+1 prime.
As a 4k+1 prime, it can be expressed as a sum of two squares in one way only, viz. \( 98^2+125^2 \). However, it turns out that it can be expressed a sum of two squares multiplied by varying coefficients in many different ways. I created some Sage code to investigate:
number=25229 #enter any number
x,y = var('x'),var('y')
a,b = var('a'), var('b')
for a in range(100):
for b in range(100):
for x in range(sqrt(number)):
for y in range(sqrt(number)):
if a * x^2 + b * y^2 == number:
if a < b:
print(a, b, x, y)
Running this code on the SageMathCell Server generated the following results for
a <100 and
b < 100. The first number represents
a, the second
b, the third
x and the fourth
y. For example, the first entry (1, 4, 125, 49) represents \(125^2+4 \times 49^2 \).
(1, 4, 125, 49)
(1, 5, 27, 70)
(1, 7, 41, 58)
(1, 13, 101, 34)
(1, 20, 27, 35)
(1, 25, 98, 25)
(1, 28, 41, 29)
(1, 29, 75, 26)
(1, 49, 125, 14)
(1, 52, 101, 17)
(1, 65, 42, 19)
(1, 85, 152, 5)
(1, 91, 127, 10)
(1, 97, 94, 13)
(2, 3, 61, 77)
(2, 11, 105, 17)
(2, 21, 110, 7)
(2, 51, 37, 21)
(3, 26, 9, 31)
(4, 25, 49, 25)
(4, 65, 21, 19)
(4, 85, 76, 5)
(4, 97, 47, 13)
(5, 6, 71, 2)
(5, 9, 70, 9)
(5, 19, 11, 36)
(5, 24, 71, 1)
(5, 46, 61, 12)
(5, 59, 45, 16)
(5, 69, 8, 19)
(5, 76, 11, 18)
(5, 81, 70, 3)
(5, 89, 69, 4)
(6, 53, 56, 11)
(7, 22, 31, 29)
(7, 29, 60, 1)
(7, 46, 53, 11)
(8, 21, 55, 7)
(9, 20, 9, 35)
(9, 29, 25, 26)
(9, 65, 14, 19)
(11, 18, 17, 35)
(11, 50, 17, 21)
(11, 98, 17, 15)
(13, 29, 36, 17)
It would be interesting to see the full range of possibilities for
a, b, x and
y. However, for larger values of
a and
b, the SageMathCell Server seems to time out. It is easy to see how the case of (1, 4, 125, 49) comes about because: $$125^2+(2 \times 49)^2 =125^2+(2 \times 49)^2 = 125^2+ 4 \times 49^2 $$ However, in the case of (2, 3, 61, 77) where \( (\sqrt{2} \times 61)^2+ (\sqrt{3} \times 77)^2 = 25229 \), it's far from clear how the result comes about.
It's probably better to start investigating with a smaller 4k+1 prime such as 61. Now \( 61=5^2+6^2 \) and there is only one possibility with coefficients and that is \( 4 \times 2^2+5 \times 3^2 \). Similarly with \(73=3^2+8^2 \), there is only one possibility and that is \(5 \times 3^2+7 \times 2^2 \). With \(97=4^2+9^2 \), there are two possibilities: \( 4 \times 2^2 + 9 \times 3^2 \) and \(5 \times 3^2+13 \times 2^2 \).
It can be noted that 4k+3 primes such as 43, while not able to be represented as a sum of two squares, can be represented as a sum of squares with coefficients: \( 3 \times 3^2+4 \times 2^2 \). Essentially, the elements of the set of all multiples of the square numbers (let's call the set S) are being combined with themselves by addition to form a set of new numbers (let's call this set N). This set consists of \(1^2 =1\) and the multiples of 1 are the natural numbers. This of course is trivial because it means for any number n can be written as \( (n-m) \times 1^2 + m \times 1^2 \) where \( m<n \).
This result means that it is necessary to exclude 1 from our investigation and begin with \( 2^2=4 \). So all multiples of 4 are permissible, as are all multiples of 9, 25, 36, 49, 64, 81 and so on. In this scheme, the smallest possible number would be \(2^2+2 \times 2^2=12 \) with \( 2^2+2^2=8 \) being ignored since we know the rules governing the requirements for a number to be a sum of two squares. This means that coefficients must not be perfect squares and thus \(2^2+4 \times 2^2 =2^2+4^2 = 20 \) is not acceptable. Even coefficients that add to perfect squares when the squared terms are the same must be excluded.
Thus \(2^2+3 \times 2^2 = 2^2 \times (1+3) = 2^2 \times 4 = 4^2 =16 \) falls victim. From the outset, it's clear that certain numbers (apart from the numbers 1 to 11) cannot be represented by any combination of multiples of squares: 14, 15, 17, 18, 19, 20, 21 and 23. However, it seems clear that every number above 23 can be represented either as:
- a perfect square e.g. \(25=5^2 \)
- a multiple of a perfect square e.g. \( 50=2 \times 25 \)
- a sum of two different squares e.g. \(25=4^2+3^2 \)
- a sum of the multiples of two squares e.g. \(25=4 \times 2^2 +3^2 \).
I've not proved this by any means but it seems highly likely, given the increase in possibilities as the numbers get larger. So the main takeaway from all this is that \( ax^2+by^2=23 \) is the last ellipse in the family of ellipses \( ax^2+by^2=N \), where N is a natural number and a>1 and b>1, that does not have integer solutions for a, b, x and y.