GATE / CS ARCHIVE

GATE CSE 2020 / QUESTION 45

GATE CSE 2020 Q45

Discrete Mathematics · Probability & Random Variables · Full GATE CSE 2020 paper

GATE 2020, Q45 2 marks · NAT
Report issue

Probability & Random Variables

Question 45, GATE 2020: For n>2, a is a fixed nonzero vector in {0,1}^n and x is uniform in {0,1}^n. What is the probability that Σ a_i x_i is odd?
Tap to enlarge
Answer & solution

Official answer: 0.5

Worked explanation

View the sum modulo 2. Since a is nonzero, at least one coordinate j has coefficient 1. Fix every random bit except xj; those fixed bits determine some parity c. The remaining sum parity is c⊕xj. A uniform xj makes that result equally likely to be 0 or 1, regardless of c. Averaging over all choices of the other bits preserves probability 1/2. The pairing proof below is the equivalent combinatorial version. The nonzero hypothesis matters: if a were the zero vector, the sum would always be 0 and the probability would be 0.

Derivation and answer

Because a is nonzero, choose an index j with aj=1. Pair each vector x with the vector obtained by flipping only xj. This is a fixed-point-free bijection on all 2n equally likely inputs, and it reverses the parity of the dot product. Exactly half of the inputs yield an odd sum, so the probability is 1/2. The argument in fact works for any n≥1 with nonzero a.

Original paper, page 14 · Answer key