# Pell's equation $x^2-dy^2=4$ always has solutions

I know that Pell's equation $$x^2-dy^2=1$$ always has solutions and I want using that fact show that $$x^2-dy^2=4$$ also always has solutions.

$$x^2-dy^2=4\tag{*}$$

I try something like this... Let $$(x_1,y_1)$$ be solution of $$x^2-dy=4$$. Lets look all cases that can be dependent on odd or even number $$x$$ or$$y$$. It is clear that can't be je $$x_1$$ even, and $$y_1$$ odd, so we have only 3 cases.

If $$x_1, y_1$$ both odd, then by dividing equation by 4 I get the number 1 on the right and according to Theorem the equation has a solution.

If $$x_1$$ is odd, and $$y_1$$ even, then $$4 \mid d$$, tj. $$d=4d'$$. Then again by dividing equation by 4 I get the number 1 on the right and according to Theorem the equation has a solution.

How to finish this proof?

• Do you want to show it has a solution or to find all solutions? Jul 16, 2020 at 9:57
• If $(x,y)=(a,b)$ is a solution to $x^2-dy^2=1$, then $(x,y)=(2a,2b)$ is a solution to $x^2-dy^2=4$. (Not all solutions to $x^2-dy^2=4$ can be obtained this way. For example, $x^2-5y^2=4$ has a solution $(x,y)=(3,1)$.) Jul 16, 2020 at 10:06
• @Bernard just show that has a solution
– josf
Jul 16, 2020 at 10:09
• @josf This has been shown by Batominovski. Jul 16, 2020 at 11:34
• @josf this will always have a solution but not necessarily a primitive solution. But it can be proved under what conditions, it will have a primitive solution. For example, batominovski showed a primitive solution for d = 5. Jul 16, 2020 at 13:08

I know that Pell's equation $$x^2-dy^2=1$$ always has solutions and I want using that fact show that $$x^2-dy^2=4$$ also always has solutions.

As Batominovski indicated in comments, if you know a solution $$(x,y)$$ to $$x^2-dy^2=1$$,

then $$(X,Y)=(2x,2y)$$ is a solution to $$X^2-dY^2=4$$,

because $$X^2-dY^2=(2x)^2-d(2y)^2=4x^2-d4y^2=4(x^2-dy^2)=4(1)=4.$$

For example, solutions to $$x^2-5y^2=1$$ are $$(x,y)=(1,0), (9,4), (161,72), ...$$,

so solutions to $$X^2-5Y^2=4$$ are $$(X,Y)=(2,0), (18,8), (322, 144), ...$$.

So this shows that $$X^2-5Y^2=4$$ has solutions, though there are solutions this does not find,

such as $$(X,Y)=(3,1),(7,3),(47,21),(123,55),(843,377), ...$$.

$$x^2-dy^2=4\implies d=\frac{x^2-4}{y^2}\quad \lor\quad y=\sqrt{\frac{x^2-4}{d}}$$

The latter seems easier to understand. As long as $$(x^2-4)$$ is multiple $$(d)$$ of a perfect square, there is a solution. Try these $$(x,d)$$ pairs and you will see they yield a natural number for $$y$$. $$(4,3)\quad (6,2)\quad (7,5)\quad (8,15)\quad (10,6)\quad (14,3)\quad ...\quad (23,1)\quad ...$$ You can do find these yourself in a spreadsheet as I did.

Set $$x=2$$ in a spreadsheet and have every row/cell under it increment by $$1$$. In the cell to the right of $$x=2)$$ enter the formula for $$x^2-4$$ and fill down. You will then be able to see which "squares-minus-4" are squares when divided by a mentally calculated $$d$$.

There are "repeating patterns" of a sort, for instance, $$10\rightarrow96$$ and $$14\rightarrow192$$ so once you know that $$96/6=16$$, you can see that $$192$$ is a multiple of $$95$$ and must have a solution, in this case $$192/3=64$$. You may have to experiment a little bit or even write a little program to find such as $$(22,19)\rightarrow25$$ but you will always find solutions.

I cannot help you with "proof" but, you may be able to figure something out from the "several" repeating patterns I saw in MY spreadsheet.