<s>[INST] Find the real and imaginary part of z let $z=$ $$ \left( \frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta} \right)^n$$

Rationalizing the denominator:
$$\frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta}\cdot\left( \frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta + i\cos\theta}\right) = \frac{(1 + \sin\theta + i\cos\theta)^2}{(1 + \sin\theta)^2 + \cos^2\theta}$$
$$=\frac{(1 + \sin\theta)^2 + \cos^2\theta + 2i(1 + \sin\theta)\cos\theta }{(1 + \sin\theta)^2 + \cos^2\theta}$$
thus
$$x = \frac{(1 + \sin\theta)^2 + \cos^2\theta }{(1 + \sin\theta)^2 + \cos^2\theta} $$
$$y= \frac{2i(1 + \sin\theta)\cos\theta }{(1 + \sin\theta)^2 + \cos^2\theta}$$
According to the binomial theorem, 
$$(x+y)^n = \sum_{k=0}^n \binom{n}{k} x^{n-k}y^k$$
we get 
$$z = \frac{1}{(1 + \sin\theta)^2 + \cos^2\theta}\sum_{k=0}^n \binom{n}{k} ((1 + \sin\theta)^2 + \cos^2\theta)^{n-k}\cdot(2i(1 + \sin\theta)\cos\theta)^k$$
...and that is where I'm stuck. What do you think? Thanks for the attention.
 [/INST] Following your rationalizing the denominator method, you err when expanding the square. You should get
$$
\frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta} = \frac{(1+\sin\theta)^2 - (\cos\theta)^2 + 2i\cos\theta(1+\sin\theta)}{(1+\sin\theta)^2 + (\cos\theta)^2}
$$
This can then be simplified by expanding the $(1+\sin\theta)^2$ term and using $(\sin\theta)^2 + (\cos\theta)^2 = 1$.
$$
\frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta} = \frac{1 - (\cos\theta)^2 + (\sin\theta)^2 + 2\sin\theta + 2i\cos\theta(1+\sin\theta)}{1+2\sin\theta + (\sin\theta)^2 + (\cos\theta)^2} = \frac{2\sin\theta(1+\sin\theta) + 2i\cos\theta(1+\sin\theta)}{2 + 2\sin\theta} = \sin\theta + i\cos\theta = i(\cos\theta - i\sin\theta)
$$
It should be clear then that 
$$
\left(\frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta}\right)^n = i^n\left[\cos(n\theta)-i\sin(n\theta) \right]
$$
and you should be able to take real and imaginary parts from there.
</s>