# Simplifying complex expression with Mathematica

I want do get the imaginary part of

Exp[I*t]/(1-Exp[I*t])


I've tried to do this

Im[ComplexExpand[Exp[I*t]/(1-Exp[I*t])]]


but the result still contains

Im[Cos[t]/((1 - Cos[t])^2 + Sin[t]^2) -
Cos[t]^2/((1 - Cos[t])^2 + Sin[t]^2) -
Sin[t]^2/((1 - Cos[t])^2 + Sin[t]^2)]


which in fact is 0 (t is a real variable). How can I convince Mathematica to get rid of this part of the expression?

• While I don't know much about Mathematica, that expression, as written, is -1/2, for all t where f[t] is defined, not 0.
– Zéychin
Jul 6 '14 at 10:32
• Did you know there's a mathematica.stackexchange? I've flagged for migrating it there. Jul 6 '14 at 10:38
• Mathematica doesn't know you are assuming t is Real until you tell it. Simplify[Im[ComplexExpand[Exp[It]/(1-Exp[It])]],t \[Element] Reals] and then you are assuming that the denominator is not zero. Simplify[Im[ComplexExpand[Exp[It]/(1 - Exp[It])]], t \[Element] Reals && Cos[t] != 1]
– Bill
Jul 6 '14 at 13:24
• Simplify @ ComplexExpand[Im[Exp[I*t]/(1 - Exp[I*t])]]?
– Kuba
Jul 8 '14 at 10:06

You can simplify the procedure:

Putting Im under ComplexExpand you get immediately

In[182]:= ComplexExpand[Im[Exp[I*t]/(1 - Exp[I*t])]]

Out[182]= Sin[t]/((1 - Cos[t])^2 + Sin[t]^2)


Simplifying this leads to the final result

In[183]:= Simplify[%]

Out[183]= 1/2 Cot[t/2]


Treating the real part similarly leads to

In[184]:= ComplexExpand[Re[Exp[I*t]/(1 - Exp[I*t])]]//Simplify

Out[185]= -(1/2)


Regards, Wolfgang

• It would be educational to mention why :)
– Kuba
Jul 8 '14 at 18:01
• @Kuba: It is requested to calculate the imaginary part of a complex function f(t) of the real argument t. This can be done efficiently in MMA as shown. Notice that ComplexExpand simplifies a function assuming all its parameters to be real. Jul 8 '14 at 21:13