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

32 Views Asked by At

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 \begin{equation} g(x) = x_1x_2 + x_1\bar{x_2} + x_1\bar{x_2} \end{equation} and for $N=3$, it translates to \begin{equation} 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. \end{equation} Note that the case of all zeros (i.e., $\bar{x}_1\bar{x}_2\bar{x}_3$) shouldn't be considered.

1

There are 1 best solutions below

3
On

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 $$