Prove that $\frac{1}{2}+ \sum_{k=1}^n \cos (k\theta) = \sin((n+ \frac{1}{2})\theta)/2\sin\frac{\theta}{2}$ Suppose $\sin \frac{\theta}{2} \neq 0$ . Prove that
$$\frac{1}{2}+ \sum_{k=1}^n \cos (k\theta) = \frac{\sin[(n+ \frac{1}{2})\theta]}{2\sin\frac{\theta}{2}}$$
The question also give the hint,
$$z=\cos\theta + i\sin\theta = e^{i\theta}$$
$$\sum_{k=1}^n z^k = z + z^2 + \cdots + z^n = \frac{z(z^n-1)}{z-1}$$
What I did was to change z into polar form and applied double angle formula to remove $\cos\theta$, but I have no idea what to do after that and it is still $\sum_{k=1}^n z^k = \sum_{k=1}^n \cos(k\theta)+i\sin(k\theta)$, not exactly $\sum_{k=1}^n \cos(k\theta)$ that I am supposed to prove
 A: \begin{equation}
 \cos k \theta 
 =
 \frac{e^{jk\theta} + e^{-jk\theta}}{2}
\end{equation}
Let's use $\sum\limits_{k=0}^{N-1 }r^k= \frac{1-r^N}{1-r} $
\begin{equation}
 \sum \cos k \theta 
 =
 \frac{1}{2}
 \sum\limits_{k=1}^{N}
 e^{jk\theta} + 
 \frac{1}{2}
 \sum\limits_{k=1}^{N}
 e^{-jk\theta}
= 
\frac{1}{2}
\big(
 \frac{1 - e^{-j (N+1) \theta}}{1 - e^{j \theta}}-1 + 
 \frac{1 - e^{j (N+1) \theta}}{1 - e^{-j \theta}}-1
 \big)
\end{equation}
So
\begin{equation}
 \frac{1}{2}
 +
 \sum \cos k \theta 
 =
\frac{1}{2}
\big(
-1+
 \frac{1 - e^{j (N+1) \theta}}{1 - e^{j \theta}} + 
 \frac{1 - e^{-j (N+1) \theta}}{1 - e^{-j \theta}}
 \big)
\end{equation}
So
\begin{equation}
 \frac{1}{2}
 +
 \sum \cos k \theta 
 =
\frac{1}{2}
\big(
\frac{-(1-e^{j \theta})(1-e^{-j \theta})
+
(1 - e^{j (N+1) \theta})(1-e^{-j \theta})
+
(1 - e^{-j (N+1) \theta})(1-e^{j \theta})
}
{(1-e^{j \theta})(1-e^{-j \theta})}
 \big)
\end{equation}
that is 
\begin{equation}
 \frac{1}{2}
 +
 \sum \cos k \theta 
 =
\frac{1}{2}
\big(
\frac{
-2 + e^{j \theta}  + e^{- j\theta}
+
1 - e^{-j \theta} - e^{j (N+1) \theta} + e^{j N \theta}
+
1 - e^{j \theta} - e^{- j (N+1) \theta  }+ e^{-jN \theta}
}
{(1-e^{j \theta})(1-e^{-j \theta})}
 \big)
\end{equation}
that is 
\begin{equation}
 \frac{1}{2}
 +
 \sum \cos k \theta 
 =
\frac{1}{2}
\big(
\frac{
 - (e^{j (N+1) \theta} +e^{- j (N+1) \theta  })+ (e^{j N \theta}   + e^{-jN \theta})
}
{(1-e^{j \theta})(1-e^{-j \theta})}
 \big)
\end{equation}
i.e. 
\begin{equation}
 \frac{1}{2}
 +
 \sum \cos k \theta 
 =
\frac{1}{2}
\big(
\frac{
 - 2 \cos (N+1) \theta+ 2 \cos N \theta
}
{4 \sin^2 \frac{\theta}{2}}
 \big)
\end{equation}
Using $\cos a - \cos b = 2 \sin \frac{1}{2}(a+b) \sin \frac{1}{2} (b-a)$, we get
\begin{equation}
 \frac{1}{2}
 +
 \sum \cos k \theta 
 =
\frac{1}{2}
\big(
\frac{
4 \sin \frac{ \theta}{2}
\sin \frac{ \theta}{2} (2N + 1) 
}
{4 \sin^2 \frac{\theta}{2}}
 \big)
 =
 \frac{1}{2}
\frac{\sin \frac{ \theta}{2} (2N + 1) }{\sin \frac{ \theta}{2}}
\end{equation}
