# Trivial case for Pell's equation

I was reading Pell's equation, and in the beginning there is a statement:

Notice that if $D = d^2$ is a perfect square, then this problem can be solved using difference of squares. We would have $x^2 - Dy^2 = (x+dy)(x-dy) = 1$, from which we can use casework to quickly determine the solutions.

How to determine the solution? my thoughts: $$(x+dy)= {1\over(x-dy)}$$ and since x+dy is an integer($x,y,d \in \Bbb Z$), we have $$x-dy = \pm1 = x+dy$$ $$2dy = \pm1$$ $$y = \pm{1\over2d}$$

I guess I broke it down into two cases ($\pm1$) but somehow I got there does not exist any solution for the trivial case (x,y must be integral solutions) but x = 1 y = 0 is a solution, where did I make a mistake? does this trivial case have infinitely many solutions?

• Should be $2dy=0$! – bilaterus Nov 16 '15 at 18:29
• $x-dy=x+dy$ means $2dy=\pm 1$? – Thomas Andrews Nov 16 '15 at 18:36
• ...what a stupid mistake – watashiSHUN Nov 16 '15 at 21:12

## 2 Answers

$$(x+dy)(x-dy) = 1$$ implies that we have two cases: $$x+dy = x-dy = 1,$$ or $$x+dy = x-dy = -1.$$ In the first case, adding the equations together gives $$2x = 2, \quad x = 1,$$ from which we must have $y = 0$, and in the second, $$2x = -2, \quad x = -1,$$ which also implies $y = 0$. These solutions are unique for nonzero integers $d$.

Your algebra is not correct because of the way you wrote your equations. Let's take the positive case: you wrote $$x-dy = 1 = x+dy.$$ Then I presume you "moved" the LHS terms to the right; i.e., you subtracted $x$ and added $dy$ to the LHS and the RHS. But if you do this, you have to do it to the middle also, otherwise you would get the nonsensical $$0 = 1 = 2dy,$$ when in truth, you should have written $$0 = 1 - x + dy = 2dy.$$ When you write compound equalities, any manipulation must be done to all components.

The trivial case doesn't have infinitely many solutions and you can see why by thinking about the sequence of squares.

The equation $$x^2 - d^2y^2 = 1$$ says that we have two square numbers one after the other, $0^1$ and $1^2$ is an example - there are no others since squares get further and further apart.

Proof: For $m^2 = 1 + n^2$ with $n$ positive we must have $m > n$ but $m = n+1$ is too large (since $(n+1)^2 = n^2 + 2n + 1$) and so is any larger $m$ so there are no solutions.