expands expr assuming that all variables are real.


expands expr assuming that variables matching any of the xi are complex.

Details and Options


open allclose all

Basic Examples  (4)

Expand symbolic expressions into real and imaginary parts:

Assume that both and are real:

Take to be complex:

Extract the real and imaginary parts of an expression:

Scope  (7)


Trigonometric and hyperbolic functions:

Inverse trigonometric and inverse hyperbolic functions:

Exponential and logarithmic functions:

Composition of functions:

Specify that a variable is taken to be complex:

Specify target functions:

Options  (1)

TargetFunctions  (1)

This gives an answer in terms of Re[z] and Im[z]:

With TargetFunctions->{Abs, Arg}, the answer is given in terms of Abs[z] and Arg[z]:

Use Conjugate as the target function:

Applications  (2)

This expands the expression, assuming that and are both real:

In this case, is assumed to be real, but is assumed to be complex, and is broken into explicit real and imaginary parts:

With several complex variables, you quickly get quite complicated results:

Verify common complex identities:

Properties & Relations  (1)

This computes Re[Sin[x+I y]] assuming that x and y are real:

The same computation can be done using TrigExpand and Refine:

Wolfram Research (1991), ComplexExpand, Wolfram Language function, (updated 2007).


Wolfram Research (1991), ComplexExpand, Wolfram Language function, (updated 2007).


Wolfram Language. 1991. "ComplexExpand." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007.


Wolfram Language. (1991). ComplexExpand. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_complexexpand, author="Wolfram Research", title="{ComplexExpand}", year="2007", howpublished="\url{}", note=[Accessed: 16-June-2024 ]}


@online{reference.wolfram_2024_complexexpand, organization={Wolfram Research}, title={ComplexExpand}, year={2007}, url={}, note=[Accessed: 16-June-2024 ]}