If $i^2 = -1$, then the sum \[\cos{45^\circ} + i\cos{135^\circ} + \cdots + i^n\cos{(45 + 90n)^\circ}  + \cdots + i^{40}\cos{3645^\circ}\]
equals 
$\text{(A)}\ \frac{\sqrt{2}}{2} \qquad  \text{(B)}\ -10i\sqrt{2} \qquad  \text{(C)}\ \frac{21\sqrt{2}}{2} \qquad\\ \text{(D)}\ \frac{\sqrt{2}}{2}(21 - 20i) \qquad  \text{(E)}\ \frac{\sqrt{2}}{2}(21 + 20i)$
Solution by e_power_pi_times_i
Notice that the sequence repeats every $4$ terms. These $4$ terms are $\cos(45^\circ)$, $i\cos(135^\circ)$, $-\cos(225^\circ)$, and $-i\cos(315^\circ)$. This is because $\cos(\theta) = \cos(360^\circ - \theta)$. Also $\cos(\theta) = -\cos(180^\circ - \theta)$, so the $4$ terms are just $\cos(45^\circ)$, $-i\cos(45^\circ)$, $\cos(45^\circ)$, and $-i\cos(45^\circ)$, which adds up to $\sqrt{2}-i\sqrt{2}$. The sequence repeats $10$ times, and an extra $i^{40}\cos(3645^\circ)$. The sum is $10(\sqrt{2}-i\sqrt{2})+\dfrac{\sqrt{2}}{2} = \dfrac{21\sqrt{2}}{2} - 10i\sqrt{2} = \boxed{\text{(D) }\dfrac{\sqrt{2}}{2}(21-20i)}$.