### Tuesday, April 07, 2009

## JSH: sqrt(n^2 - 2) and Pell's Equation

One of the weirder blind spots with Pell's Equation is that if D = n^2 - 2, then the first solution for x is given by D+1, so you can trivially solve x^2 - Dy^2 = 1 for all such cases:

(n^2 - 1)^2 - (n^2 - 2)n^2 = 1

and notice n^4 - 2n^2 + 1 - n^4 + 2n^2 = 1.

Since solutions to Pell's Equation are good approximations for square roots, sqrt(n^2 - 2) is approximately (n^2 - 1)/(n^2 - 2) which makes sense so it's an easy result.

e.g. D=7, then x=8, and y=3, as 8^2 - 7*3^2 = 1, and sqrt(7)*(3/8) approximately equals 0.992 to three significant digits.

One more example.

D = 119, then x = 120, and y = 11, as 120^2 - 119*11^2 = 1, and sqrt(119)*(11/120) approx. equals 0.99996 to five significant digits.

To me that is the weirdest blind spot with Pell's Equation where my guess is that Fermat and Euler were quite aware of it, but probably considered it too trivial to mention.

The other weird blind spots though are with the alternates to Pell's Equation which I've also discussed.

Turns out that in general you should NEVER try to directly solve Pell's Equation except for trivial case above, as x tends to be the square of the solution I call j with the alternates, so it's not like you're doing twice the effort or something small, you're doing a squared times!!!

(n^2 - 1)^2 - (n^2 - 2)n^2 = 1

and notice n^4 - 2n^2 + 1 - n^4 + 2n^2 = 1.

Since solutions to Pell's Equation are good approximations for square roots, sqrt(n^2 - 2) is approximately (n^2 - 1)/(n^2 - 2) which makes sense so it's an easy result.

e.g. D=7, then x=8, and y=3, as 8^2 - 7*3^2 = 1, and sqrt(7)*(3/8) approximately equals 0.992 to three significant digits.

One more example.

D = 119, then x = 120, and y = 11, as 120^2 - 119*11^2 = 1, and sqrt(119)*(11/120) approx. equals 0.99996 to five significant digits.

To me that is the weirdest blind spot with Pell's Equation where my guess is that Fermat and Euler were quite aware of it, but probably considered it too trivial to mention.

The other weird blind spots though are with the alternates to Pell's Equation which I've also discussed.

Turns out that in general you should NEVER try to directly solve Pell's Equation except for trivial case above, as x tends to be the square of the solution I call j with the alternates, so it's not like you're doing twice the effort or something small, you're doing a squared times!!!