4. Determine all triples $(x, y, z)$ of real numbers for which

$$
\begin{aligned}
& x^{2}+x y=y^{2}+z^{2}, \\
& z^{2}+z y=y^{2}+x^{2} .
\end{aligned}
$$
SOLUTION. By subtracting the first equation from the second, we get after rearrangement

$$
(z-x)(2 z+2 x+y)=0
$$

Therefore, there are two possible cases, which we will consider separately.[^0]a) Case $z-x=0$. Substituting $z=x$ into the first equation of the system, we get $x^{2}+x y=y^{2}+x^{2}$, or $y(x-y)=0$. This means that $y=0$ or $x=y$. In the first case, we obtain the triples $(x, y, z)=(x, 0, x)$, and in the second $(x, y, z)=(x, x, x)$; such triples are solutions to the given system for any real number $x$, as can be easily verified by substitution (although such a check is not really necessary in our method).

b) Case $2 z+2 x+y=0$. Substituting $y=-2 x-2 z$ into the first equation of the system, we get

$$
x^{2}+x(-2 x-2 z)=(-2 x-2 z)^{2}+z^{2} \text { or } 5(x+z)^{2}=0 .
$$

The last equation is satisfied precisely when $z=-x$, in which case $y=-2 x-2 z=0$. We obtain the triples $(x, y, z)=(x, 0,-x)$, which are solutions to the given system for any real $x$, as can be verified by substitution. (The same applies to such a check as in case a).)

Answer. All solutions $(x, y, z)$ of the given system are triples of three types:

$$
(x, x, x), \quad(x, 0, x), \quad(x, 0,-x),
$$

where $x$ is any real number.