How to prove $\cos\left(\pi\over7\right)-\cos\left({2\pi}\over7\right)+\cos\left({3\pi}\over7\right)=\cos\left({\pi}\over3 \right)$

Is there an easy way to prove the identity?

$$\cos \left ( \frac{\pi}{7} \right ) – \cos \left ( \frac{2\pi}{7} \right ) + \cos \left ( \frac{3\pi}{7} \right ) = \cos \left (\frac{\pi}{3} \right )$$

While solving one question, I am stuck, which looks obvious but without any feasible way to approach.

Few observations, not sure if it would help
$$
\begin{align}
\dfrac{\dfrac{\pi}{7}+\dfrac{3\pi}{7}}{2} &= \dfrac{2\pi}{7}\\\\
\dfrac{\pi}{7} + \dfrac{3\pi}{7} + \dfrac{2\pi}{7} &= \pi – \dfrac{\pi}{7}
\end{align}
$$

Solutions Collecting From Web of "How to prove $\cos\left(\pi\over7\right)-\cos\left({2\pi}\over7\right)+\cos\left({3\pi}\over7\right)=\cos\left({\pi}\over3 \right)$"

Let $w = \cos \left ( \frac{2\pi}{7} \right ) + i\sin \left ( \frac{2\pi}{7} \right )$ so that $w^7 = 1$. Thus

$$\begin{align*}
w^7 – 1 &= 0\\
(w-1)(w^6 + w^5 + w^4 + w^3 + w^2 + w + 1) &= 0\\
w^6 + w^5 + w^4 + w^3 + w^2 + w + 1 &= 0 &&\text{since } w \ne 1\\
\left ( w^3 + w^{-3} \right ) + \left ( w^2 + w^{-2} \right ) + \left ( w + w^{-1} \right ) &= -1 &&\text{since } w \ne 0\\
\end{align*}$$

Since $w + w^{-1} = \cos \left ( \frac{2\pi}{7} \right ) + i\sin \left ( \frac{2\pi}{7} \right ) + \cos \left ( – \frac{2\pi}{7} \right ) + i\sin \left ( – \frac{2\pi}{7} \right ) = 2\cos \left ( \frac{2\pi}{7} \right )$, using de Moivre’s theroem:

$$\begin{align*}
2\cos \left ( 3\times \frac{2\pi}{7} \right ) + 2\cos \left ( 2\times \frac{2\pi}{7} \right ) + 2\cos \left ( \frac{2\pi}{7} \right ) &= -1\\
\cos \left ( \frac{6\pi}{7} \right ) + \cos \left ( \frac{4\pi}{7} \right ) + \cos \left ( \frac{2\pi}{7} \right ) &= -\frac{1}{2}= -\cos \left (\frac{\pi}{3} \right )
\end{align*}$$

Using $\cos(\theta) = -\cos \left (\pi – \theta \right )$:

$$-\cos \left ( \frac{\pi}{7} \right ) – \cos \left ( \frac{3\pi}{7} \right ) + \cos \left ( \frac{2\pi}{7} \right ) = -\cos \left (\frac{\pi}{3} \right )$$

And hence

$$\cos \left ( \frac{\pi}{7} \right ) – \cos \left ( \frac{2\pi}{7} \right ) + \cos \left ( \frac{3\pi}{7} \right ) = \cos \left (\frac{\pi}{3} \right )$$

Hint

  1. $$ \cos A + \cos B = 2 \cos \left( \dfrac{A + B}{2} \right) \cos \left( \dfrac{A – B}{2} \right) $$
  2. $$ \cos A – \cos B = – 2 \sin \left( \dfrac{A + B}{2} \right) \cos \left( \dfrac{A – B}{2} \right) $$
  3. $$ \cos \left( \dfrac{2 \pi}{7} \right) = \cos { \left( 2 \theta \right) } \tag{ $ \theta = \dfrac{\pi}{7}$ } $$
  4. $$ – \cos \left( \dfrac{2 \pi}{7} \right) = \cos { \left( \pi -\dfrac{2\pi}{7} \right) } = \cos { \left( \dfrac{5\pi}{7} \right) } $$