# Sum of each combination

A notation question.

Let's say I have a group of $$N$$ elements. I want to pick $$n$$ elements within that group and make the following computation (let's assume $$N=3$$, $$n=1$$, and the elements are $$x_i$$, where $$i$$ is between $$0$$ and $$N$$): $$x_1\cdot(1-x_2)\cdot(1-x_3)+x_2\cdot (1-x_1)\cdot (1-x_3)+x_3\cdot(1-x_1)\cdot(1-x_2).$$ As you probably understand, when $$n=1$$ I pick one element from the group and multiply it with the "one minus" of all the rest in the group (which weren't picked). I do so for each combination.

Another example, for $$n=2$$, I would do: $$x_1\cdot x_2 \cdot (1-x_3) + x_1\cdot x_3 \cdot (1-x_2) + x_2\cdot x_3 \cdot (1-x_1).$$

I want to formulate it for a general $$N$$ and $$n$$. Obviously, there suppose to be a $$\sum$$, and then a multiplication between two groups of $$\prod$$, something like: $$\sum_{all-combinations}\left[\prod_{picked-elements}x_i\cdot \prod_{non-picked-elements}(1-x_j)\right].$$ The thing is that I do not know how to write the groups properly.

• Let $X$ be your group of $N$ elements. Define $P$ (short for pairs) to be the set of ordered pairs $P = \{(A,B)~:~A\cap B = \emptyset,~A\cup B = X,~|A|=n\}$. Your sum can then be written as $\sum\limits_{(A,B)\in P}\left(\prod\limits_{x\in A}x~\cdot~\prod\limits_{x\in B}(1-x)\right)$. There are surely other ways to write this, but this is just one of the first to come to my mind. Jan 4, 2019 at 23:21
I think the cleanest way is$$\sum_{\substack A\subseteq [N]\\|A|=n}\Bigg(\prod_{i\in A}x_i\Bigg)\Bigg(\prod_{i\in [n]\setminus A}(1-x_i)\Bigg),$$ where $$[N]=\{1,2,\dots,N\}$$.
• Thanks Mike, but I do not understand the relation between $[n]$ to the combinations. For example, for $N=4$ and $n=2$ the number of sum elements will be equal to ${4 \choose 2}=3$. So did you mean that $[n]$ contains all combinations? Jan 5, 2019 at 7:52
• My bad, ${4 \choose 2}=6$, but still more than $n=2$. Jan 5, 2019 at 8:45
• I had some mistakes which are fixed now. $A$ ranges over all subsets of the numbers $1$ to $N$ of size $n$. Jan 5, 2019 at 15:38