# Why is prior manipulation necessary before using 'Solve'?

I wish to use Mathematica to rearrange the following equation:

Ia Ra + Ia Ma s == (-Ia + Iref) kp Ma + Ia Ra

into this form:

Ia / Iref == kp/(kp + s)

I defined an additional variable lhs == Ia / Iref and tried to use Solve to re-arrange it like so:

Solve[{Ia Ra + Ia Ma s == (-Ia + Iref) kp Ma + Ia Ra , lhs == Ia/Iref}, {lhs}]

This returned no output, I don't understand why.

However, if I substitute the expression before passing it into Solve, it works:

Ia Ra + Ia Ma s == (-Ia + Iref) kp Ma + Ia Ra /. {Ia -> lhs Iref}
Solve[%, {lhs}]
{{lhs -> kp/(kp + s)}}


Why does the first method work and not the second?

Is there a better way to achieve the re-arranging using Mathematica?

\$Version

(* "13.2.0 for Mac OS X ARM (64-bit) (November 18, 2022)" *)

Clear["Global*"]

eq1 = Ia Ra + Ia Ma s == (-Ia + Iref) kp Ma + Ia Ra;

eq2 = lhs == Ia/Iref;


With two equations you must either (1) solve for two variables, or (2) solve for one variable and eliminate one variable. Using the second option

Equal @@
(Solve[{eq1, eq2}, lhs, {Ia}][[1, 1]] /.
(Rule @@ eq2))

(* Ia/Iref == kp/(kp + s) *)


Expanding one more amazing answer by @BobHanlon into its constituent steps and more:

s1 = Simplify[eq1 && eq2]

(*Iref kp Ma == Ia Ma (kp + s) && Ia/Iref == lhs*)

e1 = Eliminate[s1, Ia]

(*lhs Ma (kp + s) == kp Ma && Iref != 0*)

v1=Solve[e1, lhs]

(*{{lhs -> kp/(kp + s)}}*)

q1 = Equal @@ v1[[1, 1]]

(*lhs == kp/(kp + s)*)

q1 /. Rule @@ eq2

(*Ia/Iref == kp/(kp + s)*)
`