General Solution to $x^2-2y^2=1$ [duplicate]
Find a general solution to $x^2-2y^2=1$
I found that (3,2) is a solution. Now what should I do? I can not catch what the question really want.
It is about pell's equation. Would you give me a form of general solution?
Solution 1:
It is known that, starting with the minimal (w.r.t. the first coordinate) non-trivial solution $(x_1,y_1)$ of the Pell-Fermat equation: $$x^2-dy^2=1\qquad(d\;\text{square-free}),$$ the solutions $(x_n,y_n)$ are recursively defined by $$\begin{pmatrix}x_{n+1}\\y_{n+1}\end{pmatrix}=\begin{pmatrix}x_1&dy_1\\y_1&x_1\end{pmatrix}\begin{pmatrix}x_{n}\\y_{n}\end{pmatrix}.$$ Note $(3,2)$ is the minimal solution for $d=2$.
Solution 2:
All the integer solutions $(x,y)$ of the Pell's equation $x^2-2y^2=1$
are given by $(x_0,y_0)=(\pm 1,0)$, $(x_1,y_1)=(\pm 3,\pm 2)$,
$\pm(3+2\sqrt{2})^n=x_n+\sqrt{2}y_n$, $n\in\mathbb Z^+$.
E.g., $(x_2,y_2)=(\pm 17,\pm 12)$, etc.
Edit: also by $$x_n=\pm\frac{(3+2\sqrt{2})^n+(3-2\sqrt{2})^n}{2}$$
$$y_n=\pm\frac{(3+2\sqrt{2})^n-(3-2\sqrt{2})^n}{2\sqrt{2}}$$
$n\in\mathbb Z^+$, $(x_0,y_0)=(\pm 1,0)$. See http://mathworld.wolfram.com/PellEquation.html
In particular, the formulas for $x^2-Dy^2=1$ $$x_n=\pm\frac{(x_1+y_1\sqrt{D})^n+(x_1-y_1\sqrt{D})^n}{2}$$
$$y_n=\pm\frac{(x_1+y_1\sqrt{D})^n-(x_1-y_1\sqrt{D})^n}{2\sqrt{D}}$$
are given there.
It's also written there that these solutions hold for $x^2-Dy^2=-1$, except that $n$ can take on only odd values, i.e.
$$x_{n}=\pm\frac{(x_1+y_1\sqrt{D})^{2n-1}+(x_1-y_1\sqrt{D})^{2n-1}}{2}$$
$$y_{n}=\pm\frac{(x_1+y_1\sqrt{D})^{2n-1}-(x_1-y_1\sqrt{D})^{2n-1}}{2\sqrt{D}}$$
You could also see http://vjimc.osu.cz/history 2015 Category II Solutions for an application of this, i.e. a full solution of $5^n=6m^2+1$ in integers (it says "positive" but we can easily extend this to all integers), or my solution here.
Edit 2: also by relevant recurrence relations.
See here -- the solutions of $a_n=Aa_{n-1}+Ba_{n-2}$ are given by $a_n=C\lambda_1^n+D\lambda_2^n$ if $\lambda_1\neq \lambda_2$, where $C,D$ are constants created by $a_0,a_1$, and $\lambda_1, \lambda_2$ are the solutions of $\lambda^2-A\lambda-B=0$ (the characteristic polynomial), and $a_n=C\lambda^n+Dn\lambda^n$ if $\lambda_1=\lambda_2=\lambda$.
In this case, we want $\lambda_1=3+2\sqrt{2}$, $\lambda_2=3-2\sqrt{2}$, $C_1$, $D_1$ created by $x_0=1$, $x_1=3$, $C_2$, $D_2$ created by $y_0=0$, $y_1=2$.
Apply Vieta's formulas.
$\lambda_1+\lambda_2=6=A$, $\lambda_1\lambda_2=1=-B$.
The characteristic polynomial is $\lambda^2-6\lambda+1=0$.
The recurrence relations are $x_{n}=6x_{n-1}-x_{n-2}$, $y_{n}=6y_{n-1}-y_{n-2}$ with $x_0=1$, $x_1=3$, $y_0=0$, $y_1=2$.
And indeed one person deleted their answer with these recurrence relations.
See my answer here for how Pell equations can appear in certain sequences.