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.
 A: HINT: Express the fraction as $r e^{i\theta}$ and compute $r^n e^{i n\theta}$.
A: 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.
A: It is convenient to use $e^{i\theta}=\cos\theta + i\sin\theta$.

We obtain
  \begin{align*}
\color{blue}{z}&\color{blue}{=\left(\frac{1+\sin \theta +i\cos \theta}{1+\sin\theta-i\cos \theta}\right)^n}\\
&=\left(\frac{1+ie^{-i\theta}}{1-ie^{i\theta}}\right)^n\\
&=\left(\frac{1+ie^{-i\theta}}{-ie^{i\theta}(1+e^{-i\theta})}\right)^n\\
&=\left(ie^{-i\theta}\right)^n\\
&=i^ne^{-in\theta}\\
&=\color{blue}{i^n\left(\cos (n\theta) - i\sin(n\theta)\right)}
\end{align*}

A: The denominator is $2+2\sin\theta$, the numerator is, setting $2\alpha=\theta$,
$$
1+e^{2i\alpha}=2e^{i\alpha}\cos\alpha
$$
Then your number is
$$
\left(\frac{\cos\alpha}{1+\sin2\alpha}\right)^{n}e^{ni\alpha}
$$
A: 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)$
A: $$\left( \frac { 1+\sin  \theta +i\cos  \theta  }{ 1+\sin  \theta -i\cos  \theta  }  \right) ^{ n }={ \left( 1+\frac { 2i\cos  \theta  }{ 1+\sin  \theta -i\cos  \theta  }  \right)  }^{ n }=\\ ={ \left( 1+\frac { 2i\cos  \theta \left( 1+\sin  \theta +i\cos  \theta  \right)  }{ \left( 1+\sin  \theta -i\cos  \theta  \right) \left( 1+\sin  \theta +i\cos  \theta  \right)  }  \right)  }^{ n }=\\ ={ \left( 1+\frac { 2i\cos  \theta +2isin{ \theta \cos { \theta  }  }{ -2\cos ^{ 2 }{ \theta  }  } }{ 2+2\sin  \theta  }  \right)  }^{ n }=\\ ={ \left( 1+\frac { i\cos  \theta +isin{ \theta \cos { \theta  }  }{ -\cos ^{ 2 }{ \theta  }  } }{ 1+\sin  \theta  }  \right)  }^{ n }=\\ ={ \left( 1-\frac { \cos ^{ 2 }{ \theta  }  }{ 1+sin{ \theta  } } +i\frac { \cos  \theta +sin{ \theta \cos { \theta  }  } }{ 1+\sin  \theta  }  \right)  }^{ n }={ \left( \sin { \theta  } +i\cos { \theta  }  \right)  }^{ n }=\\ ={ \left( \cos { \left( \frac { \pi  }{ 2 } -\theta  \right) +i\sin { \left( \frac { \pi  }{ 2 } -\theta  \right)  }  }  \right)  }^{ n }=\cos { n\left( \frac { \pi  }{ 2 } -\theta  \right) +i\sin { \left( n\left( \frac { \pi  }{ 2 } -\theta  \right)  \right)  }  } \\ \\ \\ \\ $$
A: Let's get a picture:

$|1 + \sin\theta + i\cos\theta| = |1 + \sin\theta - i\cos\theta|$
$\left|\frac {1 + \sin\theta + i\cos\theta}{1 + \sin\theta - i\cos\theta}\right| = 1$
When we divide complex numbers the argument of the ratio equals the difference between the arguments.
let $\phi = \frac {\pi}{2} - \theta$
$1 + \sin\theta + i\cos\theta = 1 + \cos\phi + i\sin\phi$
$\frac {1 + \cos \phi + i\sin\theta}{1 + \cos\phi - i\sin\phi} = e^{\phi i}$
$\left(\frac {1 + \cos \phi + i\sin\phi}{1 + \cos\phi - i\sin\phi}\right)^n = e^{n\phi i}$
or
$e^{n(\frac \pi 2 - \theta)  i}$
A: 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.
