# Solving symbolic equation for fraction of variables

Suppose there is an equation like this (overly simplified example):

eqn1 = ui - ua r1 / (r1 + r2) == 0


How can I get Mathematica to "solve" the equation in terms of:

eqn2 = v == ua / ui


i.e. have Mathematica deliver v == 1 + r2 / r1 as a result? Despite googling I cannot find the proper way (tried equation system, Eliminate, LinearSolve, ...). Thanks in advance - Rob

You can combine Solve with Eliminate:

Solve[
Eliminate[{ui-ua r1/(r1+r2)==0,v==ua/ui}, ua],
v
]


{{v -> (r1 + r2)/r1}}

• works like a charm, thx. Shouldn't the 2nd parameter on Eliminate be the list {ua , ui} rather than {ua} ? – Robert GID S. May 30 at 0:03
• @RobertGIDS. With only two equations, I think it's safer to try to eliminate just one variable. – Carl Woll May 30 at 0:17

Although not currently documented, you can include in Solve a list of variables to be eliminated.

Solve[{ui - ua r1/(r1 + r2) == 0, v == ua/ui}, v, {ua}][[1]] // Expand

(* {v -> 1 + r2/r1} *)

• Thx, this works indeed - though I'm confused as the Language Reference designates Solve's 3rd parameter as "domain", e.g. Integers, Reals, Complexes - it never occured to me that "domain" could also be used for variable elimination. I guess not many folks are aware of this context - so kudos to you for pointing this out. I'd appreciate if you kindly comment on this "[ [1] ]" construct - what is it's meaning ? – Robert GID S. May 29 at 23:56
• @RobertGIDS. - As I stated, the use of a list of variable to be eliminated is not documented. It was a long time ago and presumably still functions to maintain backward compatibility. Consequently, the third argument here is not being used to specify a domain. The [[1]] takes the first element of a list (see Part). In this case it removes an extra set of list brackets. – Bob Hanlon May 30 at 0:06