Rearrange an algebraic expression so that each variable appears only once

Mathematica gave me a solution to an equation in this form:

ans1 = (b c)/(a - a c + b c)

$\text{ans1} = \frac{b c}{a - a c + b c}$

From solving the same equation by hand, I know of an alternative form in which each variable appears only once:

ans2 = 1/(1 + (1/c - 1) a/b)

$\text{ans2} = \frac{1}{1 + \left(\frac{1}{c}-1\right)\frac{a }{b}}$

Running Simplify[ans2] gives ans1. Is there a systematic way to obtain ans2 from ans1?

In numerical analysis, expressions like ans2 are called "single use expressions". They also show up in interval arithmetic.

I'm particularly interested in a method that could work for other expressions besides the given example, although I'm not sure it's possible to isolate each variable in general, e.g. a/(a+b).

Edit: @bbgodfrey has pointed out that a/(a+b) can be transformed into a single-use expression.

Edit: in numerical analysis, these are called "single use expressions".

It is known that this problem is easy to solve when we have a Single Use Expression, i.e., an expression in which each variable $x_i$ occurs only once.

https://doi.org/10.1109/NAFIPS.2011.5752032

In a linear expression $f = a_0 + a_1 \cdot \Delta x_1 + \ldots + a_n \cdot \Delta x_n$, each variable $\Delta x i \in [-\Delta_i , \Delta_i ]$ occurs only once. It is known that for such single-use expressions (SUE), straightforward interval computations leads to the exact range;

https://doi.org/10.1007/11558958_9

In general, it can be shown that the exact range of values can be achieved, if each variable appears only once and if $f$ is continuous inside the box. However, not every function can be rewritten this way.

https://en.wikipedia.org/wiki/Interval_arithmetic

• The goal is in general not achievable, so one would have to clearly narrow down the cases to which the simplification will be applied. One could come up with something that works for this case, but then it may not work for others. There are some methods that can achieve special forms not obtainable by Simplify. For example, HornerForm. But this particular goal is not a standard normal form, so you'd have to fiddle with replacement rules that break easily. – Jens Mar 21 '15 at 4:22
• By the way, these are called "single use expressions" in numerical analysis. – Nathaniel M. Beaver May 29 '15 at 0:30
• For example, interval arithmetic: en.wikipedia.org/wiki/Interval_arithmetic – Nathaniel M. Beaver May 29 '15 at 0:37
• Dear @bariumbitmap - may I suggest that you edit your question rather than post comments if you have additional information? – Verbeia Oct 14 '15 at 5:49
• @Verbeia Thanks, I've done so. – Nathaniel M. Beaver May 18 '18 at 16:59

The following approach transforms ans1 to ans2 and points the way to more general approaches.

As noted in the Question, Simplify returns ans1 unchanged. Introducing a ComplexityFunction that defines fewer symbols as less complex helps some.

cf[e_] := LeafCount[e] + 100 Count[e, _Symbol, Infinity]
Simplify[ans1, ComplexityFunction -> cf]
(* (b*c)/(-(a*(-1 + c)) + b*c) *)

Noting that Simplify does not try such substitutions as (c-1)/c -> 1-1/c, we introduce TransformationFunctions

tf1[e_] := e /. (z_ + zz_)/z_ :> 1 + zz/z
tf2[e_] := e /. z_/(z_ + zz_) :> 1/(1 + zz/z)
Simplify[ans1, ComplexityFunction -> cf,
TransformationFunctions -> {Automatic, tf1, tf2}]
(* (1 - (a*(1 - c^(-1)))/b)^(-1) *)

which is ans2, as desired.

This approach also works for a/(a+b), mentioned at the end of the Question.

Simplify[a/(a + b), ComplexityFunction -> cf,
TransformationFunctions -> {Automatic, tf1, tf2}]
(* (1 + b/a)^(-1) *)

It is not difficult to imagine other expressions for which the specific TransformationFunctions used here are not sufficient. However, it seems likely that introducing additional TransformationFunctions might well transform a wide range of expressions.