Integer solutions to $x^2-xy+y^2=1$

1.7k Views Asked by At

What are the integer solutions to $x^2-xy+y^2=1$?

(I found the solution below while working on another problem, so I thought I'll add it to the knowledge base here.)

3

There are 3 best solutions below

3
On

Let us make a coordinate transform and substitute $x:=a+b,y:=a-b$. As $x,y \in \mathbb Z$ we get $a = \frac{x+y}{2}, b = \frac{x-y}{2} \in \frac{1}{2}\mathbb Z$

If we apply the substitution to the given equation we get:

$$1 = x^2-xy+y^2 = 3b^2+a^2$$

And we are looking for solutions $a,b \in \frac12 \mathbb Z$. These solutions can easily be found, and then (possibly) transformed back to $x,y$.

As $1 = 3b^2 + a^2 \geq 3b^2 \implies \frac13 \geq b^2 \implies b \in \{ \frac 12,-\frac 12, 0\}$ If we plug those values into $b$ and solve for $a$ we get $a = \sqrt{1-3b^2} = \{1/2,1/2,1\}$

For $a,b$ we then have following solutions, which are all solutions:

$(a,b) = (\frac12,\frac12),(\frac12,-\frac12),(-\frac12,\frac12),(-\frac12,-\frac12),(1,0),(-1,0)$.

Transforming these back to $x,y$ we get

$(x,y) = (1,0),(0,1),(1,1),(-1,0),(0,-1),(-1,-1)$

3
On

You could also have done it in a easier way :

$$x^2-xy+(y^2-1)=0$$

has (real) solutions if $$y^2-4(y^2-1) \geq 0.$$

Now this leads to $$y^2\leq 4/3$$ and hence, if you want integer solutions to $$y=\pm 1, 0.$$ Then you put it back in the equation and you solve it for $x$.

0
On

We have $$4(x^2-xy+y^2)=4\iff (2x-y)^2+3y^2=4$$ and so $$y^2=\frac 13\left(4-(2x-y)^2\right)\le \frac 43\quad\Rightarrow\quad y=0,\pm 1$$ Hence, the answer is $$(x,y)=(1,0),(-1,0),(0,1),(1,1),(0,-1),(-1,-1)$$