My Mathematica notebook is not simplifying some expressions which do look trivial. I mean that one of my outputs contains:

Sqrt[Im[z1]^2 - 2 Im[z1] Im[z2] + Im[z2]^2 + (Re[z1] - Re[z2])^2]

which is nothing but


I guess it does not simpligy because of the non analyticity of Re or Im or the ambiguity in Sqrt on the complex plane but is there a way to force Mathematica do do such replacements? That would help me a lot as it appears in many places.


1 Answer 1


Try this:

Sqrt[Im[z1]^2 - 2 Im[z1] Im[z2] + Im[z2]^2 + (Re[z1] - Re[z2])^2] // 
  ComplexExpand // Simplify

(*  ((z1 - z2)^4)^(1/4)   *)

Have fun!

  • $\begingroup$ Thanks for the input, indeed I had already met that ComplexExpand function. $\endgroup$ May 3, 2016 at 15:01
  • $\begingroup$ @Learning is a mess Of course, this is the first choice, when doing with complex numbers. $\endgroup$ May 3, 2016 at 15:09

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.