<s>[INST] How do we solve pell-like equations? I need to find all solutions $(x,y)∈Z^2$ to the Pell-like equation $x^2-21y^2= 4$
Method I used to solve above problem:-
I solved the pell-equation $x^2-21y^2= 1$ and calculated the possible solutions to the equation and further multiplied the above equation with the initial equation, i.e, $x^2-21y^2= 4$.
But I am still not able to figure out what should I do next? Could someone help me out in this problem?
 [/INST] Given
$x^2-21y^2= 4$ we can see $(5,1)$ as an easy solution where $5^2-21= 4$.
Another observation is
$$x^2-21y^2= 4\implies \frac{x^2-4}{21}=y^2=\frac{x-2}{p}\cdot\frac{x+2}{q}\quad \text{ where }\quad p|x-2\quad\land\quad q|x+2$$
The factors of $21$ are $1,3,7,21$ and trying the cofactors $(1,21)$ we get conflicting answers for what is x.
$$x-2=1\implies x=3\quad \land \quad x+2=21\implies x=19 \lor\\
 x-2=21\implies x=23\quad \land \quad x+2=1\implies x=-1$$
but the other two cofactors do yield consistent results for what is x.
$$x-2=3\implies x=5\quad \land \quad x+2=7\implies x=5$$
and this fits our desire to have integers that, multiplied, yield a square.
$$\frac{x-2}{3}\cdot\frac{x+2}{7}=\frac{5-2}{3}\cdot\frac{5+2}{7}
=\frac{3}{3}\cdot\frac{7}{7}=\frac{21}{21}=1=y^2$$
Only positive integers have been used in this demonstration but the results are the same with $(-5,-1)$ because, multiplied, they become positive.
$$\therefore x^2-21y^2= 4\implies x=\pm5\quad y=\pm 1 $$
</s>