## Recurrence formula in Pell's equation

Hello,

I am trying to solve a Pell's equation

X2 + 2Y2 =1

I understand that the (3,2) is a fundamental solution to the equation. However, I am having difficulty to obtain the recurrence formula in order to generate further solutions. Can anybody help?

 PhysOrg.com science news on PhysOrg.com >> Front-row seats to climate change>> Attacking MRSA with metals from antibacterial clays>> New formula invented for microscope viewing, substitutes for federally controlled drug
 Recognitions: Gold Member I don't know anything about this, but I do question how you can get (3,2) as a solution to x^2 + 2*y^2 = 1, since I get 3^2 + 2*2^2 = 17 which is most emphatically not 1. What am I missing?
 Recognitions: Gold Member It works with: X^2 - 2*Y^2 = 1

Recognitions:

## Recurrence formula in Pell's equation

The equation is (x-sqrt(2)y)(x+sqrt(2)y) = 1. Now, your solution is (3,2), so (3-sqrt(2)2)(3+sqrt(2)2) = 1, and by multiplying we have 1 = (x-sqrt(2)y)(3-sqrt(2)2)(x+sqrt(2)y)(3+sqrt(2)2) = (3x+4y-(2x+3y)sqrt(2))(3x+4y+(2x+3y)sqrt(2)) = (3x+4y)^2-2(2x+3y)^2. Hence if we denote (3,2) by (x_0,y_0), you can define (x_{n+1},y_{n+1}) = (3x_n+4y_n,2x_n+3y_n), and thus (x_n,y_n) will be a solution for each n.

Now, we have found some solutions, but is this all? It is a good exercise to prove this.

Hint: (Suppose (x,y) is a solution not in the sequence defined above, and use the recurrence formula backwards to find the "least" positive solution. (a,b) is the "least" solution if a+b is minimal. Try to find a contradiction.)

 Hey, Yep its my mistake. Its supposed to be x2-y2=1 Thanks for pointing out.

 Quote by disregardthat The equation is (x-sqrt(2)y)(x+sqrt(2)y) = 1. Now, your solution is (3,2), so (3-sqrt(2)2)(3+sqrt(2)2) = 1, and by multiplying we have 1 = (x-sqrt(2)y)(3-sqrt(2)2)(x+sqrt(2)y)(3+sqrt(2)2) = (3x+4y-(2x+3y)sqrt(2))(3x+4y+(2x+3y)sqrt(2)) = (3x+4y)^2-2(2x+3y)^2. Hence if we denote (3,2) by (x_0,y_0), you can define (x_{n+1},y_{n+1}) = (3x_n+4y_n,2x_n+3y_n), and thus (x_n,y_n) will be a solution for each n. Now, we have found some solutions, but is this all? It is a good exercise to prove this. Hint: (Suppose (x,y) is a solution not in the sequence defined above, and use the recurrence formula backwards to find the "least" positive solution. (a,b) is the "least" solution if a+b is minimal. Try to find a contradiction.)
Awesome. Thanks heaps.

 Recognitions: Gold Member Let x$_{1}$, y$_{1}$ be basic solutions to x^2-N*y^2 = 1, with N a non-square integer number then we have the following recurrence relations for k>1: x$_{k+1}$:=x$_{1}$*x$_{k}$+N*y$_{1}$*y$_{k}$ y$_{k+1}$:=x$_{1}$*y$_{k}$+y$_{1}$*x$_{k}$ For N=2, (2,3) being the basic solution, we have (17,12) as 2. and (99,70) as 3.solution A trivial algorithm to find the basic solution could be: y:=1, max:=999 Do While n < max $\cdots$Compute w=1+N*y^2 $\cdots$If w is an integral square x^2 then $\cdots\cdots$Return "Basic solution: (x, y)" and Stop $\cdots$End_If $\cdots$Incr y End_Do Return max & " trials and no solution" and Stop Because there are values of N, whrer this "Q&D"-algorithm fails, who has experience with with non-trivial algorithms for basic solutions to the Pell equation?