Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problem with simplification in Mathematica!

  1. Jul 19, 2010 #1
    Assuming[a>0 && b>0 && c>0, FullSimplify[a+Sqrt[b+c]-Sqrt[a^2+b+c+2 a Sqrt[b+c]]]] does not simplify it to zero. Although output of FullSimplify[a+Sqrt[b+c]-Sqrt[a^2+b+c+2 a Sqrt[b+c]]==0] is true, even without any assumptions. Can any one please resolve this puzzle.....Thanks
  2. jcsd
  3. Jul 19, 2010 #2


    User Avatar
    Science Advisor

    The reason it doesn't simplify to zero is that this would throw away one possibility. Basically you are asking it to simplify (x-Sqrt(x^2)). Since Sqrt(x^2) can be either x or -x, (x-Sqrt(x^2)) can be either 0 or 2x. By simplifying this to zero, you are throwing away the second possibility. Mathematica will keep all possibilities unless you explicitly tell it otherwise.
  4. Jul 19, 2010 #3
    Your statement is not true as i have specified a>0,b>0,c>0
    If you ask mathematica to simplify x-Sqrt[x^2] with assumption x>0, it indeed gives zero!
  5. Jul 19, 2010 #4


    User Avatar
    Science Advisor

    I used the simplified example with x to illustrate the problem. In your problem, just because a,b,c>0 doesn't mean that Sqrt[b+c]>0, or that Sqrt[a^2+b+c+2 a Sqrt[b+c]]>0. Even if you tell it that both of these are >0, that still isn't enough. You have to either explicitly tell it to use the positive square root, like this:

    FullSimplify[ a + Sqrt[b + c] - Sqrt[a^2 + b + c + 2 a Sqrt[b + c]] /.
    Sqrt[a^2 + b + c + 2 a Sqrt[b + c]] -> a + Sqrt[b + c]]

    or else square both terms to eliminate the sign ambiguity, like this:

    FullSimplify[(a + Sqrt[b + c])^2 - (Sqrt[
    a^2 + b + c + 2 a Sqrt[b + c]])^2, {a > 0, b > 0, c > 0}]

    It's only a computer program, after all, so it does have its limitations.
  6. Jul 19, 2010 #5
    If you're only interested a, b and c being real, then you could use something like:

    In[1]:= Reduce[a+Sqrt[b+c]-Sqrt[a^2+b+c+2 a Sqrt[b+c]]==0,{a,b,c},Reals]
    Out[1]= (a<=0&&c>=a^2-b)||(a>0&&c>=-b)

    In[2]:= Simplify[%,a>0&&b>0&&c>0]
    Out[2]= True
  7. Jul 21, 2010 #6
    Then why Assuming[x>0,Sqrt[x^2] //Simplify] is x? I think mathematica only considers positive sqrt.
  8. Jul 21, 2010 #7
    The step comes in a intermediate step of a long program. Unless the answer in simplification is zero, the final answer is too complicated to read. Any suggestion?
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Problem simplification Mathematica Date
Does anyone had this plotting problem with MATLAB? Dec 23, 2017
Mathematica Solve Perturbation problem with mathematica Dec 7, 2017
Mathematica For looping problem not getting answer May 24, 2017
Matlab map representation problems Feb 11, 2017
Mathematica help - simplification Jun 17, 2011