I was working on a book, which was asking me to prove that some product is equal to nn. I had reduced the problem to proving a trigonometric identity, but I couldn't prove it although I spent much time on it. Then, I checked the solution, and it solves the problem with a quite different approach that doesn't even enter to trigonometric expressions at all. But, still, this nice identity that I hadn't encountered before must be true then! I was wondering if people can think of a direct proof for that?
Show this following identity: $$\sum_{i=1}^{n-1}\left\{\left(\cos{\frac{2\pi}{n}}-\cos{\dfrac{2\pi i}{n}}\right)\left[\left(\sum_{j=1}^{n}x_{j}\cos{\dfrac{2ij\pi}{n}}\right)^2+\left(\sum_{j=1}^{n}x_{j}\sin{\dfrac{2ij\pi}{n}}\right)^2\right]\right\} $$$$=\left(1-\cos{\dfrac{2\pi}{n}}\right)\left(\sum_{i=1}^{n}x_{j}\right)^2+n\cos{\dfrac{2\pi}{n}}\sum_{i=1}^{n}x^2_{i}-n\sum_{i=1}^{n}x_{i}x_{i+1},$$ where $x_{i}\in \Bbb R$ and $x_{n+1}=x_{1}.$
This is an application of the Plancherel-Parseval identities of the isometry properties of the Fourier transform, here in finite dimension. Essentially, a properly scaled variant of the discrete Fourier transform is unitary.
One comes to the use of the Fourier transform as the second factor on the left side is the norm square of components of the discrete Fourier transform (DFT). Using the convention for the forward DFT $$ \hat x_m=\sum_{k=1}^nx_k\exp\left(-i\frac{2km\pi}{n}\right) =\sum_{k=1}^nx_k\cos\left(\frac{2km\pi}{n}\right) -i\sum_{k=1}^nx_k\sin\left(\frac{2km\pi}{n}\right) \tag{DFT} $$ the mentioned isometry is $$ n\langle {\bf x},{\bf y}\rangle =\langle {\bf \hat x},{\bf \hat y}\rangle. \tag{ISO} $$
The defining term in the claimed identity is the last one, which can be interpreted as scalar product of ${\bf x}$ with a shifted copy. Let $S$ be the left-shift operator, $(Sx)_i=x_{i+1}$, $(Sx)_n=x_1$, then the Fourier coefficients of it are $$ \widehat{(Sx)}_m =\sum_{k=1}^nx_{k+1}\exp\left(-i\frac{2km\pi}{n}\right) =\sum_{k=1}^nx_{k}\exp\left(-i\frac{2(k-1)m\pi}{n}\right) =\exp\left(i\frac{2m\pi}{n}\right)\,\hat x_m \tag1 $$ Thus we get for this last term $$ n\sum_{k=1}^nx_kx_{k+1}=n\langle {\bf x},S{\bf x}\rangle =\langle {\bf \hat x},\widehat{S{\bf x}}\rangle =\sum_{m=1}^n\cos\left(\frac{2m\pi}{n}\right)\,\left|\hat x_m\right|^2 \tag2 $$ This proves the non-trivial part of the claim.
All that remains is some window-dressing, essentially removing the outer terms of the last sum by using the identities $$ n\sum_{k=1}^nx_k^2=n\langle {\bf x},{\bf x}\rangle =\langle {\bf \hat x},{\bf \hat x}\rangle =\sum_{m=1}^{n-1}\left|\hat x_m\right|^2+\left(\sum_{k=1}^nx_k\right)^2 \tag3 $$ and $\hat x_0=\hat x_n=\sum_{k=1}^n x_k$.
In total the claimed identity is \begin{align} &\sum_{m=1}^{n-1}\left(\cos\left(\frac{2\pi}{n}\right)-\cos\left(\frac{2m\pi}{n}\right)\right)\,\left|\hat x_m\right|^2 \\ &=\cos\left(\frac{2\pi}{n}\right)\sum_{m=1}^{n-1}\left|\hat x_m\right|^2 -\sum_{m=1}^{n-1}\cos\left(\frac{2m\pi}{n}\right)\,\left|\hat x_m\right|^2 \\ &=\cos\left(\frac{2\pi}{n}\right)\left(\|\hat{\bf x}\|^2-|\hat x_n|^2\right) -\left(\langle {\bf \hat x},\widehat{S{\bf x}}\rangle-\left|\hat x_n\right|^2\right) \\ &=n\cos\left(\frac{2\pi}{n}\right)\sum_{k=1}^nx_k^2 +\left(1-\cos\left(\frac{2\pi}{n}\right)\right)\left(\sum_{k=1}^nx_k\right)^2 -n\sum_{k=1}^nx_kx_{k+1} \tag4 \end{align}