Solve $x^2+y^2+z^2+xy+yz+zx = 2w^2$ 
Solve in integers the equation $$x^2+y^2+z^2+xy+yz+zx = 2w^2.$$

A trivial solution to the equation is $x = y = z = w = 0$. We can rewrite the given equation as $$(x+y)^2+(x+z)^2+(y+z)^2 = 4w^2.$$ I then thought about doing a substitution, but didn't see how to do it without becoming computational. How can we continue?

the primitive solutions to $$ a^2 + b^2 + c^2 = d^2, $$
that is
$$ \gcd(a,b,c,d) = 1, $$ 
are given by the quaternion norm; We must have $d$ odd and one of the others, say $a.$ as well. Then
$$ a = p^2 + q^2 - r^2 - s^2, $$
$$ b = 2(-ps +qr), $$
$$ c = 2(pr+qs), $$
$$ d = p^2 + q^2 + r^2 + s^2.  $$
This is with $p+q+r+s$ odd, along with $\gcd(p,q,r,s)=1.$
This formula was surely known to Euler. However, the first acceptable proof that all primitive solutions occur this way was by L. E. Dickson, about 1920.
There is a way to get the formulas above. I have not used letter $t$ yet, take
$$ t = p + qi + rj + sk,  $$
then
$$ \bar{t}i t = ai+bj+ck.  $$
Note that, for your $e^2 + f^2 + g^2 = 4 w^2,$
we must have $e,f,g$ all even. So, take
$$ x+y = 2a, y+z = 2b, z+x = 2c, w = d. $$ 
Apparently
$$ x = a-b+c, \; \;  y = a+b - c, \; \;  z = -a +b+c. $$
Very Heronian, and all odd.
For the curious, the integer values of
$$ x^2 + y^2 + z^2 + yz + zx + xy $$
are exactly the same as the integer values of
$$ u^2 + v^2 + 2 w^2, $$
that is, all positive integers except
$$ 4^k (16 n + 14).  $$
See  ME
