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 
 A: The discriminant was:
$$\begin{align}
2xy+2x-x^2-y^2-4&=k^2\\
\text{let} \qquad y=x \pm &t \\
2x(x \pm t)+2x-x^2-(x \pm t)^2-4&=k^2\\
2x^2 \color{red}{\pm 2tx}+2x-x^2-x^2 \color{red}{\mp 2tx}-t^2-4&=k^2 \\
2x-t^2-4&=k^2 \\
x&=\frac{1}{2}(k^2+t^2+4) \\
y=x\pm t&=\frac{1}{2}(k^2+t^2 \pm 2t+4) \\
&=\frac{1}{2}\left[k^2+(t\pm 1)^2+3\right] \\
z=z=\frac{(y-1)\pm k}{2}&=\frac{\frac{1}{2}[k^2+(t\pm 1)^2+1] \pm k}{2} \\
&=\frac{(k\pm1)^2+(t\pm 1)^2}{4}
\end{align}$$
A solution set:
$$(x,y,z)=\frac{1}{2}\left(k^2+t^2+4,k^2+(t\pm 1)^2+3, \frac{(k\pm1)^2+(t\pm 1)^2}{2}\right)$$
It's apparent from $x$ and $y$ that both $k$ and $t$ should be the same parity, and it's apparent that from $z$ that that parity should be odd.  If 
$k=2m+1$ and $t=2n+1$ for $(m,n)\in \mathbb{Z}^2$:
$$\begin{align}
x&=\frac{1}{2}[(2m+1)^2+(2n+1)^2+4] \\
&=2m^2+2m+2n^2+2n+3 \\
\\
y&=\frac{1}{2}[(2m+1)^2+(2n+1\pm 1)^2+3] \implies \\
&\quad y_1=2m^2+2m+2(n+1)^2+2  \\
&\quad y_2=2m^2+2m+2n^2+2 \\
\\
z&=\frac{1}{4}[(2m+1\pm1)^2+(2n +1 \pm 1)^2] \implies \\
&\quad z_{(y_1,1)}=m^2+(n+1)^2 \\
&\quad z_{(y_1,2)}=(m+1)^2+(n+1)^2 \\
&\quad z_{(y_2,1)}=(m+1)^2+n^2 \\
&\quad z_{(y_2,2)}=m^2+n^2
\end{align}$$
To summarize:
$$\begin{align}
\text{for a given} \quad (m,n) &\to (x,y_1,z_{(y_1,1)}) \\
&\to (x,y_1,z_{(y_1,2)}) \\
&\to (x,y_2,z_{(y_2,1)}) \\
&\to (x,y_2,z_{(y_2,2)})
\end{align}$$
The bottom of Will Jagy's answer has the complete set of solutions, corresponding to these formulae 
A: 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
