Mathematica Problem with simplification in Mathematica

  • Thread starter Thread starter physics_nil
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion centers on the issue of Mathematica's FullSimplify function not simplifying the expression a + Sqrt[b + c] - Sqrt[a^2 + b + c + 2 a Sqrt[b + c]] to zero, despite assumptions that a, b, and c are positive. The reason provided is that the simplification process retains all possible outcomes, including cases where Sqrt can yield both positive and negative results. Users suggest explicitly guiding Mathematica to use the positive square root or squaring both sides to eliminate ambiguity. The conversation highlights the limitations of computer algebra systems in handling assumptions and the need for precise instructions to achieve desired simplifications. Overall, the thread emphasizes the importance of understanding how Mathematica interprets mathematical expressions under given assumptions.
physics_nil
Messages
4
Reaction score
0
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 anyone please resolve this puzzle...Thanks
 
Physics news on Phys.org
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.
 
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!
 
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.
 
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
 
@phyzguy
Then why Assuming[x>0,Sqrt[x^2] //Simplify] is x? I think mathematica only considers positive sqrt.
 
@Simon_Tyler
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?
 

Similar threads

Replies
1
Views
1K
Replies
19
Views
2K
Replies
2
Views
2K
Replies
1
Views
2K
Replies
4
Views
3K
Replies
5
Views
3K
Replies
4
Views
2K
Replies
2
Views
2K
Back
Top