I was practising questions on principles on mathematics. I stumbled onto this question and I don't know where to start. Can anyone please help??
If $P_1\,P_2\,\ldots\,P_n$ is a regular polygon in the $(x,y)$-plane, each side of length $a>0$ (so the $P_i$ are the corners of an $n$-sided figure with sides of equal length $a>0$ ). Find the sum $$ S=\sum_{j=2}^{n}\;(\overline{P_1P_j})^2=(\overline{P_1P_2})^2 +(\overline{P_1P_3} )^2 +\ldots+(\overline{P_1P_n})^2 ; $$ here $\overline{P1 Pj}$ stands for the length of the line form the point $P_1$ to the point $P_j$ (your expression for $S$ will be a function of $a$ , $n$ and a well-known trigonometric function).
Exemple for $n=4$:


Hardmath's hint is excellent. You may also want to use (prove) that :
1) We can express
$$P_{k+1}=ae^{\frac{2k\pi i}{n}}\;\;,\;\;k=0,1,2,...,n-1$$
2) If $\,z_1=r_1e^{it_1}\,\,,\,z_2=r_2e^{it_2}\,$ , then
$$dist(z_2,z_2)=\overline{z_1z_2}=\sqrt{r_1^2+r_2^2-2r_1r_2\cos(t_2-t_1)}$$