Finding the sum of $\cos\frac{\pi}{7}$, $\cos\frac{3\pi}{7}$, $\cos\frac{5π}{7}$ by first finding a polynomial with those roots 
Without using tables, find the value of $$\cos\frac{\pi}{7}+\cos\frac{3\pi}{7}+\cos\frac{5\pi}{7}$$

This is a very common high school trigonometric problem, and the usual way to solve this is by repeated application of trigonometric identities. But I thought of a bit different approach.

Somehow, if we can find a polynomial whose roots are the three terms of the above expression, then we can apply Vieta's formula to find the value. 

So please help me with it. (Any hint will be appreciated.)
 A: Using $$-1+2\sum_{n=1}^3\cos\frac{\pi n}{7}=\sum_{n=-3}^3\cos\frac{\pi n}{7}=\sum_{n=1}^7\cos\frac{\pi n}{7}=0,$$ we have $$\sum_{n\in\{1,\,3,\,5\}}\cos\frac{\pi n}{7}=\sum_{n=1}^3\cos\frac{\pi n}{7}=\frac{1}{2}.$$
A: If you insist on finding a polynomial, you can do it via Chebyshev polynomials.
These polynomials are defined by $T_n(\cos \theta)=\cos n\theta$, and can be generated through the recurrence relation:
$$T_0(x)=1\\ T_1(x)=x \\ T_{n+1}(x)=2xT_n(x)-T_{n-1}(x)$$
By going through this recurrence you can find that $T_7(x)=64x^7-112x^5+56x^3-7x$.
So for the cosines in this problem we have $T_7(\cos (k\pi/7))= \cos k\pi = -1$. This means that the cosines are roots of $f(x)=T_7(x)+1$.
$$f(x)=64x^7-112x^5+56x^3-7x+1=(x+1)(8x^3-4x^2-4x+1)^2$$
It is no surprise they are double roots or that $-1$ is a root too. Because of this you could actually do this factorization by hand, by taking the greatest common polynomial divisor $f$ and its derivative $f'$: $$\gcd(f(x),f'(x)) = \\
\gcd(64x^7-112x^5+56x^3-7x+1,\ 448x^6-560x^4+168x^2-7) =\\ 8x^3-4x^2-4x+1$$
using the Euclidean algorithm with polynomial long division.
In this way we can find the polynomial $8x^3-4x^2-4x+1$ which has exactly those three cosines as roots. Their sum is therefore $-\frac{-4}{8} = \frac{1}{2}$.
A: $\text{Using Complex Number}$
Let $z=e^{\frac{\pi i}{7}},$ so $z^7=-1.$ Let $Q$ be the desired quantity. Then
$$2Q=z+\frac{1}{z}+z^3+\frac{1}{z^3}+z^5+\frac{1}{z^5} = \frac{z^{10}+z^8+z^6+z^4+z^2+1}{z^5} = \frac{z^{12}-1}{z^5(z^2-1)}$$
$$=\frac{-z^5-1}{z^7-z^5} = \frac{-z^5-1}{-1-z^5} = 1$$ $$\therefore Q=\frac{1}{2}\ \ \square$$
A: Consider numbers: $$\omega_k=e^{i\frac{(2k-1)\pi}{7} }=\cos\left(\frac{(2k-1)\pi}{7}\right) + i \sin\left(\frac{(2k-1)\pi k}{7}\right), \qquad k=1,...,7.$$ 
Easy to see (De Moivre's formula) that $$w_k^7=e^{i(2k-1)\pi}=e^{i\pi}=-1, \qquad k=1,...,7.$$
So, all  $\omega_k$ are solutions of equation
$$
\omega^7-1 = 0.\tag{1}
$$
Denote unknown value $\omega$ as $\omega=\cos\alpha+i\sin\alpha$ (simply, $\omega = c+is$).
So:
$$
c^7 + i 7c^6s- 21 c^5s^2- i 35c^4s^3 + 35 c^3s^4 +i 21c^2s^5-7cs^6-is^7-1=0.
$$
Focusing on real part of the equation, we have
$$
c^7 - 21 c^5s^2 + 35 c^3s^4 -7cs^6+1=0.\tag{2}
$$
Now replace each $s^2$ with $(1-c^2)$:
$$
64c^7-112c^5+56c^3-7c+1=0.\tag{3}
$$
Knowing that $c=-1$ is one of solutions of equation $(3)$ and that $\cos\left(\dfrac{(2k-1)\pi}{7}\right)$ are double-solutions of eq. $(3)$ (I mean: $\cos \frac{\pi}{7}=\cos\frac{13\pi}{7}$, $\cos \frac{3\pi}{7}=\cos\frac{11\pi}{7}$, $\cos \frac{5\pi}{7}=\cos\frac{9\pi}{7}$), we can factor its LHS:
$$
\left(8c^3-4c^2-4c+1\right)^2(c+1)=0.
$$
Therefore, the equation for $\cos\left(\frac{\pi}{7}\right)$, $\cos\left(\frac{3\pi}{7}\right)$,$\cos\left(\frac{5\pi}{7}\right)$ has form
$$
8c^3-4c^2-4c+1=0.
$$
