Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two expressions:

expr = (a - R)^2 (a + 2 R)/(2 R^3);
factor = 1 - a^2/R^2;

I would like to write expr in terms of factor -- is there a function in Mathematica to help with this?

share|improve this question
up vote 4 down vote accepted

Rewrite your definitions as equations (i.e. using ==), then use Solve to solve for expr specifying that the R and a variables should be eliminated:

Clear[expr, factor]

  {expr == (a - R)^2 (a + 2 R)/(2 R^3), factor == 1 - a^2/R^2},
  {R, a}

Mathematica graphics

share|improve this answer

Using Eliminate

Eliminate[{expr == e, factor == f}, {a, R}]
3 f^2 + f^3 == (8 - 4 e) e
share|improve this answer
Alternatively: GroebnerBasis[{expr == (a - R)^2 (a + 2 R)/(2 R^3), factor == 1 - a^2/R^2}, {expr, factor}, {a, R}]. – J. M. Feb 25 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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