<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] $$\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)  }  } \\ \\ \\ \\ $$
</s>