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.

Noting
$$ 1+\sin\theta=1+\cos(\frac{\pi}{2}-\theta)=2\cos^2(\frac{\pi}{4}-\frac{\theta}{2}), \cos\theta=\sin (\frac{\pi}{2}-\theta)=2\sin(\frac{\pi}{4}-\frac{\theta}{2})\cos(\frac{\pi}{4}-\frac{\theta}{2})$$
one has
\begin{eqnarray}
z&=&\left( \frac{1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta} \right)^n\\
&=&\left( \frac{1+\cos(\frac{\pi}{2}-\theta) + i\sin (\frac{\pi}{2}-\theta)}{1+\cos(\frac{\pi}{2}-\theta) - i\sin (\frac{\pi}{2}-\theta)} \right)^n\\
&=&\left( \frac{2\cos^2(\frac{\pi}{4}-\frac{\theta}{2}) + i2\sin(\frac{\pi}{4}-\frac{\theta}{2})\cos(\frac{\pi}{4}-\frac{\theta}{2})}{2\cos^2(\frac{\pi}{4}-\frac{\theta}{2}) - i2\sin(\frac{\pi}{4}-\frac{\theta}{2})\cos(\frac{\pi}{4}-\frac{\theta}{2})} \right)^n\\
&=&\left( \frac{\cos(\frac{\pi}{4}-\frac{\theta}{2}) + i\sin(\frac{\pi}{4}-\frac{\theta}{2})}{\cos(\frac{\pi}{4}-\frac{\theta}{2}) - i\sin(\frac{\pi}{4}-\frac{\theta}{2})} \right)^n\\
&=&(\cos(\frac{\pi}{2}-\theta) + i\sin(\frac{\pi}{2}-\theta))^n\\
&=&\cos(\frac{n\pi}{2}-n\theta) + i\sin(\frac{n\pi}{2}-n\theta)
\end{eqnarray}
and hence the real and imaginary parts are easy to get.
