<s>[INST] Using that $1 + z + z^{2} + ... + z^{n} = \frac{1-z^{n+1}}{1-z}$ and taking the real parts, prove that: $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac12+\frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$
for $0 < \theta < 2\pi$.
Alright. What I have done is this, using the De Moivre's Formula:
$$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \operatorname{Re}(1 + (\cos\theta + i\sin\theta) + (\cos2\theta + i\sin2\theta) + ... + (\cos n\theta + i \sin n \theta))$$
That is equivalent to
$$ \operatorname{Re}(1 + e^{i\theta} + e^{2i\theta} + ... e^{ni\theta}) = \operatorname{Re} \biggl(\frac{1 - e^{(n+1)i\theta}}{1 - e^{i\theta}}\biggr)$$
I've reached to this point, but now I don't know what to do. Any hint or idea?
 [/INST] Continue with
$$1 + e^{i\theta} + e^{2i\theta} + ... e^{ni\theta}=\frac{1 - e^{(n+1)i\theta}}{1 - e^{i\theta}}
=\frac{e^{\frac12(n+1)i\theta}}{e^{\frac12i\theta}}\cdot \frac{e^{-\frac12(n+1)i\theta} - e^{\frac12(n+1)i\theta}}{e^{-\frac12i\theta} - e^{\frac12i\theta}}
= e^{\frac12ni\theta} \frac{\sin\left(\frac{n + 1}2\theta\right)}{\sin(\frac{\theta}{2})}$$
Thus,
$$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = Re\left( e^{\frac12ni\theta}\frac{\sin\left(\frac{n + 1}2\theta\right)}{2\sin(\frac{\theta}{2})} \right) \\
\frac{\cos\left(\frac12n\theta\right)\sin[(n + \frac{1}{2})\theta]}{\sin(\frac{\theta}{2})}=\frac{\sin[(n + \frac{1}{2})\theta]+\sin(\frac{\theta}{2})}{2\sin(\frac{\theta}{2})}
=\frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})}+\frac12$$
Note that the term $\frac12$ is missing in the original expression.
</s>