Diophantine equation: $(x-y)^2=x+y$ I have to solve the following equation: $(x-y)^2=x+y$, where $x$ and $y$ are non-negative integers. This equation has an infinite number of solutions, but how to prove that there exists a positive integer k such that $x=\frac{(k+1)(k+2)}{2}$ and $y=\frac{k(k+1)}{2}$? Thanks!

On rearranegment we have $$x^2-x(2y+1)+y^2-y=0$$
$$\implies x=\frac{2y+1\pm\sqrt{(2y+1)^2-4(y^2-y)}}2=\frac{2y+1\pm\sqrt{8y+1}}2$$
As $x$ has to be integer, we need $8y+1$ to be perfect square
As $y$ is also an integer, $8y+1$ is odd, hence can be written as $(2a+1)^2$ where $a$ is any integer 
Now simplify and find $x,y$ is terms of $a$
