Find summation definition of a certain function Consider a tuple $T$ to be an object (list of numbers) similar to a row vector of $n$ elements which are real numbers: $$T=(x_{1}, x_{2},\ldots, x_{n}); n\in \Bbb N, x_{i}\in \Bbb R$$
A function $F$ can be defined from the tuples $T$ to $\Bbb R$ which takes the alternating sum of all possible products of $2$ elements. For example, for $n=3$:
$$F(T) = x_{1}x_{2}-x_{2}x_{3}+x_{3}x_{1}$$
and for $n=4$ $$F(T)=x_{1}x_{2}-x_{2}x_{3}+x_{3}x_{4}-x_{1}x_{3}+x_{2}x_{4}-x_{1}x_{4}$$
It is pretty obvious that the number of terms is $n \choose 2$ and if $n \choose 2$ is even, there are as much positive terms as there are negatives.
I came up with a faulty general definition that doesn't seem to get the signs properly:$$\sum^{n-1}_{k=1}\sum^{n-k}_{j=1}\left[(-1)^{j+1}*x_{k}*x_{k+j}\right]$$
This doesn't work because the signs on some of the elements are flipped. You are supposed to place the signs in that manner: you first take all products of neighboring elements and multiply by $-1$ each time, then the elements distance $1$ apart, then distance $2$ apart and so on. I am asking to correct me.
 A: We build multiplication tables of   $x_j\ast  x_k$  for small $n$ and check for a pattern of the signs. Since the pattern differs slightly for $n$ even and $n$ odd we consider $n=6$ and $n=7$.
Case $n=6$:
We  have in this case
\begin{align*}
&x_1x_2-x_1x_3+x_1x_4-x_1x_5+x_1x_6\\
&\qquad-x_2x_3+x_2x_4+x_2x_5-x_2x_6\\
&\qquad\qquad\quad\ +x_3x_4-x_3x_5-x_3x_6\\
&\qquad\qquad\qquad\qquad\  \ -x_4x_5+x_4x_6\\
&\qquad\qquad\qquad\qquad\qquad\qquad+x_5x_6
\end{align*}
The tables below give the signs of the  terms $x_j\ast  x_k$  and  the values $j+k  \mod 4$ which show a correlation to the plus and minus signs.
$$
 \begin{array}{c|cccccc|cccccc}
 \ast&x_2&x_3&x_4&x_5&x_6&\qquad\qquad\qquad\ast&x_2&x_3&x_4&x_5&x_6\\
 \hline
 x_1&+&-&-&+&+&\qquad\qquad\qquad x_1&3&0&1&2&3&\\
 x_2&&-&+&+&-&\qquad\qquad\qquad x_2&&1&2&3&0&\\
 x_3&&&+&-&-&\qquad\qquad\qquad x_3&&&3&0&1&\\
 x_4&&&&-&+&\qquad\qquad\qquad x_4&&&&1&2&\\
 x_5&&&&&+&\qquad\qquad\qquad x_5&&&&&3&
 \end{array}
$$

From the tables above we obtain for even $n$:
\begin{align*}
\sum_{{1\leq j<k\leq n}\atop{{j+k \equiv 2\ \mathrm{mod}\,(4)}\atop{j+k \equiv 3\ \mathrm{mod}\,(4)}}}x_jx_k
-\sum_{{1\leq j<k\leq n}\atop{{j+k \equiv 0\ \mathrm{mod}\,(4)}\atop{j+k \equiv 1\ \mathrm{mod}\,(4)}}}x_jx_k
=\color{blue}{\sum_{1\leq j<k\leq n}(-1)^{\left\lfloor\frac{1}{2}\left(j+k+2-4\left\lfloor\frac{j+k+2}{4}\right\rfloor\right)\right\rfloor}x_jx_k}
\end{align*}

Case $n=7$:
We  have in this case
\begin{align*}
&x_1x_2+x_1x_3-x_1x_4-x_1x_5+x_1x_6+x_1x_7\\
&\qquad-x_2x_3-x_2x_4+x_2x_5+x_2x_6-x_2x_7\\
&\qquad\qquad\quad\ +x_3x_4+x_3x_5-x_3x_6-x_3x_7\\
&\qquad\qquad\qquad\qquad\  \ -x_4x_5-x_4x_6+x_4x_7\\
&\qquad\qquad\qquad\qquad\qquad\qquad+x_5x_6+x_5x_7\\
&\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\ -x_6x_7\\
\end{align*}
The tables below give the signs of the  terms $x_j\ast  x_k$  and  the values $j+k  \mod 4$ which show a correlation to the plus and minus signs.
$$
 \begin{array}{c|ccccccc|ccccccc}
 \ast&x_2&x_3&x_4&x_5&x_6&x_7&\qquad\qquad\qquad\ast&x_2&x_3&x_4&x_5&x_6&x_7\\
 \hline
 x_1&+&+&-&-&+&+&\qquad\qquad\qquad x_1&3&0&1&2&3&0&\\
 x_2&&-&-&+&+&-&\qquad\qquad\qquad x_2&&1&2&3&0&1&\\
 x_3&&&+&+&-&-&\qquad\qquad\qquad x_3&&&3&0&1&2&\\
 x_4&&&&-&-&+&\qquad\qquad\qquad x_4&&&&1&2&3&\\
 x_5&&&&&+&+&\qquad\qquad\qquad x_5&&&&&3&0&\\
 x_6&&&&&&-&\qquad\qquad\qquad x_6&&&&&&1&
 \end{array}
$$

From the tables above we obtain for odd $n$:
\begin{align*}
\sum_{{1\leq j<k\leq n}\atop{{j+k \equiv 0\ \mathrm{mod}\,(4)}\atop{j+k \equiv 3\ \mathrm{mod}\,(4)}}}x_jx_k
-\sum_{{1\leq j<k\leq n}\atop{{j+k \equiv 1\ \mathrm{mod}\,(4)}\atop{j+k \equiv 2\ \mathrm{mod}\,(4)}}}x_jx_k
=\color{blue}{\sum_{1\leq j<k\leq n}(-1)^{\left\lfloor\frac{1}{2}\left(j+k+1-4\left\lfloor\frac{j+k+1}{4}\right\rfloor\right)\right\rfloor}x_jx_k}
\end{align*}

