TITLE: Expressing $1 + \cos(x) + \cos(2x) +... + \cos(nx)$ as a sum of two terms
QUESTION [6 upvotes]: Question in title, my progress:
let $z = \cos(x) + i\sin(x)$
then $1 + \cos(x) + \cos(2x) +\dots + \cos(nx) = Re(1 + z + z^2 +\dots + z^n) = Re\left (\dfrac{1-z^{n+1}}{1-z} \right)$
by geometric series;
multiplying $\dfrac{1-z^{n+1}}{1-z}$ by $\overline{1-z}$ we get $1 + \cos(x) + \cos(2x) +\dots + \cos(nx) = Re \left ( \dfrac{(1-z^{n+1})(\overline{1-z})}{|1-z|^2} \right )$
but I am not sure how to proceed from here.
edit: this is for a complex analysis course, so i'd appreciate a hint using complex analysis without using the exponential function

REPLY [5 votes]: Use $\sin(a) \cos(b) = \frac{1}{2} \sin(b+a) - \frac{1}{2} \sin(b-a)$ and multiply your sum with $\sin\left(x/2\right)$.
$$
 \sum_{m=0}^{n} \sin\left(\frac{x}{2}\right) \cos(m x) = \frac{1}{2} \sum_{m=0}^n  \left\{\sin \left(\left(m+1-\frac{1}{2}\right)x \right) - \sin\left( \left(m-\frac{1}{2}\right)x \right) \right\}
$$
The sum telescopes, i.e. $\sum_{m=0}^n \left(f(m+1)-f(m)\right) = f(n+1)-f(0)$, hence
$$
  \sum_{m=0}^{n} \sin\left(\frac{x}{2}\right) \cos(m x) = \sin \left(\left(n+\frac{1}{2}\right)x \right) - \sin\left(\frac{x}{2} \right)
$$
now divide by $\sin\left(\frac{x}{2}\right)$.