How to Generate Solutions for Quadratic Diophantine Equations

diophantine equationsexponentiationnumber theorysequences-and-series

Recently I've asked a question for how to solve Quadratic Diophantine Equation and I got one interesting answer. Link to question: The quadratic diophantine $ k^2 – 1 = 5(m^2 – 1)$

Here's the answer:

$$ x_n + y_n \sqrt{5} = \left(x_{n-1} + y_{n-1} \sqrt{5}\right)\left(\frac {3 + \sqrt{5}}{2}\right)^n$$

Actually it worked for my equation, which was: $x^2 – 5y^2 = -4$

I found the fundamental solution and it's $(x,y) = (1,1)$ and using the form from above i get:

$$ n = 1; (x,y) = (4,2)$$
$$ n = 2; (x,y) = (11,5)$$
$$ n = 4; (x,y) = (76,34)\ and\ so\ on$$

And indeed those pairs are solutions for my equation. (I excluded every non-integer numbers, because I'm only interested in integers)

But I'm experiencing problems with the following equation: $x^2 – 17y^2 = 13$

Fundamental solution is (9,2) and using the above form I get:

$$ n = 3; (x,y) = (121, 54)$$

And if I check this pair isn't solution to the equation. Where am I wrong?

Best Answer

The "topograph" for $x^2 - 13 y^2$ is definitely more complicated than the previous ones, because the continued fraction for $\sqrt {13}$ has period 5, your two previous examples had period 1. Confirming the "automorph" matrix, which just preserves the quadratic form:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

gp-pari 
? 
? 
? form = [ 1,0; 0,-13]
%1 = 
[1 0]

[0 -13]

? 
? a = [649, 2340; 180, 649]
%2 = 
[649 2340]

[180 649]

? 
? atranspose = mattranspose(a)
%3 = 
[649 180]

[2340 649]


? 
?  atranspose  * form * a
%5 = 
[1 0]

[0 -13]

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The pairs of numbers in green are vectors in the plane. Two basic properties. First, each shows its value for $x^2 - 13 y^2.$ For example, in the first occurrence of 4, we see the (column) vector $(11,3),$ and we can easily confirm that $11^2 - 13 \cdot 3^2 = 4. $ Next, around any point where three purple line segments meet (even if two are parallel), one of the three green vectors is the sum of the other two. For example, $$ (4,1) + (7,2) = (11,3). $$ As long as we just continue to the right, we can continue getting all positive entries in green.

Oh: you said you can do continued fractions. It happens that you can find all representations of 4 and 1 using the continued fraction of $\sqrt {13},$ so you can confirm a good deal of the Conway diagram, the vectors in green, whatever.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

enter image description here

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

enter image description here

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./indefCycle
Input three coefficients a b c for indef f(x,y)= a x^2 + b x y + c y^2 
1 0 -13

  0  form              1           0         -13  delta      0
  1  form            -13           0           1  delta      3
  2  form              1           6          -4


          -1          -3
           0          -1

To Return  
          -1           3
           0          -1

0  form   1 6 -4   delta  -1
1  form   -4 2 3   delta  1
2  form   3 4 -3   delta  -1
3  form   -3 2 4   delta  1
4  form   4 6 -1   delta  -6
5  form   -1 6 4   delta  1
6  form   4 2 -3   delta  -1
7  form   -3 4 3   delta  1
8  form   3 2 -4   delta  -1
9  form   -4 6 1   delta  6
10  form   1 6 -4

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=