Question

This problem concerns a straightforward generalization of the Deutsch problem discussed for functions with more than one bit as input. This time, we have a Boolean function f that takes a 4-bit number as input and outputs 0 or 1, i.e., f:{0,1}4→{0,1}. Thus, an input to f is one of 16 possible 4 bit binary numbers:

0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111.

We are also told that f is one of the following two types:

either f is a constant function, i.e., f(x) is the same for all 16 possible values of the input x, or
f is a balanced function, i.e., f(x) is 0 for exactly 8 of the possible 16 inputs and f(x) is 1 for the remaining 8 of the possible 16 inputs.

we are allowed to do is to use the circuit for f as a "black box" by giving an input x to the circuit for f and observing the output f(x). This is called a "query" operation.

Show that a classical probabilistic algorithm can determine if f is balanced or constant with probability at least 2/3 by using 2 queries.

Hint: (Obviously, we cannot do this using a deterministic algorithm. Unless the deterministic algorithm sees the output for at least 9 input values, there is no way for it to find out if the function is balanced or constant).

Think about picking the two inputs uniformly and randomly from the set of 16 possible inputs. Your final result could depend probabilistically on the result of these two queries.

Was it helpful?

Solution

EDIT: I had calculated some of my probabilities wrongly. Also I've now mentioned that we need to randomly pick 2 distinct inputs for the function f in order to guarantee that, if f is balanced, then we know the probabilities of seeing the various possible outcomes.

The fact that the prior probability of the function being constant is not known makes this question harder, because it means we can't directly calculate the probability of success for any algorithm. We will, however, be able to calculate bounds on this probability.

I propose the following probabilistic algorithm:

  • Pick two distinct 4-bit values at random, and supply each to the function f.
  • If 0,0 or 1,1 is seen, output "constant" with probability 2/3 and "balanced" with probability 1/3.
  • Otherwise (if 0,1 or 1,0 is seen), always report "balanced".

Let's start by looking at something we can actually calculate: conditional probabilities.

  1. "What is P(correct|constant), namely the probability that our algorithm gives the correct answer given that f is constant?" When f is constant, our algorithm reports the right answer 2/3 of the time.
  2. "What is P(correct|balanced), namely the probability that our algorithm gives the correct answer given that f is balanced?" When f is balanced, the probability of seeing 0,1 or 1,0 is 2*(8/16 * 8/15) = 8/15, in which case the correct answer will definitely be output. In the remaining 7/15 of cases -- i.e. those in which 0,0 or 1,1 is seen -- the correct answer will be output 1/3 of the time, so the total proportion of correct outputs will be 8/15 * 1 + 7/15 * 1/3 = 31/45 = 2/3 + 1/45 ≈ 0.6889.

Now suppose that the prior probability of the function being constant is p. Then the probability that the algorithm gives the correct answer is

pCorrect(p) = p*P(correct|constant) + (1-p)*P(correct|balanced).

Given that 0 <= p <= 1, pCorrect(p) must be at least min(P(correct|constant), P(correct|balanced)), and at most max(P(correct|constant), P(correct|balanced)). The minimum of 2/3 and 31/45 is 2/3, thus pCorrect is bounded from below at 2/3, for any prior probability of the function being constant. (It might help to think of p as a "mixing lever" that controls how much of each term to include. If p = 0 or p = 1, then we effectively just have P(correct|balanced) or P(correct|constant), respectively, and for any in-between value of p, we will have an in-between total.)

OTHER TIPS

Look at the probabilities for the different types of functions to return different results for two given values:

constant  0,0  50%
constant  1,1  50%
balanced  0,0  4/8 * 3/7 = 21,4%
balanced  0,1  4/8 * 4/7 = 28.6%
balanced  1,0  4/8 * 4/7 = 28.6%
balanced  1,1  4/8 * 3/7 = 21.4%

If the results are 0,0 or 1,1 there is a 70% chance that the function is constant, while for the results 0,1 and 1,0 the is a 100% chance that the function is balanced. So, for the cases that occur 71.4% of the time we are 70% certain, and the cases that occur 28.6% of the time we are 100% certain. By average we are 78.6% certain.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top