I have complicated function g[s1,s2,Ss,t1,t2,m] with the numerator containing only the summands with the square root factor. Its main part coincides with the full square root of the denominator of g. However, they doesn't cancel each other, within Mathematica. Precise form of these factors are

Sqrt[(-s2 + Ss + t1) (m^2 - s2 + t1 - t2) (m^2 t1 - s2 t2)]

in the numerator,

Sqrt[(m^4 t1 - m^2 (s2 (t1 + t2) + t1 (t2 - t1)) + s2 t2 (s2 - t1 + t2))]

in the denominator. They must cancel each other up to the multiplier in the numerator. But this doesn't happen. The command Simplify[g[...]] doesn't work. The command FullSimplify doesnt work also.

How to make Mathematica cancel these square roots?


You can try FullSimplify[expr, TransformationFunctions->{Automatic, PowerExpand}]. First your expression:

expr = Sqrt[(-s2+Ss+t1) (m^2-s2+t1-t2) (m^2 t1-s2 t2)] /
       Sqrt[(m^4 t1-m^2 (s2 (t1+t2)+t1 (t2-t1))+s2 t2 (s2-t1+t2))];

Then, FullSimplify:


I Sqrt[s2 - Ss - t1]

However, note the following comment from the documentation:

The transformations made by PowerExpand are correct in general only if c is an integer or a and b are positive real numbers.

  • $\begingroup$ Unfortunately, it doesn't work for me... It only separates the multipliers inside the root. $\endgroup$ – John Taylor Jul 26 '17 at 19:16
  • $\begingroup$ @JohnTaylor Then you should provide an example where it doesn't work. $\endgroup$ – Carl Woll Jul 26 '17 at 19:54
  • $\begingroup$ @Carl Woll Could you please kindly comment, why in this case FullSimplify works, while Simplify does not? $\endgroup$ – Alexei Boulbitch Jul 27 '17 at 7:18

Try also the following. Here is your expression:

 expr = Sqrt[(-s2 + Ss + t1) (m^2 - s2 + t1 - t2) (m^2 t1 - s2 t2)]/
 Sqrt[(m^4 t1 - m^2 (s2 (t1 + t2) + t1 (t2 - t1)) + 
    s2 t2 (s2 - t1 + t2))];

Let us put the both expressions under the same radical:

    expr /. Sqrt[a_]/Sqrt[b_] -> Sqrt[a/b] // Simplify
(*  Sqrt[-s2 + Ss + t1]   *)

Have fun!


Mathematica treats all values by default as complex. If this is the case, you cannot cancel numerator and denominator. If square roots are real, you have to tell this to Mathematica, for example like this

$Assumptions=(-s2+Ss+t1)(m^2-s2+t1-t2)(m^2 t1-s2 t2)>0&&
(m^4 t1-m^2 (s2 (t1+t2)+t1 (t2-t1))+s2 t2 (s2-t1+t2))>0;
expr = Sqrt[(-s2+Ss+t1) (m^2-s2+t1-t2) (m^2 t1-s2 t2)] /
Sqrt[(m^4 t1-m^2 (s2 (t1+t2)+t1 (t2-t1))+s2 t2 (s2-t1+t2))];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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