# Find all solutions to the equation $x^2 + y^2 + xy = (xy)^2$

Can anyone help me find the number of solutions to the equation:

$$x^2 + y^2 + xy = (xy)^2$$

Let me give a brief account of what I've tried to proceed with:

Case 1: One of $$x$$ and $$y$$ is odd. This results into a contradiction where the parity of LHS and RHS differs.

Case 2: Both of $$x$$ and $$y$$ are even. I have shown that no solution apart from $$x=y=0$$ exists and I've proved that using Infinite Descent.

Now I'm stuck in case $$3$$ where both $$x$$ and $$y$$ are odd.

• Did you prove Case 2 with infinite descent? Mar 23, 2016 at 12:19
• @Dhruv Yes, I did it using Fermat's method of Infinite Descent only. That's quite tedious to type. Mar 23, 2016 at 12:24
• Try writing it a $(x^2-1)(y^2-1)=xy+1$. Mar 23, 2016 at 12:27
• I thought of writing it as $$(x+y)^2 = xy(xy+1)$$ Now we find that in the RHS the two numbers are relatively prime and hence do not share a common multiple other than 1 and since 2 consecutive numbers can not be both squares (other than 1 and 0) and thus $(xy(xy+1))$ is not a perfect square and we reach a contradiction. The exception is of $x=y=0$. Mar 23, 2016 at 12:40

You can write your equation (leaving the trivial $x=0,y=0$) as $$\frac xy+ \frac yx +1 =xy$$ now let $x/y=k$ and rearrange: $$k^2(1-y^2)+k+1=0$$ which has rational solutions only if $4y^2-3=p^2$. This implies that $y=\pm 1$. Hence the only integer solutions are $(-1,1)$ and $(1,-1)$.

First, write it as $(x^2-1)(y^2-1)=xy+1$.

In the narrow ranges where $|x|\leq 1$ or $|y|\leq 1$, you can solve yourself.

Then, when $x>1$ and $x>1$ you have $(x^2-1)(y^2-1)>=2(x^2+y^2-2)=2(x-y)^2+4xy-4\geq 4xy-4$.

But $xy\geq 4$, so $4xy -4> xy +3\cdot 4 -4 \geq xy-1$.

The case when $x<-1$ and $y<-1$ is the same.

There are no cases when $x<-1$ and $y>1$ because then $xy+1<0$.

Finally, if $x=0$, $y=0$. If $x=-1$ then $y=1$, and if $x=1,$ $y=-1$.

The key is that in most cases, it is "obvious" that $(x^2-1)(y^2-1)$ is a lot bigger than $xy$.

Another approach. Let $d=xy$. Then assume $d\neq 0$ and you have:

$$x^2+\frac{d^2}{x^2}=d^2-d$$

or

$$x^4-(d^2-d)x^2 + d^2=0$$

$$x^2=\frac{d^2-d \pm \sqrt{d^2(d-3)(d+1)}}{2}$$

When is $(d-3)(d+1)=(d-1)^2-4$ a perfect square? The only case of perfect squares that differ by four is $0$ and $4$. That means $d=3$ or $d=-1$.

The only cases left to handle then are $d=0$ and $d=3$.

I'm assuming you're looking for integer solutions, even though you didn't say os.

If you rewrite the LHS as $(x+y)^2 - xy$, your equations becomes $$(x+y)^2 = xy(xy + 1)$$

For positive $x$ and $y$:

Suppose (by swapping names if necessary) that $x \ge y$. Then the left hand side is no more than $4x^2$, while the right hand side is at least $y^2 x^2$.
We have $$LHS = (x+y)^2 \le (x+x)^2 = 4x^2$$ and $$RHS = xy(xy + 1) > (xy)^2 = y^2 x^2.$$ If $y \ge 2$, then $$RHS > y^2 x^2 \ge 2^2 x^2 = 4 x^2$$ but RHS and LHS are equal, so we have a number that's both $\le 4x^2$ and $> 4x^2$, and that's a contraduction.

That means that $y$ is at most one. That should get you on your way.

For the case where one of $x$ and $y$ is negative, you still have some work to do.

• Why is $y$ at most 1? Mar 23, 2016 at 12:27
• Yes..Why so John Hughes? Pl elaborate your point. Mar 23, 2016 at 12:30
• Expanded details to show contradiction if $y \ge 2$. Mar 23, 2016 at 14:48

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

The discriminant is $$y^2-4y^2(1-y^2)=y^2(4y^2-3)$$

So, $4y^2-3$ needs to be perfect square

$4y^2-3=a^2\iff(2y-a)(2y+a)=3$

$\implies2y-a,2y+a=\pm3,\pm1$

Your answer is three, and in my opinion, a basic algebraic approach most clearly shows the solution. This equation is comprised of symmetric polynomials $$x^2+y^2$$ and $$xy$$, so finding one solution, $$(x,y)=(p,q) \ | \ p \neq q$$ is equivalent to finding two $$(x,y)=(p,q),(q,p)$$. If we let algebra drive:

$$x^2 + y^2 + xy = (xy)^2 \to \\ (x + y)^2 = (xy)^2+(xy) \to \\ (2x + 2y)^2 = 4(xy)^2+4(xy) \to \\ (2x + 2y)^2 = 4(xy)^2+4(xy) +1-1\to \\ (2x + 2y)^2 = (2xy+1)^2-1 \implies$$

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

Then we arrive at a difference of two squares being $$1$$. It can only imply that $$\begin{cases} 2xy+1&=(\pm 1)\\ 2x+2y&=0 \end{cases}$$ From the second $$x=-y$$. Putting this into the first yields $$-2y^2+1=(\pm 1) \to \\ y^2=\frac{1-(\pm 1)}{2}$$ So $$(x,y)=(0,0),(1,-1),(-1,1)$$

Note that $$t^2-1\geq |t|+1>0$$ for all real numbers $$t$$ such that $$|t|\geq 2$$ (this is because $$\big(|t|-2\big)\big(|t|+1\big)\geq 0$$). Therefore, if $$|x|\geq 2$$ and $$|y|\geq 2$$, then $$\left(x^2-1\right)\left(y^2-1\right)\geq \big(|x|+1\big)\big(|y|+1\big)>|xy|+1\geq xy+1\,.$$ This means $$x^2+y^2+xy<(xy)^2$$. Thus, any solution $$(x,y)\in\mathbb{Z}\times\mathbb{Z}$$ to $$x^2+y^2+xy=(xy)^2$$ must come from the case where $$|x|\leq 1$$ or $$|y|\leq 1$$.

Clearly, $$x=0$$ if and only if $$y=0$$. We now exclude the solution $$(x,y)=(0,0)$$, so we are left with the case $$|x|=|y|=1$$. This means $$xy+1=\left(x^2-1\right)\left(y^2-1\right)=0\,,$$ so $$xy=-1$$. This implies $$(x,y)=(-1,+1),(+1,-1)$$.