Andris Ambainis, Jānis Iraids, and Juris Smotrovs recently have obtained some interesting quantum query algorithms [AIS13]. In this blog post I will explain my understanding of their result.

Throughout the post I will consider a specific type of quantum query algorithms which I will refer to as **MCQ algorithms** (the origin of this name will become clear shortly). They have the following two defining features:

- they are
*exact*(i.e., find answer with certainty) - they measure after
*each*query

Quantum effects in an MCQ algorithm can take place only for a very short time — during the query. After the query the state is measured and becomes classical. Thus, answers obtained from two different queries do not interfere quantumly. This is very similar to deterministic classical algorithms that also find answer with certainty and whose state is deterministic after each query.

**Basics of quantum query complexity**

Our goal is to evaluate some (total) Boolean function on an unknown input string (we assume for convenience that binary variables take values +1 and -1). We can access only by applying oracle matrix

to some quantum state. The minimum number of queries needed to determine the value of with certainty is called the *exact quantum query complexity* of .

**Quantum questions with classical answers**

Each interaction with oracle in an MCQ algorithm can be described as follows:

- prepare some state
- apply query matrix
- apply some unitary
- measure in the standard basis

Intuitively, this interaction is a **quantum question** (specified by and ) which produces a classical answer (measurement outcome that appears with probability ).

Since each of the answers reveal some property of , it is convenient to identify the collection of these properties with the question itself (I think of it as a “quantum Multiple Choice Question”, hence **MCQ**). Of course, not every collection of properties constitutes a valid quantum question — only those for which there exists a corresponding and . (We will see some examples soon.)

**MCQ algorithms**

Simply put, an MCQ algorithm is a decision tree: each its leaf contains either 0 or 1 (the value of for corresponding ), and each of the remaining nodes contains a quantum question and children correspond to answers.

Classical deterministic decision trees are very similar to MCQ algorithms, except that their nodes contain classical questions — at each node we can only ask one of the variables . Quantumly, we have a larger variety of questions — for example, we can ask XOR of two variables (as in Deutsch’s algorithm). Another difference is that a quantum question does not have a unique answer: if several answers are consistent with the input string , we will get one of them at random.

An obvious question regarding MCQ algorithms is this:

How can we exploit the quantum oracle to find with less queries than classically?

Surprisingly, until recently essentially no other way of exploiting the quantum oracle was known, other than Deutsch’s XOR trick (see [MJM11] by Ashley Montanaro, Richard Jozsa, and Graeme Mitchison for more details). What is interesting about the [AIS13] paper is that it provides a new trick!

**Query, measure, recurse!**

All algorithms discussed in [AIS13] are MCQ and recursive. They proceed as follows:

- query
- measure
- recurse

In the last step, depending on the measurement outcome, either is found or the problem is reduced to a smaller instance and we proceed recursively. Let me explain how this works for two functions which I will call BALANCED and MAJORITY (they are special cases of EXACT and THRESHOLD discussed in [AIS13]).

**BALANCED**

iff exactly of the variables are equal to 1. An MCQ algorithm asks a quantum question that can reveal the following properties of the input string :

- is not balanced (the number of +1s and -1s is not equal)
- is not equal to (for some )

If we get the first answer then and we are done. If we get the second answer for some , we can ignore the variables and and recursively evaluate on the remaining variables. In total, we need at most queries (which can be shown to be optimal).

It remains to argue that the above is a valid quantum question. Alternatively, we can show how to prepare the following (unnormalized) quantum state:

(It lives in the space spanned by and for all .) This can be easily done by taking

and that acts as

To check that is a valid isometry, notice that it maps and to paths that overlap in exactly one cell (rows are labeled by and columns by ):

Since both states also have in common, they are orthogonal.

**MAJORITY**

iff at least of the variables are equal to 1. This time the quantum question has answers

- is not balanced when is omitted (for some )
- is not equal to (for some )

If we get the first answer for some , we omit and any other variable. If we get the second answer for some , we ignore the variables and . In both cases we proceed by recursively evaluating on the remaining variables. When only one variable is left, we query it to determine the answer. This requires at most queries in total (which again can be shown to be optimal).

The corresponding (unnormalized) state in this case is

(It lives in the space spanned by for all and for all .) It can be obtained by choosing

and acting as

One can check that is an isometry using a similar picture as above.

**Open questions**

The problem of finding a quantum query algorithm with a given number of queries and a given success probability can be formulated as a semi-definite program. This was shown by Howard Barnum, Michael Saks, and Mario Szegedy in [BSS03] and can be used to obtain exact quantum query algorithms numerically. Unfortunately, this approach does not necessarily give any insight of why and how the obtained algorithm works. Nevertheless, it would be interesting to know if there is a similar simple characterization of MCQ algorithms.

The algorithms from [AIS13] described above are relatively simple. However, that does not mean that they were simple to find. In fact, the SDP corresponding to had already been solved numerically in [MJM11]. Unfortunately, it did not provide enough insight to obtain an algorithm for for any . A similar situation is now with (which it is true if exactly two or four out of the six variables are true). From [MJM11] we know that it has an exact 3-query algorithm. Unfortunately, we do not have enough understanding to describe it in a simple way or generalize it. Besides, I wonder if has a 3-query MCQ algorithm, or do we actually need interference between the queries to find the answer so fast?

Finally, it would be interesting to know if there is any connection between exact quantum query algorithms and non-local games or Kochen–Specker type theorems.

Thanks for this nice blog post. One thing which I find particularly beautiful and intriguing about the algorithm of [AIS13] is the fact that it’s exact, but makes essential use of randomness throughout the algorithm. That is, the measurement results obtained are random, but the algorithm still succeeds with certainty. This highlights a potential mental blind spot (classically, such an algorithm cannot exist!) and makes me wonder whether this paradigm will be useful for the development of other exact quantum algorithms…

That’s a nice observation. I thought of the randomness as a hindrance, since the algorithm has to succeed despite the random measurement outcomes. (In fact, you could imagine the outcomes being deterministic but chosen adversarially). However, I think you are right — the algorithm actually exploits the randomness in an unusual way. It gambles so that it always wins!

Thanx for the great post. Loved your style of explanation. Truly ingenious algorithm.

Reblogged this on kryptomusing and commented:

For the paper “Exact quantum query complexity of EXACT and THRESHOLD” by Andris Ambainis, Jānis Iraids & Juris Smotrovs; Maris Ozols, on his blog has posted an excellent analysis of this paper.

Reblogged this on Observer.