Consider the following minimal example of my problem:

eq = (a^2 + a == b^2)

I would like to manipulate this equation to achieve:

a == b^2 - a^2

First, note the obvious point that solving for a in this context is not appropriate as

Solve[eq, a]

solves the quadratic equation, which is not my goal.

Alternatively, there are rather straightforward ways by which one can rearrange this equation by hand, for example:

AddSides[eq, -a^2]

But that requires "human insight" and is awkward indeed for my full problem (where there are many terms on both sides of the equation).

For obvious and analogous reasons, Gather does not solve this problem either.

One can go in by hand and identify the desired term and manipulate the equation, basically by hand but that is of little help.

My presenting case is an enormous reduced equation in many variables that contains (say) a single a amidst many terms on the left. I'm seeking the simplest way to compute an equation of the form a == ......... which may (indeed does) contain nonlinear terms involving a on the right. I'm seeking the re-arranged equation so I can perform additional manipulations (with other equations and such).


  • $\begingroup$ Is each side of the equation a sum of "terms," and is a one of the "terms"? More than one of the "terms"? I can assume the term to be solved for is known ahead of time, which requires some sort of insight, human or otherwise, right? $\endgroup$
    – Michael E2
    Commented Aug 22, 2021 at 1:16
  • $\begingroup$ eq2 = SubtractSides[eq, a^2] $\endgroup$
    – Bob Hanlon
    Commented Aug 22, 2021 at 2:39
  • $\begingroup$ @BobHanlon: Your answer is precisely what I said I wanted to avoid. $\endgroup$ Commented Aug 22, 2021 at 3:46

1 Answer 1


Under the assumption that the answers to the questions in my comment are all affirmative:

 Equal @@ Solve[Replace[eq, a -> Hold[a], {2}], Hold[a]][[1, 1]], 1]
(*  a == -a^2 + b^2  *)
  • $\begingroup$ Yep. Nice... this works on my larger problem ($\checkmark$). I do think it would be nice if Mathematica introduced a function which I would call TermIsolate, where in this case TermIsolate[eq, a] would give your answer. $\endgroup$ Commented Aug 22, 2021 at 1:51
  • $\begingroup$ So I wrote my own: termIsolate[eq_, term_] := MapAt[ReleaseHold, Equal @@ Solve[Replace[eq, term -> Hold[term], {2}], Hold[term]][[1,1]], 1]. This will be very useful. Thanks again. $\endgroup$ Commented Aug 22, 2021 at 2:08

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.