TITLE: It is true that $\sum_{1 \leq n, m \leq N} \cos(a_n - a_m) \geq 0.$
QUESTION [5 upvotes]: I want to prove or find a counterexample of the following proposition:

Let $N$ be a positive integer and $a_1,\dotsc,a_N$ be distinct real numbers. Then it holds that:
  $$\sum_{1 \leq n, m \leq N} \cos(a_n - a_m) \geq 0.$$

For $N=1,2$ the result is obvious and for $N=3,4$ Wolfram Alpha affirms that the result is positive.
Can someone help me here?

REPLY [11 votes]: If we define $z$ as 
$$ z = \sum_{n=1}^{N}\exp(ia_n) $$
we may notice that
$$ z\overline{z} = \|z\|^2 = \sum_{1\leq m,n\leq N}e^{i(a_n-a_m)},\qquad \sum_{1\leq m,n\leq N}\cos(a_n-a_m)=\text{Re}\|z\|^2$$
and $\|z\|^2$ is obviously real and $\geq 0$.