# Is there a general formula for all the combinations of having at least a one in an N -tuple vector?

Let $$x$$=$$[x_1 x_2 ... x_N]$$, $$x_i \in \{0,1\}$$ and $$\bar{x}_i = 1-x_i; \forall i$$ and $$\sum_m^N x_m$$ not necessarily one (independent events)

I'm trying to mathematically formulate the function g($$x$$) for a general $$N$$.

For simplicity, let $$N=2$$ and the sum of the desired events should be as follows $$$$g(x) = x_1x_2 + x_1\bar{x_2} + x_1\bar{x_2}$$$$ and for $$N=3$$, it translates to $$$$g(x) = x_1x_2x_3 + x_1x_2\bar{x_3} + x_1\bar{x_2}x_3+ x_1\bar{x_2}\bar{x_3}+\bar{x}_1x_2x_3+ \bar{x}_1x_2\bar{x}_3+ \bar{x}_1\bar{x_2}x_3.$$$$ Note that the case of all zeros (i.e., $$\bar{x}_1\bar{x}_2\bar{x}_3$$) shouldn't be considered.

• If $\bar{x_i} = 0\; \forall i$ then why is your $N=2$ expression not just $g(x)=x_1x_2$? – Henry May 26 at 8:53
• My mistake, I edited the question. Thanks for your comment – Mostafa Talaat May 26 at 9:02

I think the expression you want is $$\prod_{i=1}^n (x_i + \bar{x_i}) -\prod_{i=1}^n \bar{x_i}$$ which simplifies to $$1-\prod_{i=1}^n \bar{x_i}$$ For example, with $$n=2$$, you get $$g(x) = (x_1+\bar{x_1})(x_2+\bar{x_2})-\bar{x_1}\bar{x_2} = x_1x_2+x_1\bar{x_2}+\bar{x_1}x_2 \qquad\qquad\qquad\;\;\;\,$$ or equivalently, $$g(x)=1-\bar{x_1}\bar{x_2} \qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\;\;\,$$ and for $$n=3$$, you get \begin{align*} g(x) &= (x_1+\bar{x_1})(x_2+\bar{x_2})(x_3+\bar{x_3})-\bar{x_1}\bar{x_2}\bar{x_3}\\[4pt] &= x_1x_2x_3 + x_1x_2\bar{x_3} + x_1\bar{x_2}x_3 + x_1\bar{x_2}\bar{x_3} + \bar{x_1}x_2x_3 + \bar{x_1}x_2\bar{x_3} + \bar{x_1}\bar{x_2}x_3 \\[4pt] \end{align*} or equivalently, $$g(x)=1-\bar{x_1}\bar{x_2}\bar{x_3} \qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad$$
• Thanks a lot! I am not sure about the simplification part, since $x_i;\forall i$ are independent – Mostafa Talaat May 26 at 9:30
• But $x_i+\bar{x_i}=1$, for all $i$. – quasi May 26 at 9:31