Trying to solve a Pell equation (Diophantine equation $x^2 - ny^2 = 1$ where $n$ is not a square), we can generate all the solutions in the following way:
Given a fundamental solution $(x_1, y_1)$, we can find all other solutions by solving $${\displaystyle x_{k}+y_{k}{\sqrt {n}}=(x_{1}+y_{1}{\sqrt {n}})^{k},} \tag{*}\label{*} $$ for $k \in \mathbb{Z}$. (This can be solved by separating rational and irrational parts)
$\ $
My question is: why? That is, why would it be a good idea to look for solutions like this (i) , and more importantly, why does it give all solutions? (ii)
(Bonus question: same but for $x^2 + ny^2 = -1$ solvable)
$\ $
Anywhere that I could find this equation online, it is considered 'common' knowledge and therefore needs no explanation. I have not been able to find a proof.
What I have thus far: (i) $(x_1, y_1)$ is a solution, thus: $x_1^2 + ny_1^2 = 1$. Furthermore, for any $(x, y)$ we have $x^2 - ny^2 = (x - \sqrt{n}y)(x + \sqrt{n}y)$. Thus, for $k \in \mathbb{N}$ and any solution $(x, y)$:
$$ \begin{align} (x - \sqrt{n}y)(x + \sqrt{n}y) &= x^2 - ny^2 = 1 = 1^k\ \\ &= (x_1^2 - ny_1^2)^k = (x_1 - \sqrt{n}y_1)^k(x_1 + \sqrt{n}y_1)^k\end{align}$$ Now we can take only $(x + \sqrt{n}y)$ and $(x_1 + \sqrt{n}y_1)^k$ for some reason?
Also, if we assume \eqref{*} to be true, we can find the recurrence relations: $$\displaystyle x_{k+1} = x_1 x_k + n y_1 y_k,$$ $$\displaystyle y_{k+1} = x_1 y_k + y_1 x_k.$$ Since we can assume the fundamental solution won't have either zero I suppose we can conclude that each $x_k$ and $y_k$ will be unique. (ii) However, I still fail to see how this generates all solutions.