A few years ago back in 2008, I decided to use mathematical tools I discovered that I call

tautological spaces against binary quadratic Diophantine equations. One of my early results showed how to connect x

^{2} - Dy

^{2} = 1, which I call the two conics equation, to Pythagorean Triples, and I got that result from a mistake!

Key to my ability to connect the two conics equation to ellipses is a relation that is found by using

my method for generally reducing binary quadratic Diophantine equations on the equation:

x

^{2} - Dy

^{2} = F

That gives:

(x+Dy)

^{2} - D(x+y)

^{2} = -F(D-1)

With the two conics equation F=1, so I have:

(x+Dy)

^{2} - D(x+y)

^{2} = -(D-1)

Years ago, when I had an early version of the above I had the variable S, for a piece I didn't know at that time, which is x+Dy. In

that post, which I've corrected mathematically, I also am still using the phrase "Pell's Equation" which I did for years before recently shifting to calling it the two conics equation.

Shifting things around a bit, I have:

(x+Dy)

^{2} + (D-1) = D(x+y)

^{2}
And I can group to divide off D, so doing so and dividing it off:

[(x+Dy)

^{2} - 1]/D + 1 = (x+y)

^{2}
At this point I made a little mistake years ago, as I wrongly thought that x+Dy = 1 mod D or x+Dy = -1 mod D followed, but that is only definite if D is prime. But it leads to a really cool result, allowing us to connect to ellipses, so now we'll shift to the special case of x = 1 mod D or x = - 1 mod D.

And with that assumption I'll use x+Dy = jD +/- 1, where j is some unknown integer, and one of those cases will be true. That usage is a little confusing, but I did it to keep from having to write x+Dy = jD + 1 or x+Dy = jD - 1, over and over again.

And making that substitution gives:

[(jD +/- 1)

^{2} - 1]/D + 1 = (x+y)

^{2}
And squaring and simplifying a bit gives:

Dj

^{2} +/- 2j + 1 = (x+y)

^{2}
So now I just subtract and add j

^{2} so that I can complete the square to get:

(D-1)j

^{2} + (j +/- 1)

^{2} = (x+y)

^{2}
And I've successfully connected to ellipses!

Of course if D-1 is a square you are connected to Pythagorean Triples. Here is an example I've used for years.

With D=2, using x=17, y=12, as 17

^{2} - 2(12)

^{2} = 1, I find:

j = ((17+2*12)-1)/2 = 20 is a solution giving:

20

^{2} + 21

^{2} = 29

^{2}
The +/- usage can be a bit confusing so more recently I've not used it, so the full result without it is:

(D-1)j

^{2} + (j + 1)

^{2} = (x+y)

^{2}, j = (x+Dy-1)/D

or

(D-1)j

^{2} + (j - 1)

^{2} = (x+y)

^{2}, j = (x+Dy+1)/D

where the first follows if x = 1 mod D, or the second if x = -1 mod D.

Interestingly, of course, that is fulfilled if D is prime, so the result says that ellipses directly connect to the two conics equation, when D is prime.

From that result I did deeper analysis to find out that the prime factors of D-1 control the size of fundamental solutions to x

^{2} - Dy

^{2} = 1, which is an answer that appears to apply in general, even when x = 1 mod D or x = - 1 mod D is not the case!

So what happened was that in studying my connection I found I got the equation:

(n-m)

^{2} - Dm

^{2} = 1

So that analysis gave me my main equation back again, but with the variables shifted in this special way, which is kind of cool.

I noticed that I could solve for the residue of m mod D-1, where that split by whether or not D-1 was even, where for the odd D-1:

m = (n

^{2} - 1)(2n)

^{-1} mod (D-1)

While for the even D-1:

m = ((n

^{2} - 1)/2)n

^{-1} mod (D-1)

And I realized that I could have had those results just from considering

(n-m)

^{2} - Dm

^{2} = 1

without needing the connection to ellipses, or that x = 1 or -1 mod D.

And it is easy to figure out that n = x+y or n = x-y, and the modular inverse requires that n be coprime to D-1, or (D-1)/2 for the even D-1 case, so a lot of small prime factors still provides a harder case, as n is being more and more constrained.

However, if x = 1 mod D or x = -1 mod D is not true, then the impact I think is less, as intriguingly enough if it is true then you also get the requirement that x+y+j+1 or x+y+j-1 must be a square or twice a square.

To see that result only requires a little bit more analysis, where I start with:

(D-1)j

^{2} + (j+1)

^{2} = (x+y)

^{2}
note that:

(j+1)

^{2} - (x+y)

^{2} = 0 mod D-1

Now consider any prime factor p of D-1, then of course it also follows that:

(j+1)

^{2} - (x+y)

^{2} = 0 mod p

But now consider j = ((x+Dy)-1)/D, and since D-1 = 0 mod p, I have j = x+y-1 mod p, which remarkably forces

