<s>[INST] how to express the $n$th power of the cosine as a series of cosines? Which is the correct way for expressing the $n$th power of a cosine as a series of cosines without any exponent?
By using the Euler's formula
$\cos^n{(\theta)}=\left( \frac{e^{j\theta}+e^{-j\theta}}{2} \right)^n=
                    \frac{1}{2^n}\left( e^{j\theta}+e^{-j\theta} \right)^n=\frac{1}{2^n}\left( z+z^{-1} \right)^n.$
with $z=e^{j\theta}$.
Since the term $\left( z+z^{-1} \right)^n$ is the $n$th power of a binomial, I could express it using the binomial identity, thus
$\cos^n{(\theta)} = \frac{1}{2^n} \displaystyle\sum_{k=0}^n \binom{n}{k} z^k(z^{-1})^{n-k}
  = \frac{1}{2^n} \displaystyle\sum_{k=0}^n \binom{n}{k} z^{2k-n}.$
If we expand the expression above, we obtain
$\cos^n{(\theta)}=\frac{1}{2^n}\Bigg ( z^{-n} + \binom{n}{1}z^{-(n-2)} + \binom{n}{2}z^{-(n-4)} + \dots + \binom{n}{2}z^{n-4} + \binom{n}{1}z^{(n-2)} + z^n \Bigg )$
which can be rewritten as
$\cos^n{(\theta)}=\frac{1}{2^n} \Bigg ( (z^{-n} + z^n) + \binom{n}{1} \left(z^{-(n-2)} + z^{(n-2)}\right) + \binom{n}{2}\left( z^{-(n-4)} + z^{(n-4)}\right) + \dots \Bigg )  $
Finally, since $z=e^{j\theta}$
$\cos^n{(\theta)}=\frac{1}{2^n} \Bigg ( (e^{-jn\theta} + e^{jn\theta}) + \binom{n}{1} \left(e^{j(n-2)\theta} + e^{-j(n-2)\theta}\right) + \binom{n}{2}\left( e^{j(n-4)\theta} + e^{-j(n-4)\theta}\right) + \dots \Bigg )$
By applying the Euler's formula once again, we obtain
$\cos^n{(\theta)}=\frac{2}{2^{n}} \sum_{k=0}^n \binom{n}{k} \cos{((n-2k)\theta)}.$
Unfortunately, if I plug n=2, I obtain
$\cos^2{(\theta)}= \cos{(2\theta)} + 1.$
instead of the well-known result
$\cos^2{(\theta)}= \frac{1}{2}(\cos{(2\theta)} + 1).$
a) Why my result is scaled by a factor of 2 ?
b) Is the correct general formula
$\cos^n{(\theta)}=\frac{1}{2^{n}} \sum_{k=0}^n \binom{n}{k} \cos{((n-2k)\theta)}.$
c)If so, why ?
 [/INST] We start from
$$ s_n = \frac{1}{2^n} \sum_{k=0}^n \binom{n}{k} z^{2k-n} $$
Case 1: Let $n = 2m$
$$ s_{2m} = \frac{1}{2^{2m}} \sum_{k=0}^{2m} \binom{2m}{k} z^{2(k-m)} $$
$$ s_{2m} = \frac{1}{2^{2m}} \sum_{k=0}^{m} \binom{2m}{k} z^{2(k-m)} + \frac{1}{2^{2m}} \sum_{k=m+1}^{2m} \binom{2m}{k} z^{2(k-m)} $$
$$ s_{2m} = \frac{1}{2^{2m}} \sum_{k=0}^{m} \binom{2m}{k} z^{2(k-m)} + \frac{1}{2^{2m}} \sum_{l=0}^{m-1} \binom{2m}{2m - l} z^{2(m - l)} $$
$$ s_{n} = \frac{n!}{2^{n}(n/2)!^2} + \frac{1}{2^{n}} \sum_{k=0}^{n/2-1} \binom{n}{k} (z^{2k-n} + z^{n - 2k}) $$
$$ cos^{n}(\theta) = \frac{n!}{2^{n}(n/2)!^2} + \frac{2}{2^{n}} \sum_{k=0}^{n/2-1} \binom{n}{k} cos((2k-n)\theta) $$
$$ cos^{n}(\theta) = \frac{1}{2^{n}} \sum_{k=0}^{n/2-1} \binom{n}{k} cos((2k-n)\theta) + \frac{1}{2^{n}}\binom{n}{n/2} \cos((2(n/2)-n)\theta) + \frac{1}{2^{n}} \sum_{l=n/2+1}^{n} \binom{n}{l} \cos((2l-n)\theta) $$
$$ cos^{n}(\theta) = \frac{1}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} cos((2k-n)\theta) $$
Case 2: Let $n = 2m - 1$
$$ s_{2m - 1} = \frac{1}{2^{2m - 1}} \sum_{k=0}^{2m - 1} \binom{2m - 1}{k} z^{2(k-m) + 1} $$
$$ s_{2m - 1} = \frac{1}{2^{2m - 1}} \sum_{k=0}^{m - 1} \binom{2m - 1}{k} z^{2(k-m) + 1} + \frac{1}{2^{2m - 1}} \sum_{k=m}^{2m - 1} \binom{2m - 1}{k} z^{2(k-m) + 1} $$
$$ s_{2m - 1} = \frac{1}{2^{2m - 1}} \sum_{k=0}^{m - 1} \binom{2m - 1}{k} z^{2(k-m) + 1} + \frac{1}{2^{2m - 1}} \sum_{k = 0}^{m} \binom{2m - 1}{k} z^{2(m-k) - 1} $$
$$ s_{n} = \frac{1}{2^{n}} \sum_{k=0}^{(n - 1)/2} \binom{n}{k} (z^{2k-n} + z^{n-2k}) $$
$$ cos^{n}(\theta) = \frac{2}{2^{n}} \sum_{k=0}^{(n - 1)/2} \binom{n}{k} cos((2k-n)\theta) $$
$$ cos^{n}(\theta) = \frac{1}{2^{n}} \sum_{k=0}^{(n - 1)/2} \binom{n}{k} cos((2k-n)\theta) + \frac{1}{2^{n}} \sum_{l=(n + 1)/2}^{n} \binom{n}{l} cos((2l-n)\theta) $$
$$ cos^{n}(\theta) = \frac{1}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} cos((2k-n)\theta) $$
Therefore, mixing the both cases we get
$$ cos^{n}(\theta) = \frac{1}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} cos((2k-n)\theta) $$
</s>