So I noticed that given what is commonly called Pell's Equation, x

^{2}- Dy

^{2}= 1, I had:

(D-1)j

^{2}+ (j+1)

^{2}= (x+y)

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

or

(D-1)j

^{2}+ (j-1)

^{2}= (x+y)

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

which gives a Pythagorean triple whenever D-1 is a square, as j will be an integer for one of them.

For instance with D=2, I have a solution with x=17, y=12, 17

^{2}- 2(12)

^{2}= 1, as

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

20

^{2}+ 21

^{2}= 29

^{2}

The equations work in reverse as well, so with a Pythagorean Triple you can solve Pell's Equation. For instance, consider 5

^{2}+ 12

^{2}= 13

^{2}.

So x+y=13, and notice j-1 = 5, works giving j=6, so D-1 = 4, giving D=5.

And, j = ((x+Dy)+1)/D, gives x+5y = 29. So 4y = 16, and y=4.

So x=9, and 9

^{2}- 5(4)

^{2}= 1.

Which I think is rather cool, as there is this deep connection between these equations. Sort of like they know each other and are reflections of something or other.

The discrete hyperbola of Pell's Equation connected to the discrete ellipse of the Pythagorean Triple.

A little later on I re-discovered the parametric solution to Pell's Equation:

y = 2t/(D - t

^{2}) and x = (D + t

^{2})/(D - t

^{2})

Which, of course, was known to Fermat. Notice with it you can get ellipses or hyperbolas dependent on the sign of D.

For my re-derivation go to an earlier post.

Though finding parametric solutions is trivial, as consider:

(n

^{2}- t

^{2})

^{2}- (n

^{2}- 2t

^{2})n

^{2}= t

^{4}, so n

^{4}- 2n

^{2}t

^{2}+ t

^{4}- n

^{4}+ 2n

^{2}t

^{2}= t

^{4}

It seems worth mentioning that an easy set of solutions to Pell's Equation, come from situations like:

if D+2 is a perfect square, then D = n

^{2}- 2 for some natural number n, as then

(n

^{2}- 1)

^{2}- (n

^{2}- 2)n

^{2}= 1, so n

^{4}- 2n

^{2}+ 1 - n

^{4}+ 2n

^{2}= 1.

Which has other variations like when D-2 is a perfect square.

So then notice also that:

(n

^{2}- 3)j

^{2}+ (j+1)

^{2}= (x+y)

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

or

(n

^{2}- 3)j

^{2}+ (j-1)

^{2}= (x+y)

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

is trivial to solve discretely.

James Harris