I need help understanding the following theorem.

**Theorem.** Suppose d is a positive integer. If there is one solution to the Fermt-Pell equation (1): $\displaystyle x^{2}-dy^{2}=1;\ x, y>0$, then there are infinitely many solutions. If there is one solution to the Fermat-Pell equation (2): $\displaystyle x^{2}-dy^{2}=-1;\ x, y>0$, then there are infinitely many solutions to both (1) and (2).

**Proof.**

Suppose there are integers a and b,

$\displaystyle a^{2}-db{2}=c; \ a,b>0$,

where c will shortly be chosen to be $\displaystyle \pm1$. Suppose further that for some $\displaystyle n\ge 1$ there are integers $\displaystyle x_{n}$ and $\displaystyle y_{n}$ such that

$\displaystyle x_{n}^{2}-dy_{n}^{2}=c^{n};\ x_{n},y_{n}>0$.

When n = 1 this is possible with $\displaystyle x_{1}=a$ and $\displaystyle y_{1} = b$. Set

[This is where I'm confused, how do they get these equations? I'm lost from here on.]

$\displaystyle x_{n+1}=ax_{n}+dby_{n}$,

$\displaystyle y_{n+1}=ay_{n}+bx_{n}$.

These values are legal since

$\displaystyle x_{n+1}^{2}-dy_{n+1}^{2}={\left( a^{2}x_{n}^{2}+2dabx_{n}y_{n}+d^{2}b^{2}y_{n}^{2}\ right) - d\left ( a^{2}y_{n}^{2}+2abx_{n}y_{n}+b^{2}x_{n}^{2}\right) }$

$\displaystyle ={a^{2}x_{n}^{2}+d^{2}b^{2}y_{n}^{2}-da^{2}y_{n}^{2}-db^{2}x_{n}^{2}}$

$\displaystyle ={\left( a^2-db^2\right)\left(x_{n}^{2}-dy_{n}^{2}\right)}$

$\displaystyle ={c\cdot c^{n}}={c^{n+1}}$

and

$\displaystyle x_{n+1}={ax_{n}+dby_{n}>1\cdot x_{n}+d\cdot 0\cdot y_{n}}={x_{n}\left(>0\right)}$,

$\displaystyle y_{n+1}={ay_{n}+bx_{n}>1\cdot y_{n}+0\cdot x_{n}}={y_{n}\left(>0\right)}$.

[...] The rest of the proof follows, but I think I posted the relavent parts.

Thanks.