Question

For n≥2n \ge 2, let a∈{0,1}na \in \{0, 1\}^n be a non-zero vector. Suppose that xx is chosen uniformly at random from {0,1}n\{0, 1\}^n. Then, the probability that ∑i=1naixi\sum_{i=1}^{n} a_i x_i is an odd number is _______.

Official answer and solution
Official answer
0.5
From
Official GATE 2020 answer key

Solution

Condition on one coordinate where a_k = 1 to show the inner product modulo 2 is equally likely to be 0 or 1.

The sum ∑i=1naixi\sum_{i=1}^{n} a_i x_i is an integer. It is an odd number if and only if:

(∑i=1naixi)≡1(mod2)\left(\sum_{i=1}^{n} a_i x_i\right) \equiv 1 \pmod 2

Since a∈{0,1}na \in \{0, 1\}^n is a non-zero vector, there exists at least one index k∈{1,2,…,n}k \in \{1, 2, \dots, n\} such that ak=1a_k = 1.

Decompose the sum modulo 2:

S=akxk+∑i≠kaixi≡xk+∑i≠kaixi(mod2)S = a_k x_k + \sum_{i \ne k} a_i x_i \equiv x_k + \sum_{i \ne k} a_i x_i \pmod 2

Because xx is chosen uniformly at random from {0,1}n\{0, 1\}^n, the coordinate xkx_k is independent of all other coordinates {xi∣i≠k}\{x_i \mid i \ne k\}, with Pr⁡[xk=0]=Pr⁡[xk=1]=12\Pr[x_k = 0] = \Pr[x_k = 1] = \frac{1}{2}.

Conditioning on any fixed assignment of {xi∣i≠k}\{x_i \mid i \ne k\}, the partial sum ∑i≠kaixi(mod2)\sum_{i \ne k} a_i x_i \pmod 2 evaluates to some constant c∈{0,1}c \in \{0, 1\}. Then:

Pr⁡[S≡1(mod2)∣{xi}i≠k]=Pr⁡[xk≡1−c(mod2)]=12\Pr[S \equiv 1 \pmod 2 \mid \{x_i\}_{i \ne k}] = \Pr[x_k \equiv 1 - c \pmod 2] = \frac{1}{2}

By the law of total probability, the unconditional probability is 12=0.5\frac{1}{2} = 0.5.

Final answer

0.5

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2020 Computer Science and Information Technology (CS)
Question
55 of 65, printed as CS Q.45
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.