<s>[INST] Non negative integer triplets $(x,y,z)$ in $x^2+2y^2+4z^2+5=2(x+y+xy)+4z(y-1)$ 
Non negative integer triplets $(x,y,z)$ in $x^2+2y^2+4z^2+5=2(x+y+xy)+4z(y-1)$

Try:  Writting equation as $$4z^2-4(y-1)z+x^2+2y^2-2(x+y+xy)+5=0$$
Now if equation has real roots. Then $$z=\frac{(y-1)\pm \sqrt{2xy+2x-x^2-y^2-4}}{2}$$
So for integer roots $2xy+2x-x^2-y^2-4=k^2$ , Where $k\in\mathbb{Z}$.
So $$2x-(x+y)^2-4=k^2\Rightarrow (x+y)^2=2x-4-k^2$$
Now i did not understand how can i find non negative integer triplets $(x,y,z)$. Could some help me , Thanks 
 [/INST] There is no way
$(x+y)^2+k^2=2x-4$ is giving you non negative values for $x,y.$
 Now looking on RHS we get that $2x-4$ will give least value at $x=2$.
Also we know that $x^2>mx$ iff $x>m$. ---(1)
Now as $y$ cant be negative and $k^2$ too can't be negative.
From $x^2>2x$ for all $x>2$ which is a contradiction as least value of $(x+y)^2$ is $x^2$ (as $x$ can't be less than $2$ but $y$ can be $0$)    
Conclusion:It should be $(x-y)^2$ in last line of your problem
</s>