Suppose you want cos(nx) and sin(nx) in terms of sin(x). You'll need cos(x) as well which can be found using

cos(x)=±1−(sin(x))2−−−−−−−−−−−√$cos(x)=\pm \sqrt{1-(sin(x){)}^{2}}$

First note that eix=cos(x)+i∗sin(x)${e}^{ix}=cos(x)+i\ast sin(x)$

Raising both sides to the nth power:

en∗ix=(cos(x)+i∗sin(x))n${e}^{n\ast ix}=(cos(x)+i\ast sin(x){)}^{n}$

And note that

en∗ix=cos(nx)+i∗sin(nx)${e}^{n\ast ix}=cos(nx)+i\ast sin(nx)$

Therefore, by the transitive property

(cos(x)+i∗sin(x))n=cos(nx)+i∗sin(nx)$(\mathrm{cos}(x)+i\ast \mathrm{sin}(x){)}^{n}=\mathrm{cos}(nx)+i\ast \mathrm{sin}(nx)$

So

cos(nx)=Re(cos(x)+i∗sin(x))n)$cos(nx)=Re(cos(x)+i\ast sin(x){)}^{n})$

and

sin(nx)=Im(cos(x)+i∗sin(x))n)$sin(nx)=Im(cos(x)+i\ast sin(x){)}^{n})$

Expanding using the binomial theorem yields:

(cos(x)+i∗sin(x))n=$(cos(x)+i\ast sin(x){)}^{n}=$∑nk=0(nk)∗(cos(x))n−k∗(i∗sin(x))k$\sum _{k=0}^{n}(\genfrac{}{}{0ex}{}{n}{k})\ast (cos(x){)}^{n-k}\ast (i\ast sin(x){)}^{k}$

Splitting it into real and imaginary parts:

cos(nx)=∑⌊n2⌋k=0$cos(nx)=\sum _{k=0}^{\lfloor \frac{n}{2}\rfloor}$(n2k)∗(−1)k∗(sin(x))2k∗(cos(x))n−2k$(\genfrac{}{}{0ex}{}{n}{2k})\ast (-1{)}^{k}\ast (sin(x){)}^{2k}\ast (cos(x){)}^{n-2k}$

And

sin(nx)=∑⌊n−12⌋k=0(n2k+1)∗$sin(nx)=\sum _{k=0}^{\lfloor \frac{n-1}{2}\rfloor}(\genfrac{}{}{0ex}{}{n}{2k+1})\ast $ (−1)k∗(sin(x))2k+1∗(cos(x))n−2k−1