3

I am looking for a short way to write sums of combinations of $x_1,x_2,\ldots,x_n$ for a practical application. It can be easier explained using an example:

For $n=3$ there are $2^3=8$ combinations to sum $x_1,x_2,x_3$ using all signed combinations: $$C_3=-f\left(-x_1-x_2-x_3\right)+f\left(x_1-x_2-x_3\right)+f\left(-x_1+x_2-x_3\right)-f\left(x_1+x_2-x_3\right)+f\left(-x_1-x_2+x_3\right)-f\left(x_1-x_2+x_3\right)-f\left(-x_1+x_2+x_3\right)+f\left(x_1+x_2+x_3\right)$$ Every combination are summed arguments of a function $f$ and has a different sign sequence. The signs of $f$ are negative/positive if the number of negative signs in the arguments are odd/even.

For $n=4$ there are already $2^4=16$ combinations and it is quite ineffective to write them all down: $$C_4=f\left(-x_1-x_2-x_3-x_4\right)-f\left(x_1-x_2-x_3-x_4\right)-f\left(-x_1+x_2-x_3-x_4\right)+f\left(x_1+x_2-x_3-x_4\right)-f\left(-x_1-x_2+x_3-x_4\right)+f\left(x_1-x_2+x_3-x_4\right)+f\left(-x_1+x_2+x_3-x_4\right)-f\left(x_1+x_2+x_3-x_4\right)-f\left(-x_1-x_2-x_3+x_4\right)+f\left(x_1-x_2-x_3+x_4\right)+f\left(-x_1+x_2-x_3+x_4\right)-f\left(x_1+x_2-x_3+x_4\right)+f\left(-x_1-x_2+x_3+x_4\right)-f\left(x_1-x_2+x_3+x_4\right)-f\left(-x_1+x_2+x_3+x_4\right)+f\left(x_1+x_2+x_3+x_4\right)$$

It is clear that for higher $n$ a short notation is needed. I do not look for a program code.

  • After a closer look, it seems that I don't understand your definition of $C_n$. I thought the rule was that if there are an odd number of minus signs in the bracket, then the sign before it is also minus. But this doesn't match your expressions. Nevertheless both $C_3$ and $C_4$ are zero, so maybe you should still give an example of $n$ such that $C_n$ is nonzero. – WhatsUp Jan 09 '22 at 20:07
  • @WhatsUp An application was added in the OP. – granular_bastard Jan 10 '22 at 13:52

3 Answers3

3

We can write $C_n$, for every non-negative integer $n$, as $$C_n = \sum_{(s_1, s_2, \dots, s_n) \in \{-1, 1\}^n}s_1s_2\cdots s_n \cdot f\Big(s_1x_1 + s_2x_2 + \dots + s_nx_n\Big),$$ where $\{-1, 1\}^n := \Big\{(s_1, s_2, \dots, s_n) \mid s_i \in \{-1, 1\} \text{ for all positive integers } i \leq n\Big\}$.

The idea is to just use the "variables" $s_i$ to act as the signs.

