10. [25] Let $P$ be a regular $k$-gon inscribed in a circle of radius 1 . Find the sum of the squares of the lengths of all the sides and diagonals of $P$.
Solution: Place the vertices of $P$ at the $k$ th roots of unity, $1, \omega, \omega^{2}, \ldots, \omega^{k-1}$. We will first calculate the sum of the squares of the lengths of the sides and diagonals that contain the vertex 1 . This is
$$
\begin{aligned}
\sum_{i=0}^{k-1}\left|1-\omega^{i}\right|^{2} & =\sum_{i=0}^{k-1}\left(1-\omega^{i}\right)\left(1-\bar{\omega}^{i}\right) \\
& =\sum_{i=0}^{k-1}\left(2-\omega^{i}-\bar{\omega}^{i}\right) \\
& =2 k-2 \sum_{i=0}^{k-1} \omega^{i} \\
& =2 k,
\end{aligned}
$$
using the fact that $1+\omega+\cdots+\omega^{k-1}=0$. Now, by symmetry, this is the sum of the squares of the lengths of the sides and diagonals emanating from any vertex. Since there are $k$ vertices and each segment has two endpoints, the total sum is $2 k \cdot k / 2=k^{2}$.