ComplexExpand[expr]
expands expr assuming that all variables are real.
ComplexExpand[expr,{x1,x2,…}]
expands expr assuming that variables matching any of the xi are complex.
ComplexExpand
ComplexExpand[expr]
expands expr assuming that all variables are real.
ComplexExpand[expr,{x1,x2,…}]
expands expr assuming that variables matching any of the xi are complex.
Details and Options
- The variables given in the second argument of ComplexExpand can be patterns.
- The option TargetFunctions can be given as a list of functions from the set {Re,Im,Abs,Arg,Conjugate,Sign}. ComplexExpand will try to give results in terms of functions specified.
- ComplexExpand automatically threads over lists in expr, as well as equations, inequalities and logic functions.
Examples
open all close allBasic Examples (4)
Expand symbolic expressions into real and imaginary parts:
ComplexExpand[3 ^ (I x)]Assume that both
and
are real:
ComplexExpand[Sin[x + I y]]ComplexExpand[Sin[x], x]Extract the real and imaginary parts of an expression:
ComplexExpand[ReIm[Cos[I ^ x]]]Scope (7)
ComplexExpand[Re[z ^ 5 - 2z ^ 3 - z + 1], z]Trigonometric and hyperbolic functions:
ComplexExpand[Cos[x + I y] + Tanh[z], {z}]Inverse trigonometric and inverse hyperbolic functions:
ComplexExpand[Re[ArcCot[x + I y]] + Im[ArcSinh[x - I y]]]Exponential and logarithmic functions:
ComplexExpand[Abs[2 ^ z Log[2z]], z]ComplexExpand[Re[Log[Sin[Exp[x + I y] ^ 2]]]]Specify that a variable is taken to be complex:
ComplexExpand[Re[2z ^ 3 - z + 1], z]ComplexExpand[Re[Sin[z]], z, TargetFunctions -> Conjugate]Options (1)
TargetFunctions (1)
This gives an answer in terms of Re[z] and Im[z]:
ComplexExpand[Re[Tan[z]], z]With TargetFunctions->{Abs, Arg}, the answer is given in terms of Abs[z] and Arg[z]:
ComplexExpand[Re[Tan[z]], z, TargetFunctions -> {Abs, Arg}]Use Conjugate as the target function:
ComplexExpand[Re[Tan[z]], z, TargetFunctions -> Conjugate]Applications (2)
This expands the expression, assuming that
and
are both real:
ComplexExpand[Tan[x + I y]]In this case,
is assumed to be real, but
is assumed to be complex, and is broken into explicit real and imaginary parts:
ComplexExpand[a + x ^ 2, {x}]With several complex variables, you quickly get quite complicated results:
ComplexExpand[Sin[x] Exp[y], {x, y}]Verify common complex identities:
ComplexExpand[Re[z] == (z + Conjugate[z]) / 2, z]ComplexExpand[Exp[I z] == Cos[z] + I Sin[z]]Properties & Relations (1)
This computes Re[Sin[x+I y]] assuming that x and y are real:
ComplexExpand[Re[Sin[x + I y]]]The same computation can be done using TrigExpand and Refine:
TrigExpand[Sin[x + I y]]Refine[Re[%], Element[x | y, Reals]]See Also
GaussianIntegers TrigToExp ExpToTrig TrigExpand FunctionExpand PowerExpand Abs ReIm
Function Repository: ComplexToPolar
History
Introduced in 1991 (2.0) | Updated in 2007 (6.0)
Text
Wolfram Research (1991), ComplexExpand, Wolfram Language function, https://reference.wolfram.com/language/ref/ComplexExpand.html (updated 2007).
CMS
Wolfram Language. 1991. "ComplexExpand." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/ComplexExpand.html.
APA
Wolfram Language. (1991). ComplexExpand. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ComplexExpand.html
BibTeX
@misc{reference.wolfram_2026_complexexpand, author="Wolfram Research", title="{ComplexExpand}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/ComplexExpand.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_complexexpand, organization={Wolfram Research}, title={ComplexExpand}, year={2007}, url={https://reference.wolfram.com/language/ref/ComplexExpand.html}, note=[Accessed: 13-June-2026]}