Calculate explicitly the sum:

$$
\sum_{k=0}^{n}\binom{n}{k} \cos k x
$$
We denote this sum by $S$, and let $T=\sum_{k=0}^{n}\binom{n}{k} \sin k x$. Then $S=$ $\Re(S+i T)$. We have

$$
S+i T=\sum_{k=0}^{n}\binom{n}{k} e^{i k x}=\left(1+e^{i x}\right)^{n}
$$

by the binomial formula. Since $\left(1+e^{i x}\right)=e^{-i x / 2}\left(e^{-i x / 2}+e^{i x / 2}\right)=2 e^{-i x / 2} \cos (x / 2)$. We thus find

$$
S+i T=(2 \cos (x / 2))^{n} e^{-i n x / 2}
$$

By taking the real parts, we obtain

$$
\sum_{k=0}^{n}\binom{n}{k} \cos k x=2^{n}(\cos (x / 2))^{n} \cos n x / 2
$$