Proving complex series $1 + \cos\theta + \cos2\theta +... + \cos n\theta $ So I have this result
$1 + z + z^2 + ... + z^n = \frac{z^{n+1}-1}{z-1}$
which I proved already. Now I am supposed to use that result and De Moivre's formula to establish this identity

$1 + \cos\theta + \cos2\theta +... + \cos n\theta = \frac{1}{2} + \frac{\sin[(n+\frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})}$

Can anyone help me?
 A: Starting with (and using this midway)
$$1+\cos{\theta}+\cos{2\theta}+...+\cos{n\theta}=\\
\Re\left(1+\cos{\theta}+i\sin{\theta}+\cos{2\theta}+i\sin{2\theta}+...+\cos{n\theta}++i\sin{n\theta}\right)=\\
\Re\left(1+e^{i\theta}+e^{2i\theta}+...+e^{ni\theta}\right)=\\
\Re\left(\frac{e^{(n+1)i\theta}-1}{e^{i\theta}-1}\right)=\Re\left(\frac{e^{\frac{(n+1)}{2}i\theta}}{e^{i\frac{\theta}{2}}}\cdot\frac{e^{\frac{(n+1)}{2}i\theta}-e^{\frac{-(n+1)}{2}i\theta}}{e^{i\frac{\theta}{2}}-e^{-i\frac{\theta}{2}}}\right)=\\
\Re\left(\frac{e^{\frac{(n+1)}{2}i\theta}}{e^{i\frac{\theta}{2}}}\cdot\frac{\sin{\frac{(n+1)\theta}{2}}}{\sin{\frac{\theta}{2}}}\right)=
\Re\left(e^{i\theta\frac{n}{2}}\cdot\frac{\sin{\frac{(n+1)\theta}{2}}}{\sin{\frac{\theta}{2}}}\right)=\\
\frac{\cos{\frac{n\theta}{2}}\cdot\sin{\frac{(n+1)\theta}{2}}}{\sin{\frac{\theta}{2}}}=
\frac{1}{2}\frac{\sin\left(\frac{n\theta}{2}+\frac{(n+1)\theta}{2}\right)-\sin\left(\frac{n\theta}{2}-\frac{(n+1)\theta}{2}\right)}{\sin{\frac{\theta}{2}}}=\\
\frac{1}{2}\frac{\sin\left(\left(n+\frac{1}{2}\right)\theta\right)+\sin{\frac{\theta}{2}}}{\sin{\frac{\theta}{2}}}$$
and the final result follows.
A: HINT:
$$\cos(k\theta)=\frac{e^{ik\theta}+e^{-ik\theta}}{2}$$
A: $\cos k\theta$ is the real part of $\mathrm e^{ik\theta}$, $\sin k\theta$ its imaginary part, so for the same price, you can obtain both
$$ \sum_{k=0}^n\cos k\theta\enspace\text{ and }\enspace \sum_{k=1}^n\sin k\theta. $$
Hint for the final simplification:
you'll have to express with real functions the real and imaginary parts of
$$\frac{\mathrm e^{i(n+1)\theta}-1}{\mathrm e^{i\theta}}.$$
Factor out $\;\mathrm e^{i(n+1)\tfrac{\theta}2}$ and $\;\mathrm e^{i\tfrac{\theta}2}$ in the numerator and denominator respectively, then use Euler's formula.
