# How to contract the square roots in the numerator and the denominator of the given function?

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:

FullSimplify[
expr,
TransformationFunctions->{Automatic,PowerExpand}
]


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.

• Unfortunately, it doesn't work for me... It only separates the multipliers inside the root. – John Taylor Jul 26 '17 at 19:16
• @JohnTaylor Then you should provide an example where it doesn't work. – Carl Woll Jul 26 '17 at 19:54
• @Carl Woll Could you please kindly comment, why in this case FullSimplify works, while Simplify does not? – 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))];
FullSimplify[expr]