# Number of integer solutions of the following equation

Consider the equation $a^2+ab+b^2=1$. How many integer pairs are solutions to this?

I found 4 pairs: $a=-1, b=0$; $a=0, b=-1$; $a=1,b=0$; $a=0, b=1$.
But the solution says the answer is 6. Which other possibilities am I missing? Please post the answer with solution.

#### Solutions Collecting From Web of "Number of integer solutions of the following equation"

Note that
$$a^2+ab+b^2=1\iff4a^2+4ab+4b^2=4\iff(2a+b)^2+3b^2=4.$$
If $b=0$ then it gives $a=\pm1$. If $b=1$ then $a=0$ or $a=-1$ and if $b=-1$ then $a=0$ or $a=1$. Otherwise, you will have
$$4=(2a+b)^2+3b^2\ge (2a+b)^2+12$$
which is impossible.

So, the solutions are
$$(-1,0),(1,0),(0,1),(-1,1),(0,-1),(1,-1)$$
(there are 6 solutions as you wanted)

Note that you can complete the square in $a^2+ab+b^2=1$to get $$\left(a+\frac b2\right)^2+\frac 34b^2=1$$

Now you can see that the sum of the two positive terms can only be equal to $1$ if the terms themselves are less than or equal to $1$. This means that $|b|\leq 1$ and by symmetry $|a|\leq 1$.

If $a=0$ then $b=\pm 1$ and if $b=0$ then $a=\pm 1$. What happens if neither $a$ nor $b$ is zero – say $a=1$ – what solutions do you find then?