Let a, b be positive integers. When
k = | a2 + b2 |
ab + 1 |
is an integer, it is a square.
Proof:
We will refer to this as Equation (*) hereafter.
We will first prove the trivial case where a = b. If a = b, this becomes
k = | 2a2 |
a2 + 1 |
or
k = | 2 |
1 + 1/(a2) |
Because a > 0, the denominator is greater than 1, so k < 2. Since k is a positive integer, k can only be 1. This means that a = 1. Since a = b, b = 1. The statement is trivially true. Conversely, if k = 1, we have
a2 + b2 = ab + 1
(a − b)2 = 1 − ab
1 − ab ≥ 0
ab ≤ 1
To further simplify the proof, we can exclude the special case a > b = 1, and k > 1 as well. When b = 1, we have
k = | a2 + 1 | = a + 1 − | 2a |
a + 1 | a + 1 |
This means that 2a is divisible by a + 1. In other words, 2a = m (a + 1), (2 − m)a = m for some positive integer m. But from 2 − m > 0 we conclude that 2 > m, m = 1, so 2a = a + 1, and a = 1, k = 1 as well.
Therefore, without losing generality, we can assume that a > b > 1, and k > 1.
Multiply both sides of Equation (*) by b, we have
a2b + b3 | = kb |
ab + 1 |
Perform long division by (ab + 1), we get:
(ab + 1 − 1)a + b3 | = kb |
ab + 1 |
(ab + 1)a + b3 − a | = kb |
ab + 1 |
a + | b3 − a | = kb |
ab + 1 |
"Move" a to the right:
b3 − a | = kb − a |
ab + 1 |
This leads to
b3 − a = (kb − a)(ab + 1)
There are three possible cases: 1. (kb − a) > 0, 2. (kb − a) < 0, and 3. (kb − a) = 0.
Case 3 means that b3 − a = 0, a = b3. Substitute this into Equation (*), we get k = b2, which proves the original statement to be true. So we only need to prove that Case 1 and Case 2 are either not possible or yield a k = c2 for some integer c.
Case 2 is not possible because if (kb − a) < 0, we have
b3 − a = (kb − a)(ab + 1) < 0
a − b3 = (a − kb)(ab + 1) > 0
But (a − kb) > 0 means that (a − kb) ≥ 1 since a, k, and b are all integers. So
a − b3 ≥ ab + 1
a − b3 > ab
This contradicts the fact that b > 1. So case 2 is not possible.
Case 1 is complicated. From (kb − a) > 0, (ab + 1) > 0 we also get b3 − a > 0. This in turn would mean that (kb − a) < b, because otherwise we would have
b3 − a = (kb − a)(ab + 1) ≥ b(ab + 1) > bab > b3
which is not possible when a > 0. Therefore, combine (kb − a) < b and kb > a, we get that (k − 1)b < a < kb, or
c = kb − a, where 0 < c < b.
Substitute a = kb − c into Equation (*), we have
(kb − c)2 + b2 = k((kb − c)b + 1)
(k2 + 1)b2 − 2kcb + c2 = k2b2 − kbc + k
b2 − kcb + c2 − k = 0
k = | c2 + b2 |
cb + 1 |
Please note that here the value of k is the same as the original, we have not re-defined k. Repeat the same argument above, we again have three possibilities. While kc − b < 0 remains impossible, kc − b = 0 leads to k = c2, b = c3 (in which case the original assertion is true), and we are left with kc − b > 0, a recursive Case 1. However, this recursion cannot continue indefinitely, because a and b are both finite, yet at each step we have a > b > 1, and k > 1, and each time when we swap the roles of a and b, we are reducing the value of the smaller number by at least one.
In other words, Case 1 either does not hold, or can be reduced to k = c2 for some integer 0 < c < b.
QED
In this proof, I have produced a formula for generating a > b > 1, and k > 1 where Equation (*) holds.
Start with any b > 1, let a = b3, Equation (*) will be satisfied:
k = | (b3)2 + b2 | = | b6 + b2 | = | b2(b4 + 1) | = b2 |
b3b + 1 | b4 + 1 | b4 + 1 |
Let a1 = ka − b = b5 − b, we will have
k = | a12 + a2 | = | b10 − 2b6 + b2 + b6 | = | b2(b8 − b4 + 1) | = b2 |
a1a + 1 | b8 − b4 + 1 | b8 − b4 + 1 |
This process can be repeated indefinitely.