For example, $\{-1, 1\}^3$ is defined to be $$\{(\color{red}{-1}, \color{red}{-1}, \color{red}{-1}), (\color{red}{-1}, \color{red}{-1}, \color{green}{+1}), (\color{red}{-1}, \color{green}{+1}, \color{red}{-1}), (\color{red}{-1}, \color{green}{+1}, \color{green}{+1}), (\color{green}{+1}, \color{red}{-1}, \color{red}{-1}), (\color{green}{+1}, \color{red}{-1}, \color{green}{+1}), (\color{green}{+1}, \color{green}{+1}, \color{red}{-1}), (\color{green}{+1}, \color{green}{+1}, \color{green}{+1})\},$$ so we have \begin{align*} C_3 = & \: (\color{red}{-1})(\color{red}{-1})(\color{red}{-1}) \cdot f\Big((\color{red}{-1})x_1 + (\color{red}{-1})x_2 + (\color{red}{-1})x_3\Big) \:+ \\ & \: (\color{red}{-1})(\color{red}{-1})(\color{green}{+1}) \cdot f\Big((\color{red}{-1})x_1 + (\color{red}{-1})x_2 + (\color{green}{+1})x_3\Big) \:+ \\ & \: (\color{red}{-1})(\color{green}{+1})(\color{red}{-1}) \cdot f\Big((\color{red}{-1})x_1 + (\color{green}{+1})x_2 + (\color{red}{-1})x_3\Big) \:+ \\ & \: (\color{red}{-1})(\color{green}{+1})(\color{green}{+1}) \cdot f\Big((\color{red}{-1})x_1 + (\color{green}{+1})x_2 + (\color{green}{+1})x_3\Big) \:+ \\ & \: (\color{green}{+1})(\color{red}{-1})(\color{red}{-1}) \cdot f\Big((\color{green}{+1})x_1 + (\color{red}{-1})x_2 + (\color{red}{-1})x_3\Big) \:+ \\ & \: (\color{green}{+1})(\color{red}{-1})(\color{green}{+1}) \cdot f\Big((\color{green}{+1})x_1 + (\color{red}{-1})x_2 + (\color{green}{+1})x_3\Big) \:+ \\ & \: (\color{green}{+1})(\color{green}{+1})(\color{red}{-1}) \cdot f\Big((\color{green}{+1})x_1 + (\color{green}{+1})x_2 + (\color{red}{-1})x_3\Big) \:+ \\ & \: (\color{green}{+1})(\color{green}{+1})(\color{green}{+1}) \cdot f\Big((\color{green}{+1})x_1 + (\color{green}{+1})x_2 + (\color{green}{+1})x_3\Big). \end{align*}

VTand
  • 2,789
  • @granularbastard You're referring to the definition of ${-1, 1}^n$? You can think of it as the set of all tuples of length $n$ whose elements are either $-1$ or $1$. So, for example, the set ${-1, 1}^3$ is defined to be $${(-1, -1, -1), (-1, -1, 1), (-1, 1, -1), (-1, 1, 1), (1, -1, -1), (1, -1, 1), (1, 1, -1), (1, 1, 1)}.$$ – VTand Jan 10 '22 at 12:09
  • is this a common definition or just your idea? – granular_bastard Jan 10 '22 at 12:12
  • @granularbastard I don't know if it's common or not, but I've seen this notation in some combinatorics papers such as this and this to denote the vertex set of the hypercube graphs. You can also think of them as $n$-ary Cartesian power. – VTand Jan 10 '22 at 12:19
2

Using $[n]:=\{1,2,\ldots,n\}$ we can write $C_n, n\geq 1$ as \begin{align*} \color{blue}{C_n=\sum_{S\subseteq [n]}(-1)^{\left|[n]\setminus S\right|}f\left(\sum_{j\in S}x_j-\sum_{j\in[n]\setminus S}x_j\right)}\tag{1} \end{align*}

Example: $n=3$: Following (1) we can write $C_3$ as \begin{align*} C_3&=(-1)^{\left|[3]\setminus[3]\right|}f(x_1+x_2+x_3)\\ &\qquad+(-1)^{\left|[3]\setminus\{1,2\}\right|}f(x_1+x_2-x_3) +(-1)^{\left|[3]\setminus\{1,3\}\right|}f(x_1+x_3-x_2)\\ &\qquad+(-1)^{\left|[3]\setminus\{2,3\}\right|}f(x_2+x_3-x_1)\\ &\qquad+(-1)^{\left|[3]\setminus\{1\}\right|}f(x_1-x_2-x_3) +(-1)^{\left|[3]\setminus\{2\}\right|}f(x_2-x_1-x_3)\\ &\qquad+(-1)^{\left|[3]\setminus\{3\}\right|}f(x_3-x_1-x_2)\\ &\qquad+(-1)^{\left|[3]\setminus\emptyset\right|}f(-x_1-x_2-x_3) \end{align*} in accordance with OP's stated $C_3$.

