TITLE: Solve the Diophantine equation $ 3x^2 - 2y^2 =1 $
QUESTION [8 upvotes]: Solve $$ 3x^2 - 2y^2 =1 $$ in $ \mathbb{Z}$.
How can we do it?
( All of answers gave me a great help. Thanks a lot kind stackexchangers.)

REPLY [9 votes]: This is pretty much the same information as Mark Bennet. Not the entire earthly existence of Mark Bennet, just his answer. We begin with an automorph of your indefinite quadratic form. I like to call the matrix that goes on the right the automorph, so for me it is 
$$ A \; = \;
 \left(  \begin{array}{rr}
  5 &  4   \\
   6 & 5      
\end{array} 
  \right) 
$$ 
which solves
$$  
 \left(  \begin{array}{rr}
  5 &  6   \\
   4 & 5     
\end{array} 
  \right)  \cdot 
 \left(  \begin{array}{rr}
  3 &  0  \\
   0 & -2      
\end{array} 
  \right)  \cdot 
 \left(  \begin{array}{rr}
  5 &  4   \\
   6 & 5      
\end{array} 
  \right) 
 =
 \left(  \begin{array}{rr}
  3 &  0   \\
   0 & -2      
\end{array} 
  \right)
  $$
Note that we have 
$$ A^{-1} \; = \;
 \left(  \begin{array}{rr}
  5 &  -4   \\
   -6 & 5      
\end{array} 
  \right) 
$$ 
We take the convention 
$$ A^{0} \; = \; I = \;
 \left(  \begin{array}{rr}
  1 &  0   \\
   0 & 1      
\end{array} 
  \right) 
$$ 
The key thing is that any power of $A,$ positive or negative or $0,$ is also an automorph, and takes a solution of your equation as a column vector to another solution. In this case, all solutions can be generated in this manner as
$$  
A^n \cdot 
 \left(  \begin{array}{r}
  1  \\
   1       
\end{array} 
  \right).
$$
For example,
$$  
 \left(  \begin{array}{rr}
  5 &  4   \\
   6 & 5     
\end{array} 
  \right)  \cdot 
 \left(  \begin{array}{r}
  1  \\
   1      
\end{array} 
  \right) 
=
  \left(  \begin{array}{r}
  9  \\
   11      
\end{array} 
  \right), 
  $$
$$  
 \left(  \begin{array}{rr}
  5 &  4   \\
   6 & 5     
\end{array} 
  \right)  \cdot 
 \left(  \begin{array}{r}
  9  \\
   11      
\end{array} 
  \right) 
=
  \left(  \begin{array}{r}
  89  \\
   109      
\end{array} 
  \right), 
  $$
meanwhile
$$  
 \left(  \begin{array}{rr}
  5 &  -4   \\
   -6 & 5     
\end{array} 
  \right)  \cdot 
 \left(  \begin{array}{r}
  1  \\
   1      
\end{array} 
  \right) 
=
  \left(  \begin{array}{r}
  1  \\
   -1      
\end{array} 
  \right), 
  $$
$$  
 \left(  \begin{array}{rr}
  5 &  -4   \\
   -6 & 5     
\end{array} 
  \right)  \cdot 
 \left(  \begin{array}{r}
  1  \\
   -1      
\end{array} 
  \right) 
=
  \left(  \begin{array}{r}
  9  \\
   -11      
\end{array} 
  \right). 
  $$
Furthermore, you can still negate both entries. So all solutions are
$$  \pm A^n  \cdot 
 \left(  \begin{array}{r}
  1  \\
   1      
\end{array} 
  \right)   $$
with $n \in \mathbb Z.$
This is from pages 21-34 of Duncan A. Buell, Binary Quadratic Forms: Classical Theory and Modern Computations. If you had an oversized target or other difficulty, as in $3 x^2 - 2 y^2 = 25,$ the automorph idea would still work, but more "seed" vectors would be required. This is discussed in John H. Conway, The Sensual Quadratic Form. 
I give an example of Conway's "river" method, including the necessary diagram,  at Another quadratic Diophantine equation: How do I proceed? 
I recently purchased a home scanner, it does just one page at a time but fairly well. Here, with any luck, is Conway's "River" diagram for this problem:

Good, it is there and clear. Note how the ways to express $1$ stay close to the river, and there is  just one way per cycle. I have written in the $x,y$ values for each $3x^2 - 2 y^2 = n$ as a column vector in that position. In comparison, if I wanted $3x^2 - 2y^2 = 25,$ i would have several solutions per cycle, for two reasons: for any solution of $3x^2 - 2y^2 = 1,$ I could just multiply through by $5,$ giving one imprimitive solution per cycle. There are also two primitive solutions per cycle, beginning with the two $3 \cdot 3^2 - 2 \cdot 1^2 = 3 \cdot 11^2 - 2 \cdot 13^2 = 25.$  
In case it was not clear, the business with automorphs works along with the river construction, all that is really needed is correct identification of the solutions in a single cycle. So, all solutions to $3x^2 - 2 y^2 = 25$ are
$$  \pm A^n  \cdot 
 \left(  \begin{array}{r}
  5  \\
   5      
\end{array} 
  \right), \; \; \;
 \pm A^n  \cdot 
 \left(  \begin{array}{r}
  3  \\
   1      
\end{array} 
  \right), \; \; \;
 \pm A^n  \cdot 
 \left(  \begin{array}{r}
  11  \\
   13      
\end{array} 
  \right), 
   $$
with $n \in \mathbb Z.$
In case this makes any sense, this diagram is a small section of a parametrization of $PSL_2 \mathbb Z.$ All the solutions we give have $x \geq 0.$ You get the other solutions by negating both $x,y.$ Well, pages 1-33 in Conway's book.