# Solving Pell's Equation for $x^2 -7y^2 = 1$ for the first three integral solutions.

Like the title states my goal is the find the first three integral solutions of the Diophantine equation. I know $$x^2 -7y^2 = 1$$ is a Pell's equation where $$d = 7$$. I found the minimal solution to be $$(x,y) = (8,3)$$ through brute force. I then found the next pair by using the equation:

$$(x + \sqrt{7}y)^i(x-\sqrt{7}y)^i = 1$$

$$i = 1$$ would give me the minimal solution $$(8,3)$$, so I went to $$i = 2$$.

$$(x + \sqrt{7}y)^2(x-\sqrt{7}y)^2 = 1$$

$$\left(x^2 + 7y^2 + 2xy\sqrt{7}\right) \left(x^2 + 7y^2 - 2xy\sqrt{7}\right) = 1$$

$$(x^2 + 7y^2)^2 - 7(2xy)^2 = 1$$ (This is of the form $$X^2 - 7Y^2 = 1$$)

I then let $$X = x^2 + 7y^2$$ and $$Y = 2xy$$, so the equation becomes the desired

$$X^2 - 7Y^2 = 1$$

I then plugged in my minimal solution $$(8,3)$$ and found $$X = (8^3+7(3^3)) = 127$$ and $$Y = 2(8)(3) = 48$$, so my new pair is $$(127,48)$$. To find the next solution, I let $$i = 3$$.

$$(x + \sqrt{7}y)^3(x-\sqrt{7}y)^3 = 1$$

And this is where I got stuck. I tried a few methods to get this new equation into the form of $$X^2 - 7Y^2 = 1$$, but have been unsuccessful. I tried expanding out the equations completely getting:

$$x^6 -21x^4y^2+147x^2y^4-343y^6 = 1$$

But I'm fairly sure that's not the right direction. The other method I tried was factoring out a $$(x + \sqrt{7}y)^2(x-\sqrt{7}y)^2$$, so I got:

$$[(x + \sqrt{7}y)(x-\sqrt{7}y)](x + \sqrt{7}y)^2(x-\sqrt{7}y)^2$$

which simplifying I got

$$(x^2-7y^2) \left( (x^2 + 7y^2)^2 - 7(2xy)^2 \right)$$

I'm really not sure how to properly factor this cubic to get to the desired function form. Any help would be greatly appreciated!

• $(8-3\sqrt7)(127-48\sqrt7)=2024-765\sqrt7$ – J. W. Tanner Apr 24 at 2:27
• Since $(8x+21y)^2 - 7(3x+8y)^2 = x^2-7y^2$, if $(x,y)$ is a solution, so does $(8x+21y,3x+8y)$. – achille hui Apr 24 at 2:49

Consider $$(8+3\sqrt7)^2=127+48\sqrt7,$$ $$(8+3\sqrt7)^3=(8+3\sqrt7)(127+48\sqrt7)=2024+765\sqrt7,$$ $$(8+3\sqrt7)^4=(8+3\sqrt7)(2024+765\sqrt7)=32257+12192\sqrt7$$ etc. Then the first few solutions are $$(8,3)$$, $$(127,48)$$, $$(2024,765)$$, $$(32257,12192)$$ etc.
Remember that $$x^2-7y^2=1$$, so you can write $$x^6-21x^4y^2=-14x^4y^2+7x^4$$ and keep going $$x^6 -21x^4y^2+147x^2y^4-343y^6 = 1\\ -14x^4y^2+7x^4+147x^2y^4-343y^6=1\\ 7x^4+49x^2y^4-14x^2y^2-343y^6=1\\ 7x^4-14x^2y^2+49y^4=1$$ Now you can plug in your fourth degree solution and be done. You can also use the Brahmgupta-Fermat identity to reach the same result
Beginning with pairs $$(1,0)$$ and then $$(8,3),$$ all the other soltuions with positive variables satisfy $$x_{n+2} = 16 x_{n+1} - x_n \; , \;$$ $$y_{n+2} = 16 y_{n+1} - y_n \; . \;$$ The $$x_n$$ begin $$1, 8, 127, 2024, 32257, 514088, 8193151,$$ The $$y_n$$ begin $$0, 3, 48, 765, 12192, 194307, 3096720,$$