Markus Scheuer
  • 112,413
1

Based on @VTand's answer I think you can also write

$$C_n = \sum_{t_1, t_2, \dots, t_n = 0}^1 \epsilon^{t_1}\epsilon^{t_2}\dots \epsilon^{t_n} ~f\Big(\epsilon^{t_1}x_1 + \epsilon^{t_1} x_2 + \dots + \epsilon^{t_1} x_n\Big), $$ where $\epsilon = -1$. In relation to @VTand's example, we have:

\begin{align*} C_3 = & \: (\color{red}{-1})^{1}(\color{red}{-1})^{1}(\color{red}{-1})^{\color{blue}{1}} \cdot f\Big((\color{red}{-1})^{\color{blue}{1}}x_1 + (\color{red}{-1})^{\color{blue}{1}}x_2 + (\color{red}{-1})^{\color{blue}{1}}x_3\Big) \:+ \\ & \: (\color{red}{-1})^{\color{blue}{1}}(\color{red}{-1})^{\color{blue}{1}}(\color{green}{-1})^{\color{blue}{0}} \cdot f\Big((\color{red}{-1})^{\color{blue}{1}}x_1 + (\color{red}{-1})^{\color{blue}{1}}x_2 + (\color{green}{-1})^{\color{blue}{0}}x_3\Big) \:+ \\ & \: (\color{red}{-1})^{\color{blue}{1}}(\color{green}{-1})^{\color{blue}{0}}(\color{red}{-1})^{\color{blue}{1}} \cdot f\Big((\color{red}{-1})^{\color{blue}{1}}x_1 + (\color{green}{-1})^{\color{blue}{0}}x_2 + (\color{red}{-1})^{\color{blue}{1}}x_3\Big) \:+ \\ & \: (\color{red}{-1})^{\color{blue}{1}}(\color{green}{-1})^{\color{blue}{0}}(\color{green}{-1})^{\color{blue}{0}} \cdot f\Big((\color{red}{-1})^{\color{blue}{1}}x_1 + (\color{green}{-1})^{\color{blue}{0}}x_2 + (\color{green}{-1})^{\color{blue}{0}}x_3\Big) \:+ \\ & \: (\color{green}{-1})^{\color{blue}{0}}(\color{red}{-1}^{\color{blue}{1}})(\color{red}{-1})^{\color{blue}{1}} \cdot f\Big((\color{green}{-1})^{\color{blue}{0}}x_1 + (\color{red}{-1})^{\color{blue}{1}}x_2 + (\color{red}{-1})^{\color{blue}{1}}x_3\Big) \:+ \\ & \: (\color{green}{-1})^{\color{blue}{0}}(\color{red}{-1})^{\color{blue}{1}}(\color{green}{-1})^{\color{blue}{0}} \cdot f\Big((\color{green}{-1})^{\color{blue}{0}}x_1 + (\color{red}{-1})^{\color{blue}{1}}x_2 + (\color{green}{-1})^{\color{blue}{0}}x_3\Big) \:+ \\ & \: (\color{green}{-1})^{\color{blue}{0}}(\color{green}{-1})^{\color{blue}{0}}(\color{red}{-1})^{\color{blue}{1}} \cdot f\Big((\color{green}{-1})^{\color{blue}{0}}x_1 + (\color{green}{-1})^{\color{blue}{0}}x_2 + (\color{red}{-1})^{\color{blue}{1}}x_3\Big) \:+ \\ & \: (\color{green}{-1})^{\color{blue}{0}}(\color{green}{-1})^{\color{blue}{0}}(\color{green}{-1})^{\color{blue}{0}} \cdot f\Big((\color{green}{-1})^{\color{blue}{0}}x_1 + (\color{green}{-1})^{\color{blue}{0}}x_2 + (\color{green}{-1})^{\color{blue}{0}}x_3\Big). \end{align*}

Thoth
  • 975