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$?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
If we multiply second equation by $-1$ and add to first we have:
Next do the same with other equation:
Now if $a \neq c$ we can divide first by second and get:
$(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.
Using the groebner function from sympy we get a somewhat unwieldy groebner basis, of which the last equation (out of 9) is:
$$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.