Finding real part of complex number in exponential form in fraction Given this complex number,
$$e^{9ix/2} \frac{\sin 4x  }{ (\sin (x/2) }$$
The real part of this complex number can be worked out easily, by replacing the $e^{9ix/2}$ with $\cos(9x/2)$
However if I'm given the complex number,
$$\frac{3} {3 - e^{ix} }$$
I cannot work out the real part by replacing the $e^{ix}$ with $\cos x $.
I want to understand why I can do this replacement in the first example and why I can't do it in the second example; and what I should look for when doing practice questions myself. And how I would actually go about working out the real part of the second example.
Thanks, any help would be appreciated. 

HINT
Use that
$$\frac{3} {3 - e^{ix} }=\frac{3} {3 - e^{ix} }\frac{3 - e^{-ix} } {3 - e^{-ix} }=\frac{9 - 3e^{-ix} } {10 -3 (e^{ix}+e^{-ix}) }$$
then recall that $z+\bar z= 2\Re(z)$.
