# Rearranging 5 equations

I am trying to rearrange 5 equations in terms of 5 variables. I have the equations for y1, y2, y3, y4 and y5 in terms of x1, x2, x3, x4 and x5, but I want to solve for x1, x2, x3, x4 and x5 in terms of y1, y2, y3, y4 and y5. I tried the following:

Solve[{y1 == x4*((x2*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y2 == x4*((x1*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y3 == x4*((x1*x2 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y4 == x4*(1/(2*x5 + x2 + x3)),
y5 == x4*(1/(2*x5 + x1 + x3))}, {x1, x2, x3, x4, x5}]


and the output

{}


I looked at this post and thought that maybe I should be using Reduce, so I tried the following:

Reduce[{y1 == x4*((x2*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y2 == x4*((x1*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y3 == x4*((x1*x2 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y4 == x4*(1/(2*x5 + x2 + x3)),
y5 == x4*(1/(2*x5 + x1 + x3))}, {x1, x2, x3, x4, x5}]


as well as this:

Reduce[{y1 == x4*((x2*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y2 == x4*((x1*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y3 == x4*((x1*x2 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
y4 == x4*(1/(2*x5 + x2 + x3)),
y5 == x4*(1/(2*x5 + x1 + x3)),
y1 > 0, y2 > 0, y3 > 0, y4 > 0, y5 > 0}, {x1, x2, x3, x4, x5}]


and Mathematica just gets stuck calculating for a long time and doesn't display anything. Is this the correct way to solve this problem? Any suggestions?

• x4 is just a scale factor for the ys Sep 18, 2014 at 23:24
• You get an empty solution set because there are no solutions. As it happens, anything that might make the equations vanish also makes denominators zero. So you are getting an appropriate result. Sep 18, 2014 at 23:26
• So the problem is that I didn't specify that the denominators can't be zero? Is there a way to specify this is not the case? I tried: "Solve[{y1 == x4*((x2*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)), y2 == x4*((x1*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)), y3 == x4*((x1*x2 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)), y4 == x4*(1/(2*x5 + x2 + x3)), y5 == x4*(1/(2*x5 + x1 + x3)), (x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3) != 0, (2*x5 + x2 + x3) != 0}, {x1, x2, x3, x4, x5}]" but that didn't work. Sep 18, 2014 at 23:33
• Hi belisarius, I'm aware that y scales with x4, but I'm not sure where you're going with your statement. Could you explain? Sep 18, 2014 at 23:49
• Actually Solve will automatically enforce that denominators do not vanish. In effect it does what you did explicitly. And it turns out that no solutions exist. Sep 18, 2014 at 23:59

As @DanielLichtblau noted in the comments, Solve correctly returns an empty set because there are no solutions to the system. But if you want to rearrange the equations of the system in terms of x1,x2,x3,x4, and x5, you can do something like the following:

Module[{res,
vars = {x1, x2, x3, x4, x5},
eqn1 = y1 == x4*((x2*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
eqn2 = y2 == x4*((x1*x3 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
eqn3 = y3 == x4*((x1*x2 - x5^2)/(x1*x2*x3 - (x5^2)*(x1 + x2 + x3) - 2*x5^3)),
eqn4 = y4 == x4*(1/(2*x5 + x2 + x3)),
eqn5 = y5 == x4*(1/(2*x5 + x1 + x3))},
res = Table[Simplify@Flatten@Solve[j, {i}], {i, vars}, {j, {eqn1, eqn2, eqn3, eqn4, eqn5}}];
res = vars /. Flatten@res[[All, -2 ;; -1]];
Table[(Thread[vars == #] & /@ res)[[i, i]], {i, Length[res]}]]

(*{{x1 == -x3 - 2 x5 + x4/y5},
{x2 == -x3 - 2 x5 + x4/y4},
{x3 == -x2 - 2 x5 + x4/y4},
{x4 == (x2 + x3 + 2 x5) y4},
{x5 == (x4 - (x2 + x3) y4)/(2 y4)}}*)