<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] We first recall de Moivre's formula:
$(\cos \phi + i\sin \phi)^n = \cos (n \phi) + i \sin(n \phi).  \tag{1}$
Also
$z = (\dfrac{1}{2}-i)(1+i)^n + (\dfrac{1}{2}+i)(1-i)^n.  \tag{2}$
If we set
$w = (\dfrac{1}{2} - i)(1 + i)^n, \tag{3}$
then we see that
$z = w + \bar w.  \tag{4}$
We can evaluate $w$ with the aid of the deMoivre formula; we have
$1 + i = \sqrt 2 (\dfrac{1}{\sqrt 2} + i \dfrac{1}{\sqrt 2}); \tag{5}$
noting that
$\cos \dfrac{\pi}{4} = \sin \dfrac{\pi}{4} = \dfrac{1}{\sqrt 2}, \tag{6}$
we write (5) as
$1 + i = \sqrt 2 (\cos \dfrac{\pi}{4} + i \sin \dfrac{\pi}{4}), \tag{7}$
whence
$(1 + i)^n = (\sqrt 2)^n(\cos \dfrac{\pi}{4} + i \sin \dfrac{\pi}{4})^n.\tag{8}$
We apply de Moivre to (8), yielding
$(1 + i)^n = (\sqrt 2)^n(\cos \dfrac{\pi}{4} + i \sin \dfrac{\pi}{4})^n = (\sqrt 2)^n(\cos \dfrac{n\pi}{4} + i \sin \dfrac{n\pi}{4}).  \tag{9}$
As for the factor of $\frac{1}{2} - i$, we may write
$\dfrac{1}{2} - i = \dfrac{1}{2}(1 - 2i) = \dfrac{\sqrt 5}{2}(\dfrac{1}{\sqrt5} - \dfrac{2}{\sqrt 5}i); \tag{10}$
At this point we can follow Donald Splutterwit's answer and introduce the angle $\phi$ in the first quadrant such that $\tan \phi = 2$, so we have
$\dfrac{1}{2} - i = \dfrac{\sqrt 5}{2}(\cos \phi - i\sin \phi), \tag{11}$
but to my taste this doesn't gain us much; thus I prefer to write
$w = (\dfrac{1}{2} - i)(1 + i)^n = \dfrac{\sqrt 5}{2}(\dfrac{1}{\sqrt5} - \dfrac{2}{\sqrt 5}i)(\sqrt 2)^n(\cos \dfrac{n\pi}{4} + i \sin \dfrac{n\pi}{4})$
$ = \dfrac{(\sqrt 2)^n \sqrt 5}{2}(\dfrac{1}{\sqrt5} - \dfrac{2}{\sqrt 5}i)(\cos \dfrac{n\pi}{4} + i \sin \dfrac{n\pi}{4})$
$ = \dfrac{(\sqrt 2)^n \sqrt 5}{2}((\dfrac{1}{\sqrt 5} \cos \dfrac{n\pi}{4}  + \dfrac{2}{\sqrt 5} \sin \dfrac{n\pi}{4}) + i(\dfrac{1}{\sqrt 5}\sin \dfrac{n\pi}{4} - \dfrac{2}{\sqrt 5}\cos \dfrac{n\pi}{4}))$
$= \dfrac{(\sqrt 2)^n }{2}(( \cos \dfrac{n\pi}{4}  + 2 \sin \dfrac{n\pi}{4}) + i(\sin \dfrac{n\pi}{4} - 2\cos \dfrac{n\pi}{4}));  \tag{12}$
thus
$\bar w = \dfrac{(\sqrt 2)^n }{2}(( \cos \dfrac{n\pi}{4}  + 2 \sin \dfrac{n\pi}{4}) - i(\sin \dfrac{n\pi}{4} - 2\cos \dfrac{n\pi}{4})), \tag{13}$
whence
$z = w + \bar w =(\sqrt 2)^n ( \cos \dfrac{n\pi}{4}  + 2 \sin \dfrac{n\pi}{4}),  \tag{14}$
and I'll leave it at that.
NB:  In preparing this derivation, I have tried to stick as much as possible to elementary algebraic operations and trigonometric identities, avoiding the use of fractional exponents and the exponential identity ($e^{i\theta} = \cos \theta + i \sin \theta$).  In this context it is worth notting that de Moivre's formula (1) may be proved by a simple induction, for 
if, for $k \in \Bbb Z$, $k \ge 1$, we assume
$(\cos \theta + i \sin \theta)^k = \cos (k\theta) + i\sin (k \theta), \tag{15}$ 
then
$(\cos \theta + i \sin \theta)^{k + 1} = (\cos \theta + i \sin \theta)(\cos (k\theta) + i\sin (k \theta))$
$ = \cos((k + 1)\theta) + i\sin((k + 1)\theta) \tag{16}$
follows from the elementary angle addition formulas
$\sin (a + b) = \cos a \sin b + \cos b \sin a, \tag{17}$
$\cos (a + b) = \cos a \cos b - \sin a \sin b. \tag{18}$
Finally, I must admit that the introduction of (10), with its factors of $\sqrt 5$, which subsequently cancels out, is a bit overdone and inelegant, but I'm not about to edit his answer any more now.
</s>