# How to group the powers of one variable?

Consider the following expression:

$\sqrt{a x} \sqrt{b x}$

What do I use to make it simplify to:

$\sqrt{ab} x$

I tried actually everything (Simplify, FullSimplify, Collect and so on...) and such expressions remain unchanged.

Misery

-

You can try PowerExpand`

Sqrt[a x] Sqrt[b x] // PowerExpand
Sqrt[a] Sqrt[b] x
-
This is equivalent to assuming a and b being reals. According to the documentation, PowerExpand always assumes real numbers and integer exponents. –  Markus Roellig Aug 17 '12 at 12:32
Thanks a lot for all answers. This is one that fits my needs the most. –  Misery Aug 17 '12 at 18:52

I am answering this up to the letter: (1) combining powers of x, (2) grouping a and b under the same square root.

Simplify[Sqrt[a x] Sqrt[b x], Assumptions -> {a > 0, b > 0}]

Sqrt[a b] x

FullSimplify[Sqrt[a x] Sqrt[b x], Assumptions -> {a > 0, b > 0}]

Sqrt[a b] x

Refine[Sqrt[a x ] Sqrt[b x ], Assumptions -> {a > 0, b > 0}]

Sqrt[a b] x

Refine[Sqrt[a x ] Sqrt[b x ], a > 0 && b > 0]

Sqrt[a b] x

-
It seems that when using Simplify and FullSimplify, we can get the result with setting any 2 of the 3 variables as a nonnegative number, for example, {x >= 0, b > 0} is also available, but I don't know the exact reason… –  xzczd Aug 17 '12 at 7:54
@xzczd My guess is, in your case, a is left alone and b brought under Sqrt[a] as positive number. –  Vitaliy Kaurov Aug 17 '12 at 8:00
Just now, I accidentally found that if b is a certain positive number, Simplify , FullSimplify and Refine won't work 囧: b = 2; Simplify[Sqrt[a x] Sqrt[b x], x > 0 && a > 0], the result is: Sqrt[2] Sqrt[a] x –  xzczd Aug 17 '12 at 8:13
@xzczd: That's because Mathematica pulls the factor out during normal evaluation: Sqrt[2 a] evaluates to Sqrt[2] Sqrt[a]. Thus even if Simplify should combine them, you'll never see that because subsequent evaluation will undo it. –  celtschk Aug 17 '12 at 10:44
@celtschk then, what if I want to get Sqrt[2 a] x? –  xzczd Aug 17 '12 at 11:39