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:


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$

  • 1
    $\begingroup$ 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. $\endgroup$
    – Kagaratsch
    Oct 13, 2016 at 21:49
  • $\begingroup$ I edited the message, let me know if I can improve my answer in any way. $\endgroup$
    – damides
    Oct 13, 2016 at 22:31
  • $\begingroup$ 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. $\endgroup$
    – bill s
    Oct 13, 2016 at 22:35
  • $\begingroup$ @bills I forgot to add that $w_1,w_2,x >0$ $\endgroup$
    – damides
    Oct 13, 2016 at 22:39
  • $\begingroup$ 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. $\endgroup$
    – QuantumDot
    Oct 13, 2016 at 23:34

1 Answer 1


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]
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.



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.