1.1 Events and Probability

Exercise 1.1.1 (Exercise 1.6 [MU17]).

Consider the following balls-and-bin game. We start with one black ball and one white ball in a bin. We repeatedly do the following: choose one ball from the bin uniformly at random, then put the ball back in the bin with another ball of the same color. We repeat until there are n balls in the bin. Show that the number of white balls is equally likely to be any number between 1 and n−1.

Proof.

We rethink the behavior as: choose a color from the current balls in bin, and add one more ball with same color to the bin. Then we introduce a random variable Xn representing the number of white balls in the bin, where there are n balls in bin in total. The probability of k white balls among n balls can be represented by

Pr⁡[Xn=k] =Pr⁡[Xn=k∣Xn−1=k−1]⋅Pr⁡[Xn−1=k−1]
+Pr⁡[Xn=k∣Xn−1=k]⋅Pr⁡[Xn−1=k]
=k−1n−1⋅Pr⁡[Xn−1=k−1]+(1−kn−1)⋅Pr⁡[Xn−1=k].

By induction we can have that, the probability of Xn being k is 1/(n−1). ∎

Exercise 1.1.2 (Exercise 1.14 [MU17]).

Suppose I am playing in a tournament against a player never played before. Consider 3 probabilities for my prior model: we are equally talented, and each of us is equally likely to win each game; I am slightly better, and I win each game independently with probability 0.6; or he is slightly better, and he wins each game independently with probability 0.6. Before we play, I think that each of these 3 probabilities is equally likely.

In the match we play until one player wins three games. I win the second game, but he wins the first, third, and fourth. After this match, with what probability should I believe that my opponent is slightly better than I am?

Proof.

This is the Bayesian prior to posterior update.

Let E be the event that “I won the second and he won the first/third/fourth”.

Let C0 be the event that he is better, C1 be the event that I am better, C2 be the event that we are equally talented. Then C0,C1,C2 are disjoint events, with prior model on Ci being Pr⁡[Ci]=1/3. The posterior model on C0 is derived by the Bayes’ law

Pr⁡[C0∣E] =Pr⁡[E∣C0]⋅Pr⁡[C0]∑i∈[0,2]Pr⁡[E∣Ci]⋅Pr⁡[Ci]
=Pr⁡[E∣C0]∑i∈[0,2]Pr⁡[E∣Ci],

and each Pr⁡[E∣Ci]=pi⋅(1−pi)3, where pi is the probability of me winning a game preconditioned in Ci.

Therefore, the exact probability of he is better preconditioned that E happened is

Pr⁡[C0∣E]=0.63⋅0.40.63⋅0.4+0.54+0.43⋅0.6≈0.46.

∎

Exercise 1.1.3 (Exercise 1.18 [MU17]).

We have function F:[0,n−1]→[0,m−1], and we know F⁢((x+y)modn)=(F⁢(x)+F⁢(y))modm for x,y∈[0,n−1]. The only way we have for evaluating F is to use a lookup table that stores the values of F. An adversary changed the value of 1/5 of the table entries.

Describe a simple randomized algorithm that, given an input z, outputs a value that equals F⁢(z) with probability at least 1/2. The algorithm should be working for every z∈[0,n−1], regardless of what values the adversary changed. The algorithm should use as few lookups and as little computation as possible.

Suppose I allow you to repeat the initial algorithm three times, what is the probability of the enhanced version of algorithm returning the correct answer?

Proof.

This looks very much like BLR linearity testing [BLR93]. We construct a random function as follows:

  • •

    Sample α←r[0,n−1], and query F⁢(α) and F⁢((z+α)modn).

  • •

    Output (F⁢((z+α)modn)−F⁢(α))modm.

Since the error probability at a single query is 1/5, the probability of this algorithm giving right answer is lower bounded by 3/5≥1/2.

Now that the error probability of our algorithm is upper bounded by 2/5, if we repeat the algorithm 3 times, the algorithm returning none of them being correct has probability upper bounded by (2/5)3.

  • •

    The probability of existing a correct answer is lower bounded by 1−(2/5)3.

  • •

    If the majority are correct, then (3/5)3+3×(2/5)×(3/5)2≥81/125.

Try majority vote from 3 repetition as an enhanced version, then the correctness is lower bounded by 81/125. ∎