<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] we know that $a+ib=\sqrt{a^{2}+b^{2}}\cdot e^{i\arctan \frac{b}{a}}\Rightarrow \frac{a+ib}{a-ib}=e^{2i\arctan \frac{b}{a}}$ and $\cos \theta +i\sin \theta =e^{i\theta }$ then:
$\left( \frac{1+\sin \theta +i\cos \theta }{1+\sin \theta -i\cos \theta } \right)^{n}=e^{i\cdot 2n\arctan \frac{\cos \theta }{1+\sin \theta }}=\cos \left( 2n\arctan \frac{\cos \theta }{1+\sin \theta } \right)+i\sin \left( 2n\arctan \frac{\cos \theta }{1+\sin \theta } \right)$
</s>