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.


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;


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.


  • 5
    $\begingroup$ 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. $\endgroup$
    – Jens
    Mar 21, 2015 at 4:22
  • $\begingroup$ By the way, these are called "single use expressions" in numerical analysis. $\endgroup$ May 29, 2015 at 0:30
  • $\begingroup$ For example, interval arithmetic: en.wikipedia.org/wiki/Interval_arithmetic $\endgroup$ May 29, 2015 at 0:37
  • $\begingroup$ Dear @bariumbitmap - may I suggest that you edit your question rather than post comments if you have additional information? $\endgroup$
    – Verbeia
    Oct 14, 2015 at 5:49
  • 1
    $\begingroup$ @Verbeia Thanks, I've done so. $\endgroup$ May 18, 2018 at 16:59

1 Answer 1


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.


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.