In Mathematica 11, if I define

Subscript[z, 1] = a + I b;
Subscript[z, 2] = c + I d; 

and compute

Subscript[z, 1] Subscript[z, 2] // ComplexExpand 

I obtain in the TraditionalForm

I (a d + b c) + a c - b d

Is it possible to obtain instead

a c - b d + I (a d + b c)

written in this order?

  • 3
    $\begingroup$ Can you specify the output referring to "usual (Re + I Im)"? And what do you mean by "function notation"? I see no function in I (a d+b c)+a c-b d $\endgroup$
    – vapor
    Mar 21, 2017 at 11:45
  • $\begingroup$ I'd like to obtain ac-bd+I(ad+bc) $\endgroup$ Mar 21, 2017 at 12:13
  • 1
    $\begingroup$ Is that not exactly what you get? In it current state, this question is at risk of being closed as unclear. Please edit the question, show what you get (precisely), show what you want instead, and point out the difference in a description. $\endgroup$
    – Szabolcs
    Mar 21, 2017 at 12:18
  • $\begingroup$ I obtain I (ad + bc) + ac-bd instead of ac-bd+I(ad+bc) $\endgroup$ Mar 21, 2017 at 12:42
  • 1
    $\begingroup$ @Kagaratsch Next time please just flag the post if you have an answer for a closed question. I reopened the question. You should now post your answer as an answer. $\endgroup$
    – Mr.Wizard
    Mar 21, 2017 at 17:09

2 Answers 2


The quick solution is

Re[Subscript[z, 1] Subscript[z, 2]] + I Im[Subscript[z, 1] Subscript[z, 2]] // ComplexExpand

a c - b d + I (b c + a d)


It seems that you are concerned with just the order in which Mathematica prints the terms in the output. You should know that Mathematica uses lexicographical order by default. It is however not completely clear what weight the imaginary unit I is assigned. Still, the easiest thing is to try different naming conventions and see if the desired result is produced. If we define, i.e.:

Subscript[z, 1] = zr[1] + I zi[1];
Subscript[z, 2] = zr[2] + I zi[2];

then my Mathematica 11.1 returns

Subscript[z, 1] Subscript[z, 2] // ComplexExpand

-zi[1] zi[2] + zr[1] zr[2] + I (zi[2] zr[1] + zi[1] zr[2])

which puts the real part before the imaginary part. If I understood your question correctly, this is what you want. If you would prefer different ordering within the real part and imaginary part too, you can play around with other variable naming conventions, until it looks the way you like it.


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.