# Cancel common term fraction with radical

I was working with the following expression:

$$\frac{w_1 x}{\sqrt{\left(x^2-w_1 w_2\right){}^2+\left(2 w_1 x+w_2 x\right){}^2}}$$

(x Subscript[w, 1])/Sqrt[(2 x Subscript[w, 1] + x Subscript[w, 2])^2 + (x^2 - Subscript[w, 1] Subscript[w, 2])^2]

And I would like to simplify it to:

$$\frac{1}{\sqrt{\left(\frac{x}{w_1}-\frac{w_2}{x}\right){}^2+\left(\frac{w_2}{w_1}+2\right){}^2}}$$

1/Sqrt[(x/Subscript[w, 1] - Subscript[w, 2]/x)^2 + (2 + Subscript[w, 2]/Subscript[w, 1])^2]

Which, from what I was able to see, has a lower leafcount.

NOTE: $w_1,w_2,x>0$

• Please give your expressions in Mathematica input notation, so that it would be easier for others to copy and paste them and play around with them directly. – Kagaratsch Oct 13 '16 at 21:49
• I edited the message, let me know if I can improve my answer in any way. – damides Oct 13 '16 at 22:31
• You're going to have a hard time simplifying since the two expressions are not equal. Consider the case '{Subscript[w, 1] -> 10, Subscript[w, 2] -> -2.2, x -> -3.3}', the difference between the two is 0.980375. – bill s Oct 13 '16 at 22:35
• @bills I forgot to add that $w_1,w_2,x >0$ – damides Oct 13 '16 at 22:39
• I seem to have the feeling that Mathematica's simplifiers prefer not to have a fractions inside of a fraction if it can avoid it. – QuantumDot Oct 13 '16 at 23:34

This is no elegant solution, and probably not what you were hoping for, but it does end up with the desired expression. The idea is to pick the expression apart, then rebuild it. First I used FullForm to see what we are dealing with, then evaluated this sequence of commands

y = (x Subscript[w, 1])/
Sqrt[(2 x Subscript[w, 1] + x Subscript[w, 2])^2 + (x^2 -
Subscript[w, 1] Subscript[w, 2])^2]
y/FullForm;
num = y[[1]] y[[2]];
den2 = y[[3]]^-2;
p1 = den2[[1]]^(1/2) // PowerExpand;
p2 = den2[[2]]^(1/2) // PowerExpand;
q1 = p1/num // Apart;
q2 = p2/num // Apart;
z = (q1^2 + q2^2)^(-1/2)

MMA 10.4 displayed exactly the expression you asked for.

$$\frac{1}{\sqrt{\left(\frac{x}{w_1}-\frac{w_2}{x}\right){}^2+\left(\frac{w_2}{w_1}+2\right){}^2}}$$