# Solve a system of non-linear equations

Is there any way to get an exact solution a system of non-linear equations?

The system I would like to solve is:

$\quad \quad \begin{eqnarray} h_{1}x_{1}=c_{1}\\ h_{2}x_{2}=c_{2}\\ h_{3}(1-x_{1}-x_{2})=c_{3}\\ h_{1}h_{2}y_{12}=c_{12}\\ -h_{1}h_{3}y_{11}-h_{1}h_{3}y_{12}=c_{13}\\ -h_{2}h_{3}y_{22}-h_{2}h_{3}y_{12}=c_{23}\\ h_{1}^2y_{11}+y_{0}=c_{11}\\ h_{2}^2y_{22}+y_{0}=c_{22}\\ h_{3}^2(y_{11}+y_{22}+2y_{12})+y_{0}=c_{33}\\ \end{eqnarray}$

where $h_{1},h_{2},h_{3},x_{1},x_{2},y_{12},y_{11},y_{22},y_{0}$ are unknowns, and $c_{1},c_{2},c_{3}.c_{13},c_{23},c_{11},c_{22},c_{33}$ are known constants.

How can I get an exact solution in terms of $h_{1},\,h_{2},\,h_{3},\,x_{1},\,x_{2},\,y_{12},\,y_{11},\,y_{22},\,y_{0}$

I tried the following Mathematica code, but it's been running for long time without any results. Can anyone help?

Solve[
h1*w1 == c1 &&
h2*w2 == c2 &&
h3*(1 - w1 - w2) == c3 &&
h1*h2*y12 == c12 &&
-h1*h3*y11 - h1*h3*y12 == c13 &&
-h2*h3*y22 - h2*h3*y12 == c23 &&
h1^2*y11 + y0 == c11 &&
h2^2*y22 + y0 == c22 &&
h3^2*(y11 + y22 + 2*y12) + y0 == c33,
{h1, w1, h2, w2, h3, y12, y11, y22, y0}]

• …and you've tried using Solve[]? – J. M.'s ennui Jun 24 '15 at 20:00
• Why not try it yourself first and report back? – J. M.'s ennui Jun 24 '15 at 20:03
• Being a member for almost 60 days I can't help it, but wonder -- Haven't you noticed the formatted code, $\LaTeX$ typeset formulas, etc ? Aren't you trying to improve the readability of your posts ? – Sektor Jun 24 '15 at 20:05
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. – Michael E2 Jun 24 '15 at 22:54
• @bbgodfrey: the equations are algebraic, tho; one wonders if there is at least expressions in terms of Root[] – J. M.'s ennui Jun 25 '15 at 0:07

Some progress can be made using Eliminate.

Eliminate[
h1*w1 == c1 &&
h2*w2 == c2 &&
h3*(1 - w1 - w2) == c3 &&
h1*h2*y12 == c12 &&
-h1*h3*y11 - h1*h3*y12 == c13 &&
-h2*h3*y22 - h2*h3*y12 == c23 &&
h1^2*y11 + y0 == c11 &&
h2^2*y22 + y0 == c22 &&
h3^2*(y11 + y22 + 2*y12) + y0 == c33,
{w1, w2, y0}] // Simplify

{* c11 + h3^2 (y11 + 2 y12 + y22) == c33 + h1^2 y11 &&
c12 == h1 h2 y12 &&
c13 + h1 h3 (y11 + y12) == 0 &&
c22 + h3^2 (y11 + 2 y12 + y22) == c33 + h2^2 y22 &&
c23 + h2 h3 (y12 + y22) == 0 &&
c3 h1 h2 + c2 h1 h3 + c1 h2 h3 == h1 h2 h3 *)


Attempting Eliminate[%, {y12, y22, y11}] did not return an answer in a reasonable amount of time, so I begin eliminating variables one at a time, which is quite fast. The size of the answers first grows and then shrinks, as shown at the end.

Eliminate[%, y12] // Simplify;
Eliminate[%, y22] // Simplify;
Eliminate[%, y11] // Simplify;
Eliminate[%, h1] // Simplify;
Eliminate[%, h2] // Simplify

(*
c1^3 (c12^2 c23 - c13^2 c23 + c12 c13 (-c22 + c33)) + c12^3 c2^2 (c3 - h3) +
c1 (2 c13^2 c2^2 c23 - c2^2 c23^3 + c2 c22 c23^2 c3 +
c13^2 c23 c3^2 + c23^3 c3^2 + c2^2 c22 c23 c33 +
c13^2 c2 c3 c33 - c2 c22^2 c3 c33 - c2 c23^2 c3 c33 -
c22 c23 c3^2 c33 + c2 c22 c3 c33^2 +
c11^2 (c2^2 c23 - c2 (c22 - c33) (c3 - h3) - c23 (c3 - h3)^2) -
c12^2 (c2^2 c23 + c2 c22 (c3 - h3) + 2 c23 (c3 - h3)^2) +
c12 c13 (c2^2 (2 c22 - c33) + (c22 - 2 c33) (c3 - h3)^2) +
c11 (-c2^2 c23 (c22 + c33) + c12 c13 (-c2^2 + (c3 - h3)^2) +
c12^2 c2 (c3 - h3) - c2 (c13^2 - c22^2 + c33^2) (c3 - h3) +
c23 (c22 + c33) (c3 - h3)^2) - c2 c22 c23^2 h3 -
2 c13^2 c23 c3 h3 - 2 c23^3 c3 h3 - c13^2 c2 c33 h3 +
c2 c22^2 c33 h3 + c2 c23^2 c33 h3 + 2 c22 c23 c3 c33 h3 -
c2 c22 c33^2 h3 + c13^2 c23 h3^2 + c23^3 h3^2 - c22 c23 c33 h3^2) +
c12 (c11 c2 (c2^2 c23 - c2 (c22 - c33) (c3 - h3) - c23 (c3 - h3)^2) +
c13^2 (-2 c2^2 + (c3 - h3)^2) (c3 - h3) - (c2^2 c23 -
c2 (c22 - c33) (c3 - h3) - c23 (c3 - h3)^2) (c2 c33 + c23 (-c3 + h3))) +
c1^2 (c12^2 c13 c2 + c12 (c2 c23 (c22 + c33) +
c11 (-2 c2 c23 + (c22 - c33) (c3 - h3)) - (c13^2 -
2 c23^2 + (c22 - c33) c33) (c3 - h3)) + c12^3 (-c3 + h3) +
c13 (c13^2 c2 - c2 c22^2 - 2 c2 c23^2 - c22 c23 c3 + c2 c22 c33 -
c23 c3 c33 + c22 c23 h3 + c23 c33 h3 +
c11 (c2 c22 + 2 c23 c3 - c2 c33 - 2 c23 h3))) ==
c13 (-c2^3 c23^2 + c12^2 c2 (c2^2 - 2 (c3 - h3)^2) -
c2^2 c23 (c11 - 2 c22 + c33) (c3 - h3) +
c2 (c13^2 - c22^2 + c23^2 + c11 (c22 - c33) + c22 c33) (c3 -
h3)^2 + (c11 - c22) c23 (c3 - h3)^3)
*)


a cubic in h3, which can be solved with Solve, although the resulting expressions are enormous (a LeafCount of 154557). In principle one could back-substitute the h3 solutions into the preceding equation and solve for h2, etc. However, the subsequent expressions are likely to be equally enormous. So, it is no wonder that a brute force solution using Solve on the original equations takes forever. The sizes of the Eliminate intermediate answers as measured by LeafCount, including the first and last answers given above, are 