<s>[INST] Applying Euler's formula I try to solve the following task:
Show with Euler's formula (from complex analysis) that for $z\neq 2k\pi$ where $k\in\mathbb{Z}$ the following is true: $$\sum\limits_{v=0}^n \cos(vz) = \frac{1}{2}+\frac{1}{2}\frac{\sin(nz+\frac{z}{2})}{\sin \frac{z}{2}}$$
My attempt:
$$2\sum\limits_{v=0}^n \cos(vz) = 1+\frac{\sin(nz+\frac{z}{2})}{\sin \frac{z}{2}}$$
$$\sum\limits_{v=0}^n 2\cos(vz)-\sum\limits_{v=0}^n\frac{1}{n} = \frac{\sin(nz+\frac{z}{2})}{\sin \frac{z}{2}}$$
$$\sum\limits_{v=0}^n 2\cos(vz)\sin \frac{z}{2}-\frac{\sin \frac{z}{2}}{n} = \sin(nz+\frac{z}{2})$$
Now I tried using the sinus identity $$\sin ( x \pm y ) = \sin x \cos y \pm \cos x \sin y $$ on the term $\cos(vz)\sin \frac{z}{2}$ but It doesn't seem to make it easier nor help.
My second thought to write cosinus as a series doesn't look like it will help either:
$$2\sum\limits_{v=0}^n \sum_{m=0}^\infty (-1)^m\frac{(vz)^{2m}}{(2m)!} = 1+\frac{\sin(nz+\frac{z}{2})}{\sin \frac{z}{2}}$$
I also don't see where I can apply the Euler formula.
Thanks for help
 [/INST] $2\sum\limits_{v=0}^n \cos(vz) =\sum\limits_{v=0}^n (e^{ivz}+e^{-ivz}) = \frac{1-e^{(n+1)iz}}{1-e^{iz}}+\frac{1-e^{-(n+1)iz}}{1-e^{-iz}} = \frac{e^{\frac{n+1}{2}iz}}{e^{\frac{1}{2}iz}}(\frac{{e^{\frac{n+1}{2}iz}}-e^{\frac{-(n+1)}{2}iz}}{{e^{\frac{1}{2}iz}}-e^{\frac{-1}{2}iz}})+
\frac{e^{\frac{-(n+1)}{2}iz}}{e^{\frac{-1}{2}iz}}(\frac{{e^{\frac{n+1}{2}iz}}-e^{\frac{-(n+1)}{2}iz}}{{e^{\frac{1}{2}iz}}-e^{\frac{-1}{2}iz}}) = 
2\cos{(\frac{n}{2}z)}\frac{\sin{\frac{n+1}{2}z}}{\sin{\frac{1}{2}z}}=\frac{\sin(nz+\frac{1}{2}z)+\sin(\frac{z}{2})}{sin{\frac{z}{2}}} = 1+\frac{\sin(nz+\frac{z}{2})}{\sin \frac{z}{2}}$
</s>