Sum $\cos x + \cos 2x + \cdots + \cos (n-1)x.$ [duplicate]

Find the sum of the series $$\cos x + \cos 2x + \cdots + \cos (n-1)x.$$ You must calculate the sum of this series only by multiplying through by $2\sin\left(\frac{x}{2}\right)$.

Now I've heard of finding the sum of a trig series by finding real and imaginary parts etc., but I have no idea how to do it this way.

• Hint: $\cos(ax) \sin(x/2) = \dfrac{\sin((a+1/2)x) - \sin((a-1/2)x)}{2}$ Dec 30, 2012 at 23:28

From the familiar identitiea $$\sin(A+B)=\sin A\cos B+\cos A\sin B$$ and $$\sin(A-B)=\sin A\cos B-\cos A\sin B$$ we obtain $$2\cos A\sin B=\sin(A+B)-\sin(A-B).$$ Set $B=\sin(x/2)$ and $A=\cos(kx)$. We get $$2\cos(kx)\sin(x/2)=\sin((k+1/2)x)-\sin((k-1/2)x).$$ Add up, $k=1$ to $k=n-1$. There is a lot of cancellation (telescoping) on the right. The only surviving part is $\sin((n-1/2)x)-\sin(x/2)$.
Remark: The method doesn't quite work if $\sin(x/2)=0$, but then finding the sum of the cosines is easy. The closed-form formula is "almost" right even for these $x$, in the sense that it has the right limit.
A similar trick, using the addition law for cosine, gives a closed-form expression for $\sin x+\sin 2x+\cdots+\sin((n-1)x$.