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.

  • $\begingroup$ If $\bar{x_i} = 0\; \forall i$ then why is your $N=2$ expression not just $g(x)=x_1x_2$? $\endgroup$ – Henry May 26 at 8:53
  • $\begingroup$ My mistake, I edited the question. Thanks for your comment $\endgroup$ – 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 $$

  • $\begingroup$ Thanks a lot! I am not sure about the simplification part, since $x_i;\forall i$ are independent $\endgroup$ – Mostafa Talaat May 26 at 9:30
  • $\begingroup$ But $x_i+\bar{x_i}=1$, for all $i$. $\endgroup$ – quasi May 26 at 9:31
  • $\begingroup$ Thanks for the explanation, slipped my mind! $\endgroup$ – Mostafa Talaat May 26 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.