Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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$?

share|cite|improve this question
up vote 0 down vote accepted

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:

$\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.

share|cite|improve this answer
Thank you, much appreciated. I'd vote up if I could. – jgailberg Jun 3 '14 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 '14 at 23:09

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.

share|cite|improve this answer
Thank you! I was hoping for a lot simpler solution but I guess your answer shows why it could not be found. – jgailberg Jun 3 '14 at 20:21
No. What i wrote shows that it is solvable. See what agha wrote to see that it is easily solvable. – Peter Sheldrick Jun 3 '14 at 20:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.