<s>[INST] Rewrite complex number using de Moivre We have the following number $$z = (\dfrac{1}{2}-i)(1+i)^n + (\dfrac{1}{2}+i)(1-i)^n$$ and we want to rewrite it using de Moivre, in the neatest way I guess.
What I did is $$(1+i)^n = (\cos(\pi) + i \sin(\dfrac{1\pi}{2}))^n =(\cos(n\pi) + i \sin(\dfrac{n\pi}{2})) $$
Doing it for $(1-i)^n$ we obtain $$cos(n\pi) + i \sin (\dfrac{3n\pi}{2})$$
If we then multiply by the remaining factors, I get the form $$\cos(\pi n) + i \sin (\dfrac{\pi n}{2}) + \sin (\dfrac{\pi n}{2}) - \sin (\dfrac{3\pi n}{2})$$
However I'm wondering if this is the best way to use de Moivre here to clean the expression up. Wolfram alpha seems to give a different result.
 [/INST] Let $ \tan \phi = 2$ then
\begin{eqnarray*}
1+i = \sqrt{2} e^{ \frac{i\pi}{4}} \\
1-i = \sqrt{2} e^{- \frac{i\pi}{4}} \\
\frac{1}{2}+i =\frac{\sqrt{5}}{2} e^{i \phi} \\
\frac{1}{2}-i =\frac{\sqrt{5}}{2} e^{-i \phi} 
\end{eqnarray*}
So the quantitiy can be written as 
\begin{eqnarray*}
z = (\dfrac{1}{2}-i)(1+i)^n + (\dfrac{1}{2}+i)(1-i)^n = \dfrac{\sqrt{5} \sqrt{2}^n}{2} \left( e^{i (- \phi+ \frac{n\pi}{4})} +e^{i ( \phi- \frac{n\pi}{4})} \right)
\end{eqnarray*}
This can be rewritten as 
\begin{eqnarray*}
z =  \sqrt{5} 2^{\frac{n}{2} }\cos ( \phi- \frac{n\pi}{4}).
\end{eqnarray*}
</s>