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.)
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.)
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)$