*all* prime factors of D-1 into: (j+1 -(x+y))

Going back to my original full expression:

(D-1)j

^{2} + (j+1)

^{2} = (x+y)

^{2}
that of course is:

(D-1)j

^{2} = (x+y - (j+1))(x+y + (j+1))

From x

^{2} - Dy

^{2} = 1 itself I have x

^{2} - y

^{2} = 1 mod p, so x+y must be coprime to D-1.

And knowing that D-1 is a factor of (x+y - (j+1)), it must be coprime to (x+y + j+1) for all its primes except 2.

Also then (x+y + j+1) is forced to be a perfect square or twice a perfect square.

Doing the above analysis with

(D-1)j

^{2} + (j-1)

^{2} = (x+y)

^{2}
merely shifts to D-1 a factor of (x+y - (j-1)), and (x+y + j-1) coprime to it for all odd factors.

So when D is a prime, and D-1 has a lot of small prime factors, the mathematics has to fulfill a special requirement, which also connects it to ellipses, which I just mention again as I think it is really cool.

An exception though is when D-1, D+1, D-2, or D+2 is a square, as then solutions will tend to be small regardless of other factors.

There trivially easy solutions to x

^{2} - Dy

^{2} = 1 exist, which I found by exploring the connection even further, where I found I needed to split j up into two more variables:

j = nm or j = 2nm

The gave me a control set of relations when D-1 is odd, where at least one will work:

1. n = m +/- sqrt(Dm

^{2} + 2), m = (n

^{2} - 2)(2n)

^{-1} mod (D-1)

2. n = m +/- sqrt(Dm

^{2} + 1), m = (n

^{2} - 1)(2n)

^{-1} mod (D-1)

3. n = m +/- sqrt(Dm

^{2} - 2), m = (n

^{2} + 2)(2n)

^{-1} mod (D-1)

4. n = m +/- sqrt(Dm

^{2} - 1), m = (n

^{2} + 1)(2n)

^{-1} mod (D-1)

and, when D-1 is even:

1. n = m +/- sqrt(Dm

^{2} + 2), m = ((n

^{2} - 2)/2)n

^{-1} mod ((D-1)/2)

2. n = m +/- sqrt(Dm

^{2} + 1), m = ((n

^{2} - 1)/2)n

^{-1} mod ((D-1)/2)

3. n = m +/- sqrt(Dm

^{2} - 2), m = ((n

^{2} + 2)/2)n

^{-1} mod ((D-1)/2)

4. n = m +/- sqrt(Dm

^{2} - 1), m = ((n

^{2} + 1)/2)n

^{-1} mod ((D-1)/2)

You can see the trivial solutions at D-1, a square, when Pell's Equation connects directly to Pythagorean triples, and also at D+1, D-2, and D+2 perfect squares. With those the square root is trivial to resolve with m=1, so it's like a release valve. There are also corresponding identities that give solutions trivially. For instance the D+1 trivial case is given by: n

^{2} - (n

^{2} - 1)(1)

^{2} = 1

In wondering why I made a mistake back in 2008 that was equivalent to assuming that x = 1 mod D or x = -1 mod D, I'm not sure, but might have been in a hurry, or just not thinking carefully. I had just done a lot of the analysis and was anxious to find something useful with my Quadratic Diophantine Theorem. Or in the back of my mind I may have been assuming D was prime. The D=61 case is a famously large case and there of course D is prime.

Then I wandered off and did other things. Only recently have I completely re-visited the result and last night noticed the mistake.

Oh, it is of interest I think to test the additional constraints with the results above for the D=61 case, as it is so famous.

1766319049

^{2} - 61*226153980

^{2} = 1

x = 1766319049, y = 226153980, and x = 1766319049 = -1 mod 61, so the second equations apply.

(D-1)j

^{2} + (j - 1)

^{2} = (x+y)

^{2}, j = (x+Dy+1)/D

Which gives j = 255110030, and it must be true that (x+y + j-1) is a square or twice a square:

(x+y + j-1) = 2247583058, and 2*33523

^{2} = 2247583058.

Of course 33523 is coprime to D-1, which is 60, and 33523 = 7*4789, so it looks like the math went to the next smallest prime available which was 7, since 2, 3 and 5 were blocked.

60*255110030

^{2} + 255110029

^{2} = 1992473029

^{2}
Often a mistake can crash an argument but in this case it didn't matter much as it still lead to the correct result that D-1 and its prime factors are key, where the effect is simply much larger if D is prime, or if x = 1 mod D, or x = -1 mod D, which can occur even when it is not. Like when D is twice a prime it is forced as well, so those solutions also are much bigger. Fascinating.

Such a cool story. The connections are amazing. It's like all these equations are like a family, and prime numbers are important to the story too!

James Harris