Powers of Cosine as a Linear Combination of a Sequence

So I was reading through my Applied Math textbook and came across a proof which they omitted some (I guess what was supposed to be obvious) details but I can't see where they're getting it from.

We're given a sequence defined as follows:

$\displaystyle e_0(x) = \frac{1}{\sqrt{\pi}}$

$\displaystyle e_k(x) = \sqrt{\frac{2}{\pi}}\cos(kx), k\geq1$

They showed that this forms an orthonormal basis, which I understand how they did it, but I'm not getting how they're going from using the following identity:

$\displaystyle (\cos x)^k = (\frac{e^{ix}+e^{-ix}}{2})^k$

to claiming that this demonstrates any power of $\displaystyle (\cos x)^k$ is a linear combination of the elements from $\displaystyle \{e_k(x)\}$.

How does this identity get used to show that? I'm just really curious.