Prove that indicator function of integer numbers is positive semidefinite How to prove that the function $\mathbb{1}_{\mathbb{Z}}(x)$ is positive semidefinite? I.e. to show that for any $n = 2, 3, ...$  and $x_1, ..., x_n \in \mathbb{R}$, $z_1, ..., z_n \in \mathbb{C}$  
$$\sum_{i, j = 1}^n \mathbb{1}_{\mathbb{Z}}(x_i - x_j) z_i \bar z_j \ge 0$$ 
I thought about representing $\mathbb{1}_{\mathbb{Z}}(x)$  as the sum $\mathbb{1}_{\mathbb{Z}}(x) = \sum_{k \in \mathbb{Z} } \mathbb{1}_k(x)$, then if  $\mathbb{1}_k(x)$ is positive semidefinite, $\mathbb{1}_{\mathbb{Z}}(x)$ must be positive semidefinite too (as the limit). But for $\mathbb{1}_k(x)$, where $k \neq 0$ I cannot show positive semidefiniteness either.

Let $I$ be the set of all $j$ such that $x_1-x_j\in\mathbb{Z}$. Then the sum
$$\sum_{i,j=1}^{n}1_{\mathbb{Z}}(x_i-x_j)z_i\overline{z}_j$$
is equal to 
$$z_1\overline{z}_1+z_1\left(\sum_{i\in I}\overline{z}_i\right)+\overline{z}_1\left(\sum_{i\in I}z_i\right)+\text{ terms without }z_1$$ 
Observe that $\left(\sum_{i\in I}z_i\right)\left(\sum_{i\in I}\overline{z}_i\right)$ is already in the terms without $z_1$ part. The reason is that if $x_1-x_i\in\mathbb{Z}$ and $x_1-x_i\in\mathbb{Z}$ then $x_i-x_j=(x_1-x_j)-(x_1-x_i)\in\mathbb{Z}$. Therefore we can re-write the sum as
$$\left(z_1+\sum_{i\in I}z_i\right)\left(\overline{z}_1+\sum_{i\in I}\overline{z}_i\right)+\text{ other terms without }z_1$$
Denote $z_1':=z_1+\sum_{i\in I}z_i$ and the sum becomes $$z_1'\overline{z}_1'+\text{ terms without }z_1'$$ Repeat this procedure with the next variable, say $z_2$, appearing in the part of terms without $z_1'$. Eventually we get rid of all mixed terms and the sum looks like
$$\sum_i z_i'\overline{z}_i'=\sum_i|z_i'|^2\geq0$$
