Example 3. Find the value of $\cos \frac{\pi}{7}+\cos \frac{3 \pi}{7}+\cos \frac{5 \pi}{7}$.
Let $\mathrm{z}=\cos \alpha+\mathrm{i} \sin \alpha$, then $\vec{z}=\cos \alpha-\mathrm{i} \sin \alpha$.
$$
\begin{array}{c}
\mathrm{z}^{\mathrm{n}}=\cos n \alpha+\mathrm{i} \sin n \alpha, \\
\mathrm{z}^{\mathrm{n}}=\cos n \alpha-\mathrm{i} \sin n \alpha .
\end{array}
$$

Adding and dividing by 2 gives
$$
\operatorname{cos} n \alpha=\frac{z^{n}+z^{n}}{2}=\frac{z^{2} n+1}{2 z^{n}} .
$$

Subtracting and dividing by $2 \mathrm{i}$ gives
$$
\sin n \alpha=\frac{z^{n}-z^{n}}{2 \mathrm{i}}=\frac{i\left(1-z^{2 n}\right)}{2 z^{n}} .
$$

When $\mathrm{z}=\cos \frac{\pi}{7}+\mathrm{i} \sin \frac{\pi}{7}$, $z^{7}=1$, $\mathrm{z}^{14}=1$.
From (A) we get
$$
\begin{aligned}
& \cos \frac{\pi}{7}+\cos \frac{3 \pi}{7}-\cos \frac{5 \pi}{7} \\
= & \frac{z^{2}+1}{2 z}+\frac{z^{6}+1}{2 z^{3}}+\frac{z^{10}+1}{2 z^{5}} \\
= & -\frac{1+z^{2}+z^{4}+z^{6}+z^{8}+z^{10}}{2 z^{5}} \\
= & \frac{1}{2 z^{5}} \cdot \frac{1-\left(z^{2}\right)^{8}}{1-z^{2}} \\
= & \frac{1}{2 z^{5}} \cdot \frac{z^{2}-z^{14}}{z^{2}\left(1-z^{2}\right)} \\
= & \frac{1}{2 z^{5}} \cdot \frac{z^{2}-1}{z^{2}\left(1-z^{2}\right)}=-\frac{1}{2 z^{7}} \\
= & -\frac{1}{2 \cdot(-1)}=\frac{1}{2} \cdot
\end{aligned}
$$