# Symbolic product of two complex numbers

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 (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?

• 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 Mar 21 '17 at 11:45
• I'd like to obtain ac-bd+I(ad+bc) Mar 21 '17 at 12:13
• 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. Mar 21 '17 at 12:18
• I obtain I (ad + bc) + ac-bd instead of ac-bd+I(ad+bc) Mar 21 '17 at 12:42
• @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. Mar 21 '17 at 17:09

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.