TITLE: Solve for integers $x, y, z$ such that $x + y = 1 - z$ and $x^3 + y^3 = 1 - z^2$.
QUESTION [11 upvotes]: Solve for integers $x, y, z$ such that $x + y = 1 - z$ and $x^3 + y^3 = 1 - z^2$.

I think we'll have to use number theory to do it. Simply solving the equations won't do.
If we divide the second equation by the first, we get:
$$x^2 - xy + y^2 = 1 + z.$$
Also, since they are integers $z^2 \ge z \implies -z^2 \le -z$. This implies
$$x + y = 1 - z \ge 1 - z^2 = x^3 + y^3.$$
This shows that atleast one of $x$ and $y$ is negative with the additive inverse of the negative being larger than that of the positive.
I have tried but am not able to proceed further. Can you help me with this?
Thanks.

REPLY [4 votes]: Substituting the first in the second gives
$$x^3+y^3+(x+y)^2-2(x+y)=0$$
so $x+y=0$ (giving $z=1$) or
$$x^2-xy+y^2+x+y-2=0,$$
that is,
$$\left(x+\frac12-\frac y2\right)^2+\frac34(y+1)^2-3=0$$
so $(y+1)^2\leq4$, which leaves to check $y\in\{-3,-2,-1,0,1\}$.
All solutions are given by
$$\begin{align*}(x,y,z)\in\{&(a,-a),\;a\in\mathbb Z,&&(z=1)\\
&(-2,-3),&&(z=6)\\
&(-3,-2),(0,-2),&&(z=6,z=3)\\
&(-2,0),(1,0),&&(z=3,z=0)\\
&(0,1)&&(z=0)\}\end{align*}$$

Perhaps some explanation how I got $\left(x+\frac12-\frac y2\right)^2+\frac34(y+1)^2-3=0$. This is called Completing the square:
Starting from $x^2-xy+y^2+x+y-2=0$ we first get rid of the linear term in $x$. Using $x^2+x=(x+\frac12)^2-\frac14$ we find:
$$\left(x+\frac12\right)^2-\frac14-xy+y^2+y-2=0.$$
Let $X=x+\frac12$. We have
$$X^2-\frac14-Xy+\frac y2+y^2+y-2=0.$$
Now we want to get rid of the mixed term (for the moment we don't care about additional terms in $y$ or constant terms). Using $X^2-Xy=(X-\frac y2)^2-\frac{y^2}4$ we find:
$$\left(X-\frac y2\right)^2-\frac{y^2}4-\frac14+\frac y2+y^2+y-2=0.$$
Now we're left only with terms in $y$: $\frac34y^2+\frac32y-\frac94$. Using $y^2+2y=(y+1)^2-1$ we find:
$$\frac34y^2+\frac32y-\frac94=\frac34(y+1)^2-\frac34-\frac94.$$
So finally,
$$\left(X-\frac y2\right)^2+\frac34(y+1)^2-3=0;\qquad X=x+\frac12.$$

Note: Using this technique, any (inhomogeneous) binary quadratic equation
$$ax^2+bxy+cy^2+\text{linear and constant terms}=0$$
with nonzero discriminant $D=b^2-4ac$ can be rewritten in the form
$$U^2-DV^2=c$$
where $U$ is a linear (better: affine) function of $x$ and $y$, and $V$ is an affine function of $y$. If $D<0$ (as was the case here), the equation clearly has only finitely many solutions. It can be shown that if $D>0$ it has either $0$ or $\infty$ solutions (in that case we call it a Pell-type-equation or something).
If $D=0$ things get ugly.
Geometrically, these correspond to finding integer points on an ellipse if $D<0$, a hyperbola if $D>0$ and a parabola or a union of at most two lines if $D=0$.