Exact quantum query complexity of
Abstract
In the decision tree model, one’s task is to compute a boolean function on an input that is accessible via queries to a black box (the black box hides the bits ). In the quantum case, classical queries and computation are replaced by unitary transformations. A quantum algorithm is exact if it always outputs the correct value of (in contrast to the standard model of quantum algorithms where the algorithm is allowed to be incorrect with a small probability). The minimum number of queries for an exact quantum algorithm computing the function is denoted by .
We consider the following bit function with :
i.e. we want to give the answer 1 only when exactly or of the bits are 1. We construct a quantum query algorithm for this function and give lower bounds for it, with lower bounds matching the complexity of the algorithm in some cases (and almost matching it in other cases):

If and , then .

If , then .

For all : .
1 Introduction
In this paper we study the computational complexity of boolean functions in the quantum black box model. It is a generalization of the decision tree model, where we are computing an bit function on an input that can only be accessed through a black box by querying some bit of the input. In the quantum black box model the state of the computation is described by a quantum state from the Hilbert space where is the query subspace, is the working memory and is the output subspace. A computation using queries consists of a sequence of unitary transformations followed by a measurement, where the ’s are independent of the input and with
is the query transformation, where or equivalently, . The final measurement is a complete projective measurement in the computational basis and the output of the algorithm is the result of the last register, . We say that a quantum algorithm computes exactly if for all inputs the output of the algorithm always equals . Let us denote by the minimum number of queries over all quantum algorithms that compute exactly.
For quite a long time the largest known separation between the classical decision tree complexity and was only by a factor of two — the XOR of two bits can be computed exactly using only 1 quantum query[7, 8, 9]. However, in 2012 Ambainis gave the first asymptotic separation that achieved for a class of functions [1]. Next, in 2015 Ambainis et al. used pointer functions to show a near quadratic separation between these two measures: [2]. On the other hand Midrijānis has proved that the maximum possible separation between and is at most cubic [12].
However, the techniques for designing exact quantum algorithms are rudimentary compared to the bounded error setting. Other than the well known XOR trick — constructing a quantum algorithm from a classical decision tree that is allowed to “query” the XOR of any two bits — there are few alternate approaches. In addition to the asymptotic separations of [2, 1], Montanaro et al. [13] gave a 2 query quantum algorithm for the symmetric 4 bit function
and showed that it could not be computed optimally using the XOR trick. Afterwards Ambainis et al. gave an algorithm [3] for two classes of symmetric functions:
and the threshold function
For partial functions quantum algorithms with superpolynomial speedup are known [8, 6]. It seems that our work relates well to the results of Qiu and Zheng on partial functions based on the DeutschJozsa problem [14].
1.1 Our results
We consider exact quantum algorithms for symmetric total boolean functions, i.e., functions for which permuting the input bits does not change its value. For symmetric functions, the largest known separation remains a factor of 2. We know from von zur Gathen’s and Roche’s work on polynomials [10] and quantum lower bounds using polynomials [4] that for symmetric , thus the largest known separation is either optimal or close to being optimal.
However, many of the known exact algorithms are for symmetric functions (for example, XOR, EXACT and TH functions mentioned in the previous section). Because of that, we think that symmetric functions may be an interesting ground to explore new methods for developing more exact quantum algorithms.
In Section 3.1 we present an algorithm achieving up to for a certain class of symmetric functions
Definition 1.
Let for , be an argument symmetric boolean function that returns 1 if and only if the input contains exactly ones or exactly ones.
Let us denote by the separation between and : . In general a symmetric boolean function on input bits can be defined by a list such that . When it may be convenient to think of in this way. In this representation corresponds to lists of length with two 1s and the number of zeroes before the first, after the last 1, and distance between 1s correspond to parameters , , and respectively.
The boundary cases, and , have been solved previously. When , the function is usually referred to as . It can be solved with quantum queries using the wellknown XOR trick. The case is also known as the function which has been analyzed in [3] where it was shown that . In this paper, we completely solve the cases and partially solve the case and case.
The first of our results is
Theorem 1.
If , and , then for
The algorithm we provide in the proof works also when by padding the function. However, the algorithm is then only an upper bound on . For example, but our algorithm uses 3 queries for the padded version of the function (if we pad the input with two zeroes, we end up computing ). Furthermore, the computations by Montanaro et al. [13] suggest that and . There, unlike the case, we don’t know what the optimal algorithm looks like.
Next, we have a complete understanding of the case,
Theorem 2.
If , then
In particular, when and , we have and , meaning , giving us whereas the deterministic query complexity is , hence we exhibit a factor of 2 gap between and which is the largest known gap for a symmetric boolean function.
For larger values of , we provide an exact quantum algorithm and a lower bound that is 2 queries less than the complexity of the algorithm:
Theorem 3.
If , then
We conjecture that our lower bound is tight, i.e., that
Conjecture 1.
If , then
Interestingly, the algorithm of Theorem 3 can be used to compute a wide variety of symmetric functions with asymptotically optimal number of queries. Namely, we show
Theorem 4.
Let be a binary string with no 1s far from its center, i.e. there exists some such that . Then,
Since for any such function (except for one that is 0 on all inputs), we obtain a factor advantage for exact quantum algorithms for any such .
2 The lower bounds
2.1 Proofs of the lower bound theorems
Theorem 5.
If , then
Proof of Theorem 5.
Consider the function with ( is symmetric and gives the result in the theorem). If the first input bits are ones, a quantum algorithm computing must be computing on the remaining input bits. Next we proceed similarly as in the lower bound via polynomials for function[4]. There must exist a state which for is nonzero at the end of the computation. If the algorithm performs queries, then the amplitude of the state can be expressed as a degree multilinear polynomial in :
Let be the symmetric polynomial
Crucially, for the inputs :
By assigning we can obtain a polynomial that for all :
The polynomial is therefore nonzero on and zero on . Thus it is a nonzero polynomial of degree at least . On the other hand the degree of is at most . Thus . ∎
This lower bound is not tight when and . In this case we use a more sophisticated approach and give a different but possibly more insightful proof.
Theorem 6.
If , and , then for
Theorem 6 yields a lower bound that is better by one query than Theorem 5, which yields a lower bound of .
To show Theorem 6, we use an unpublished result by Blekherman.
Theorem 7 (Blekherman).
Let be the symmetrization of a polynomial where is a polynomial of degree . Then, over the Boolean hypercube ,
where is a univariate polynomial that is a sum of squares of polynomials of degree at most and denotes the number of variables .
See [11] for a proof of Blekherman’s theorem. Furthermore, we provide a considerably shorter proof in the next subsection.
Proof of Theorem 6.
Let us consider the negation of the function . Assuming, towards a contradiction, that there exists a quantum algorithm computing the function with queries, there exists a sum of squares representation of :
such that . Since the function is symmetric, the symmetrization is also a valid representation. Since , it follows from Blekherman’s theorem that there is a univariate polynomial of the form
(1) 
where on the Boolean hypercube and are sum of squares polynomials with . The polynomial is nonnegative in the interval . Since the polynomial is 0 at and , it must have at least 3 local extrema in the interval . Additionally, it is 1 when , hence it has more extrema. In total the polynomial has at least local extrema, therefore its degree is at least . On the other hand by our assumption which is a contradiction. ∎
2.2 Proof of Blekherman’s theorem
2.2.1 Group representation
Let be a Hilbert space with basis states (for all ) corresponding to monomials . Then, the vectors in correspond to multilinear polynomials in variables . We consider a group representation of the symmetric group on with transformations defined by . The irreducible representations contained in are well known:
Let be the elementary symmetric polynomial. We use to denote the constant 1.
Lemma 1.
A subspace is irreducible if and only if there exist and for such that is spanned by vectors corresponding to polynomials (for all choices of pairwise distinct ) where
and consists of all for , .
2.2.2 Decomposition of
Let
We associate with the matrix with rows and columns indexed by defined by . Let be a column vector consisting of all for . Then, . This means that is positive semidefinite.
For a permutation , let be the matrix defined by
and let be the average of all . Then, . is also positive semidefinite (as a linear combination of positive semidefinite matrices with positive coefficients).
We decompose with ranging over different nonzero eigenvalues and being the projectors on the respective eigenspaces. Since is positive semidefinite, we have for all .
We interpret transformations as permutation matrices defined by if and otherwise. Then, we have
Since we also have
we must have . This means that is a projector to a subspace that is invariant under the action of . If is not irreducible, we can decompose it into a direct sum of irreducible subspaces
Then, we have where is a projector to and . This means that we can decompose where and it suffices to show the theorem for one polynomial instead of the whole sum .
2.2.3 Projector to one subspace.
Let be an irreducible invariant subspace. We claim that the projection to the subspace denoted by is of the following form:
Lemma 2.
for some constant .
Proof.
If we restrict to the subspace , then is just the identity .
On the right hand side, is mapped to itself by any (since any permutes the vectors in some way). Therefore, all also map the eigenspaces of to themselves. This means that, if has an eigenspace , then acting on also form a representation of but that would contradict being an irreducible representation. Therefore, the only eigenspace of is the entire . This can only happen if is for some constant . ∎
2.2.4 Final polynomial
From the previous subsection, it follows that is a positive constant times
where is a symmetric polynomial of degree at most . Instead of the sum, we consider the expected value of when are chosen randomly. (Since the sum and the expected value differ by a constant factor, this is sufficient.)
Terms are nonzero if and only if one of and is and the other is . Then, for , we have
since there are possible sets and of them contain one and one . For ,
since the condition for means that, among the remaining variables, there are variables and variables and variables in total (and, given that, the argument applies). Thus,
Since is a symmetric polynomial, we have where is a polynomial of one variable , with equal to the number of variables . Since there are variables that do not appear in , we have . This means that can be rewritten as a polynomial in (instead of ).
3 The algorithms
In Section 3.1 we now provide the algorithm for (the algorithm part of Theorems 1 and 2) which we know to be optimal for with , and for and any . Next, in Section 3.4 we present the suboptimal algorithm that works for all , resulting in a general upper bound on (the algorithm part of Theorem 3). Throughout Section 3 we will refer to as the unbalance of the input or simply unbalance, in other words, the unbalance increases as the difference between ones and zeroes in the input increases. When , the condition is equivalent to requirement that the unbalance is , i.e., . Hence we will refer to as testing for unbalance .
3.1 The algorithm for unbalance
For the upper bound, we now provide a quantum algorithm for the case which can be extended to case. Let us introduce the function . When then and so and have the same parity.
Theorem 8.
We can compute for by reducing it to :
Lemma 3.
Proof.
For the case (, respectively) simply pad the input bits with ones ( zeroes, resp.) and run on the padded input. The complexity of the algorithm on the padded problem will be
∎
3.1.1 The structure of the algorithm
The algorithm of Theorem 8 will use two kinds of subroutines to calculate the function:

