To me, the expression Sqrt[2]Sqrt[x] is more complex than Sqrt[2x]. But even if I merely input the latter, I get the former as output. I'd like to simplify expressions where such square roots could get additional terms inside, so Inactivate or Defer don't really help. See e.g. this:

FullSimplify[Sqrt[2 x] Sqrt[y], x > 0 && y > 0]

This gives me Sqrt[2] Sqrt[x y] as a result, while I'd prefer Sqrt[2 x y]. Even if I specify complexity function like the following, it still doesn't help:

FullSimplify[Sqrt[2 x] Sqrt[y], x > 0 && y > 0, 
 ComplexityFunction -> (Times@@ImageDimensions@Rasterize[#] &)]

And this is despite these results:

Times@@ImageDimensions@Rasterize[Sqrt[2 x]]
Times@@ImageDimensions@Rasterize[HoldForm[Sqrt[2 x]]]



I've looked at SystemOptions["SimplificationOptions"], but haven't found anything related to this type of simplification. Is there any way to prevent such splitting of constants from the radical?


1 Answer 1


Even when a simplification would have returned Sqrt[2 x y], Mathematica would have further evaluated this to Sqrt[2] Sqrt[x y]. So simplification will not help you. What we can do is to print the result in the form you want to see it:

MakeBoxes[Times[z:(Power[_, Rational[1,2]]..)], StandardForm] := 
  RowBox[{SqrtBox[ToBoxes[ Times @@ {z}[[All,1]]]]}]

Sqrt[2 x] Sqrt[y]

(* Sqrt[2 x y] *)

But be careful: the output now looks like being a square root of a product. However, it still is the product of some square roots:


(* Times[Power[2,Rational[1,2]],Power[x,Rational[1,2]],Power[y,Rational[1,2]]] *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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