# Simplify square root term by taking variable inside root

I want to simplify expression $\frac{\sqrt{1+b+b^2}}{b}$ to$\sqrt{1+\frac{1}{b^2}+\frac{1}{b}}$.

How to achieve this?

• How is your target expression computationally simpler than your source expression? It may look prettier to you eyes, but it not simpler by Mathematica's concept of expression simplicity. If you are looking for a way to pretty print your expression in discourse, then you are really asking about working with HoldForm expressions and not about simplification. – m_goldberg Oct 7 '15 at 4:46
• Simply speaking, if you are performing calculations keep in mind that your simpfied version is more expensive. It as one additional division than the starting expression. – Edmund Oct 7 '15 at 11:03

Try this:

expr = Sqrt[1 + b + b^2]/b;
(expr /. 1/b*Sqrt[a_] -> Sqrt[a/b^2]) // Simplify

(*   Sqrt[1 + 1/b^2 + 1/b]   *)

Have fun!

You can bruteforce it for this kind of fraction where the numerator has a square root.

exp = Sqrt[1 + b^2 + b]/b

Write a function that takes the denominator squared inside the square root

f[frac_] := Module[{num, den},
num = Numerator[frac][[1]];
den = Denominator[frac];
Sqrt[FullSimplify[(1/den^2)*num]]
]

Pass your expression to the function to check

f[exp]

(*Sqrt[1 + 1/b^2 + 1/b]*)