<s>[INST] Any trick for evaluating $\left(\frac{\sqrt{3}}{2}\cos(\theta) + \frac{i}{2}\sin(\theta)\right)^7$? Expressions of the form $(a\cos(\theta) + bi\sin(\theta))^n$ come up from time to time in applications of complex analysis, but to my knowledge the De Moivre's formula can only be applied with $a = b$. Is there some trick to deal with the case of $a \neq b$, for example when the expression is $\left(\frac{\sqrt{3}}{2}\cos(\theta) + \frac{i}{2}\sin(\theta)\right)^7$?
 [/INST] How about this:
$$ \frac{\sqrt{3}}{{2}} \cos \theta = \cos 30 \cos \theta= \frac{1}{2} \left[ \cos(30 - \theta)+\cos \left(30+ \theta \right) \right] =\frac12 (b+a)$$
$$ \frac12 \sin \theta= \sin(30) \sin \theta= \frac12 \left[\cos \left( 30 - \theta\right)- \cos (30+ \theta )\right]=\frac12 (b-a)$$
We have:
$$\frac{1}{2^7}\left[ (a+b) + i(b-a)\right]^7$$
Call $a+b=u=\sqrt{3} \cos \theta$, $b-a=v= \sin \theta$, then for the complicated part:
$$ \left[ u+iv\right]^7 = (u^2+v^2)^{\frac72} \left[\frac{u+iv}{(u^2 + v^2)^{\frac12}} \right]^7=(u^2 +v^2)^{\frac72} e^{i7( \tan^{-1} \frac{v}{u}) }$$
Now back substitute and simplify.
</s>