De Moivre's theorem, along with the binomial theorem, can be used to expand functions like or , where is an integer, into a sum of powers of trig functions consisting of a mixture of sines and cosines. In some cases it is possible to rewrite the expansion such that it contains all sines or all cosines by making use of the identity .