# A system of equations

Given three equations $x^2+y^2+xy=a$, $y^2+z^2+yz=b$ and $x^2+z^2+xz=c$, how can I solve for $x,y$ and $z$ in terms of $a,b$ and $c$?

-

If we multiply second equation by $-1$ and add to first we have:

$x^2+y^2+xy-y^2-z^2-yz=(x+y+z)(x-z)=a-b$

Next do the same with other equation:

$(x+y+z)(y-z)=a-c$

$(x+y+z)(y-x)=b-c$

Now if $a \neq c$ we can divide first by second and get:

$\frac{x-z}{y-z}=\frac{a-b}{a-c}$, so:

$(x-z)(a-c)=(a-b)(y-z)$. It's linear.

Next do the same with the other equations and we get a system of three linear equation which is easy to solve. There are also cases $a=c$, $a=b$ or $b=c$, but it's easier than in general case.

-
Thank you, much appreciated. I'd vote up if I could. –  jgailberg Jun 3 at 20:35
It's a curious case. Actually what I get from your suggestion is not three distinct linear equations but only one and same which is $(a-c)x+(b-a)y+(c-b)z=0$ so I'm a little bit stuck again. –  jgailberg Jun 3 at 23:09
$$a^4 - 4a^3b - 4a^3c + 3a^3z^2 + 6a^2b^2 + 10a^2bc - 12a^2bz^2 + 6a^2c^2 - 12a^2cz^2 + 9a^2z^4 - 4ab^3 - 8ab^2c + 15ab^2z^2 - 8abc^2 + 9abcz^2 - 9abz^4 - 4ac^3 + 15ac^2z^2 - 9acz^4 + b^4 + 2b^3c - 6b^3z^2 + 3b^2c^2 - 3b^2cz^2 + 9b^2z^4 + 2bc^3 - 3bc^2z^2 - 9bcz^4 + c^4 - 6c^3z^2 + 9c^2z^4=0$$
By inspection (or using the sympy .subs() method) we see that this equation is a fourth degree univariate polynomial equation in $z$ if $a,b,c$ are constant.