Find probability of getting 1 and 0 (separately) in boolean expression (((x&x)^x)|x).

47 Views Asked by At

In this problem, I have to find probability of getting 1 and 0 in the boolean expression whose format has been shown above.

I have done this for two-variable like (x&x). In this, we will have a total of 4 choices. They are (0,0), (0,1), (1,0), and (1,1). From which we get P(1)=1/4 and P(0)=1/4.

But I am struggling at how can I generalize this for n terms like (((x&x)^x)&...|(x^x)) I have to represent the probability in P/Q format where gcd(P, Q)=1

Looking forward to your help. Thank You