1
$\begingroup$

I have two simple coupled equations

eqn1 = 0 == -x + P - G x (y + 1);
eqn2 = 0 == -y + G x (y + 1);

If I use Solve[eqn1 && eqn2, y] I get no result. But I can force Mathematica to give me the result by solving eqn1 for x and then substituting that into eqn2 and solving for y

Simplify[Solve[eqn2, y] /. Solve[eqn1, x]]

which gives the result y -> (G P)/(1 + G (1 - P + y)).

Why does the single pass of Solve not work; and can I make it work?

$\endgroup$
4
  • 1
    $\begingroup$ I think I've seen a few more problems when solving for n equations with m unknowns and m!=n $\endgroup$
    – Bill
    Commented Feb 12, 2021 at 12:44
  • 4
    $\begingroup$ Try Solve[{0 == -x + P - G x (y + 1), 0 == -y + G x (y + 1)}, y, x] $\endgroup$ Commented Feb 12, 2021 at 12:45
  • 1
    $\begingroup$ @J.M. - If you use a List bracket around the eliminate variable, you can avoid a Solve::bdomv warning. That is, Solve[{0 == -x + P - G x (y + 1), 0 == -y + G x (y + 1)}, y, {x}] $\endgroup$
    – Bob Hanlon
    Commented Feb 12, 2021 at 17:23
  • $\begingroup$ @Bob, you're right; old habits... $\endgroup$ Commented Feb 12, 2021 at 17:25

2 Answers 2

1
$\begingroup$

In general, this system has no solution for y. That's to be expected: usually for a system of two equations you need to solve for two variables. Solve[eqn1 && eqn2, {x, y}] yields two solutions.

$\endgroup$
1
$\begingroup$

In 12.2

eqn1 = 0 == -x + P - G x (y + 1);eqn2 = 0 == -y + G x (y + 1);
Reduce[eqn1 && eqn2, y]

(x == 0 && P == 0 && y == 0) || (x (-1 - P + x) != 0 && G == -((P - x)/(x (-1 - P + x))) && y == P - x)

You may solve G == -((P - x)/(x (-1 - P + x))) in x and then express y in terms of P and G. I leave it on your own.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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