Question:
There exist constants $a_1,$ $a_2,$ $a_3,$ $a_4,$ $a_5$ such that
\[\cos^5 \theta = a_1 \cos \theta + a_2 \cos 2 \theta + a_3 \cos 3 \theta + a_4 \cos 4 \theta + a_5 \cos 5 \theta\]for all angles $\theta.$  Find $a_1^2 + a_2^2 + a_3^2 + a_4^2 + a_5^2.$

Answer:
We know that
\[e^{i \theta} = \cos \theta + i \sin \theta.\]Then
\[e^{-i \theta} = \cos (-\theta) + i \sin (-\theta) = \cos \theta - i \sin \theta.\]Adding these and dividing by 2, we get
\[\cos \theta = \frac{e^{i \theta} + e^{-i \theta}}{2}.\]Then
\begin{align*}
\cos^5 \theta &= \frac{1}{32} (e^{i \theta} + e^{-i \theta})^5 \\
&= \frac{1}{32} (e^{5i \theta} + 5e^{3i \theta} + 10e^{i \theta} + 10e^{-i \theta} + 5e^{-3i \theta} + e^{-5i \theta}) \\
&= \frac{1}{16} \cos 5 \theta + \frac{5}{16} \cos 3 \theta + \frac{5}{8} \cos \theta.
\end{align*}Thus, $a_1^2 + a_2^2 + a_3^2 + a_4^2 + a_5^2 = \left( \frac{1}{16} \right)^2 + \left( \frac{5}{16} \right)^2 + \left( \frac{5}{8} \right)^2 = \boxed{\frac{63}{128}}.$