Why is $g = \sum_{k=1}^n $ $\sum_{l=1}^n cos(g_k-g_l)$ always non-negative?
g is the magnitude square of the complex-valued function, f, defined below, so it is , for sure, non-negative, but I have such a hard time accepting its non-negativity by looking at the current form of g. Is there a way to re-write g in such a way that it would be easy to see its non-negativity property?
$f= \sum_{k=1}^n e^{ig_k}$ is a complex-valued function where g_k is a real-valued function of k.
Then the magnitude square of the function $\ |f|^2 = \sum_{k=1}^n e^{ig_k} \sum_{l=1}^n e^{-ig_l}$ = $\sum_{k=1}^n $ $\sum_{l=1}^n e^{ig_k} e^{-ig_l}$ = $\sum_{k=1}^n $ $\sum_{l=1}^n cos(g_k-g_l)$
Therefore $\sum_{k=1}^n $ $\sum_{l=1}^n cos(g_k-g_l)$ >= 0 as it is the magnitude of a complex number.