Help answering Pell Equation questions I understand the Pell equation is $$x^{2}-dy^{2}=1$$ However I don't understand how to use this to get $(x,y)$ for these questions. 
1) Find a nontrivial solution of $x^{2} − 3y^{2} = 1.$
2) Find all positive solutions of $x^{2} − 3y^{2} = 1.$
Do I use the fact $\frac{x}{y}=\sqrt{\frac{1}{y^{2}}+3} \rightarrow 3$ then try and find some kind of answer from there?
I don't understand how to find the solutions. 
Any help would be appreciated thank you. 
 A: Here is a method that uses just integers. It is equivalent to continued fractions. However, when very large numbers are involved, the methods of Lagrange and Gauss are preferable as they make no use of decimal accuracy or cycle detection. The first nontrivial answer is $2^2 - 3 \cdot 1^2 = 1.$ To get from one solution $(x,y)$ to the next one, we apply the mapping
$$ (x,y) \mapsto (2x +3y, x + 2y). $$
That is, we get pairs
$$ (2,1); (7,4); (26,15);(97,56), \ldots  $$
The Cayley-Hamilton Theorem from linear algebra tells us degree two linear recursions that are separate for $x$ and $y,$ those being
$$ x_{n+1} = 4 x_{n+1} - x_n, $$
$$ y_{n+1} = 4 y_{n+1} - y_n. $$
The $x$ values, in order, are thus
$$ 2, 7, 26, 97, 362, 1351, 5042, \ldots  $$
$$ 1, 4, 15, 56, 209, 780, 2911, \ldots   $$
jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./Pell 3


0  form   1 2 -2   delta  -1
1  form   -2 2 1   delta  2
2  form   1 2 -2

 disc 12
Automorph, written on right of Gram matrix:  
1  2
1  3


 Pell automorph 
2  3
1  2

Pell unit 
2^2 - 3 * 1^2 = 1 

=========================================

3       3

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$

CAUTION: if you have $x^2 - d y^2 = c,$ there may be the need for more than on "seed" value, see If $d>1$ is a squarefree integer, show that $x^2 - dy^2 = c$ gives some bounds in terms of a fundamental solution.
A: All the solutions are obtained finding first the fundamental unit of the ring of integers of the field $\mathbb Q(\sqrt d)$, say $a_0+b_0\sqrt d$, and then all the solutions $(a_n,b_n)$ are given by $$a_n+b_n\sqrt d=(a_0+b_0\sqrt d)^n$$
(I did not know the way you give).
