I am dealing with the situation where despite of specifying my variables b1 and c to be greater than zero, Mathematica still returns the output with Re[b1+c]

x = a - (b1 + c)/2 I

 {a >= 0, b1 >= 0, c >= 0}
(* -(1/2) Re[b1 + c] *)
  • $\begingroup$ Next time please take the time to contsruct a minimal example and use readable formatting in your post. See my edit for reference. $\endgroup$
    – Szabolcs
    Jun 18, 2021 at 9:13

2 Answers 2


mat1 = Simplify[({{a - (b1 + c)/2 I, d}, {d, a - (b2 - c)/2 I}})];

mat2 = ({{0, 0, 1, 0}, {0, 0, 0, 1}, {-1, 0, 0, 0}, {0, -1, 0, 0}});

The primary tool for simplifying complex expressions is ComplexExpand

      Re[mat1[[1]][[2]]], -Im[mat1[[1]][[1]]], -Im[mat1[[1]][[2]]]}, {Re[
      Re[mat1[[2]][[2]]], -Im[mat1[[2]][[1]]], -Im[mat1[[2]][[2]]]}, {Im[
       mat1[[1]][[1]]], Im[mat1[[1]][[2]]], Re[mat1[[1]][[1]]], 
      Re[mat1[[1]][[2]]]}, {Im[mat1[[2]][[1]]], Im[mat1[[2]][[2]]], 
      Re[mat1[[2]][[1]]], Re[mat1[[2]][[2]]]}})]]

enter image description here

This result shows that you need only require that the variables are real rather than the more restrictive nonnegative.

  • $\begingroup$ I think it's worth noting that while Simplify and Refine are "safe", in that they shouldn't make invalid assumptions, ComplexExpand assumes that variables are real, unless told otherwise. I treat ComplexExpand (and PowerExpand) as unsafe, that is every use needs careful examination to ensure that their assumptions are met. $\endgroup$
    – mikado
    Jun 17, 2021 at 22:20

I don't know really know why FullSimplify doesn't work, but Refine does

Assuming[{a >= 0, d >= 0, b1 >= 0, b2 >= 0, c >= 0}, 
     Re[mat1[[1]][[2]]], -Im[mat1[[1]][[1]]], -Im[
       mat1[[1]][[2]]]}, {Re[mat1[[2]][[1]]], 
     Re[mat1[[2]][[2]]], -Im[mat1[[2]][[1]]], -Im[
       mat1[[2]][[2]]]}, {Im[mat1[[1]][[1]]], Im[mat1[[1]][[2]]], 
     Re[mat1[[1]][[1]]], Re[mat1[[1]][[2]]]}, {Im[mat1[[2]][[1]]], 
     Im[mat1[[2]][[2]]], Re[mat1[[2]][[1]]], Re[mat1[[2]][[2]]]}})]]
(* {{a, d, (b1 + c)/2, 0}, {d, a, 0, (b2 - c)/2}, {1/2 (-b1 - c),
   0, a, d}, {0, 1/2 (-b2 + c), d, a}} *)

Occasionally, a more specific simplification, such as Refine finds what you want when the more general one, FullSimplify, does not. Presumably FullSimplify tries a lot of other things before it gives up.


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.