The main routine will start in a quantum state independent of the input and compute a instance;

The subroutine will require a precomputed state in the form
(2) here alludes to fact that the amplitude of the basis state is a sum of ’s.
Let us denote by the constant coefficient of the algorithm .
Let us denote by the number of queries performed by a subroutine S.
Lemma 4 (Recursive step for ).
The main routine will also be recursive and make use of .
Lemma 5 (Recursive step for ).
If there exists and with , then there exists such that
Now we are ready to prove Theorem 8:
Proof of Theorem 8.
We can draw the subroutine dependency graph like so:
Each subroutine performs one query and calls one of the subroutines in the dependency graph depending on the result of the measurement. Using Lemma 4 starting with an algorithm we can build chains of algorithms as long as . Notice that we may use multiple chains to cover all . Fortunately, as we will show for , a single infinite chain will suffice.
Then, using Lemma 5 we can build algorithms for all if we additionally have an initial base algorithm for . The query complexity of built in this way on a chain of starting at will have
Since is computing , it uses queries, so we can disregard , since and therefore . To finish the proof we now need to show that there exists a chain of starting at with and

When , we will have and show that . Since the function does not depend on input variables, there exists with using 0 queries.

When we will again have and . The subroutine is essentially required to compute starting in a nonnormalized state . If