Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Manipulating square roots

  • To: mathgroup at
  • Subject: [mg112377] Re: Manipulating square roots
  • From: "David Park" <djmpark at>
  • Date: Sat, 11 Sep 2010 05:45:39 -0400 (EDT)

The Presentations package has a routine FactorOut that is useful here. The
trick is to pull a "factor" out of an expression and then protect the result
so that Mathematica won't simplify it back.

FactorOut[factor, quotientfunction : Indentity, factorfunction :
Identity][expr] will pull factor out of expression and write the result as
factorfunction[factor] quotentfunction[Expand[expr/factor]].Factor would not
even have to be in expr. The functions, if not Identity, would most commonly
be HoldForm.

Here we go back and forth between the two forms.


expr = Sqrt[a^2 - b^2]; 

step1 = MapAt[FactorOut[a^2, HoldForm], expr, 1] 

step2 = Simplify[step1, a > 0] // ReleaseHold 


Sqrt[a^2 (1-b^2/a^2)]

a Sqrt[1 - b^2/a^2]

step3 = MapAt[FactorOut[1/a^2, HoldForm], step2, {2, 1}]

step4 = Simplify[step3, a > 0] // ReleaseHold


a Sqrt[(a^2-b^2)/a^2]

Sqrt[a^2 - b^2]

This has the advantage of doing it by calculation, but a simple rule as you
wrote might be simpler. It depends on the context in which you are doing the

David Park
djmpark at  

From: alan [mailto:alansbarnett at] 

How can I get mathematica to bring a factor inside a square root?  For
a Sqrt(1-(b/a)^2)  -> Sqrt(a^2-b^2)  (if a is real and a > 0).
Also, how do I get Mathematica to perform the operation in reverse?

  • Prev by Date: Re: drawing polygon diagonals
  • Next by Date: Re: String-to-Number Conversion Precision
  • Previous by thread: Re: Manipulating square roots
  • Next by thread: Finding an exponent?