Query Complexity
Query complexity counts how many times an algorithm must consult an unknown input. It separates the cost of obtaining information from the work between consultations. This makes it possible to prove clean quantum–classical comparisons, provided both algorithms solve the same promised problem with the same access and error requirements.
Two examples guide this page. Parity needs all bits classically but only quantum queries. Deciding whether an -bit input contains no one or exactly one one requires randomized queries and quantum queries at constant bounded error. These counts do not include building the oracle or implementing the intervening gates.
Helpful background. Quantum oracles defines the access operations being counted. Algorithmic primitives explains how coherent queries combine with interference and readout.
Querying bits of a promised input
Section titled “Querying bits of a promised input”Let be the valid input set. A function specifies one answer ; a relation specifies a nonempty set of valid answers. A promise restricts correctness to .
Our oracle is the complete bit-query unitary
The answer register is one bit and is workspace. The action is defined for every Boolean string, including strings outside the promise. A classical query returns ; a quantum query may act on a superposition of indices. Preparing the answer in gives the phase with one call. Preparing it in gives no change. Also , so an inverse call has the same query cost here. These properties are specific to this oracle, not universal properties of unknown unitaries.
A -query quantum algorithm has the form
with input-independent unitaries and a final measurement. Intermediate measurements can be deferred by recording their outcomes coherently. A branch that stops early can be padded to a fixed cap: route its answer register through a spare during an inactive query, then restore the routing. Thus no extra unknown controlled oracle is assumed in this bit-query representation.
The abstract model allows arbitrary input-independent processing between queries. A small query count therefore need not imply an efficiently synthesizable circuit, small memory or short runtime. Parallel queries, query rounds and sequential calls are also different measures.
Deterministic, randomized and quantum measures
Section titled “Deterministic, randomized and quantum measures”Every measure in this table uses a worst-case fixed query cap. The success requirement applies to every promised input.
| Measure | Allowed procedure | Required output |
|---|---|---|
| Deterministic decision tree | Always valid | |
| Random choice of capped decision trees | Valid with probability at least | |
| Quantum procedure | Valid with probability one | |
Quantum procedure with an extra ? outcome |
Never wrong when conclusive; ? probability at most |
|
| Quantum procedure | Valid with probability at least |
Usually . Exact finite counts can depend on this choice. For a Boolean answer, independent repetition and majority voting reduce any fixed error below at constant-factor cost. A relation can have several different valid outputs, so majority voting needs a separate justification or a verifier.
Zero error allows uncertainty, not false answers. Repeating a capped procedure until it concludes has worst-input expected cost at most twice its cap. Conversely, an always-correct stopping procedure with worst-input mean cost can be cut off at queries and made to return ? thereafter. Markov’s inequality bounds that inconclusive probability by . The zero-cost case is already trivial. Expected stopping cost and fixed-cap cost are related, but their finite values are not identical. Literature notation for zero error varies, so check its definition before comparing results.
Classical lower bounds from hard distributions
Section titled “Classical lower bounds from hard distributions”A deterministic decision tree branches on previously observed bits. To lower-bound a randomized algorithm, Yao’s minimax principle lets us choose an input distribution that is difficult for every capped deterministic tree.
For finite input and output sets, let be the deterministic trees of depth at most and their zero-or-one error. Then
where ranges over distributions of trees and over promised inputs. The left side is optimal worst-case randomized error; the right side is optimal deterministic error against the hardest distribution. This equality holds at fixed depth. It is not an unchanged formula for arbitrary expected-cost stopping rules.
For parity, use the uniform distribution on all bit strings. If even one coordinate remains unread, its conditional value is fair and flips the parity. Any tree with fewer than queries therefore errs with probability . Consequently for .
Polynomial lower bounds
Section titled “Polynomial lower bounds”Initially, each quantum amplitude is independent of . One bit query expresses a new amplitude as old amplitudes multiplied by or , increasing degree by at most one. Input-independent unitaries only take linear combinations. After queries, amplitudes are polynomials of degree at most .
A measurement-event probability is a sum of products of amplitudes and their conjugates, so it has degree at most . Replacing by gives a multilinear polynomial with the same values on Boolean inputs. This is the Beals–Buhrman–Cleve–Mosca–de Wolf polynomial method.
For a partial Boolean function, let be the minimum degree matching exactly on , and let be the minimum degree approximating it within there. We impose no off-promise condition on these arbitrary approximants. An actual probability polynomial is more constrained: it lies in on the full cube because the algorithm is defined there. Nevertheless the weaker degrees give valid bounds:
For a relation, retain one probability polynomial for each output. Correctness is , alongside nonnegativity and normalization. There need not be a single input-independent acceptance event.
Parity: a matching algorithm and lower bound
Section titled “Parity: a matching algorithm and lower bound”The parity polynomial is
Its degree is . Approximation within any still requires degree . To see this, write and suppose approximates parity. Then obeys , so at every input. But every degree-less-than- multilinear polynomial is orthogonal to the full parity character under the uniform distribution. Its average product with must be zero, a contradiction.
One quantum query can recover the parity of a pair. Prepare the index state and answer . After the query, measure the index in the plus/minus pair basis:
Equal bits give the plus outcome; different bits give the minus outcome. Pair the coordinates and query a leftover bit when is odd. This constructs an exact algorithm using calls, matching the degree lower bound.
A zero-error procedure can be converted to a -error Boolean procedure by replacing ? with a fair bit. Thus the same lower bound applies to , and
For , two pair queries give the final parity. For example, input 1011 gives pair parities 1 and 0, hence total parity 1. This is a constant-factor query improvement over the classical value four, not a change in asymptotic order.
Adversary bounds from distinguishability
Section titled “Adversary bounds from distinguishability”An adversary matrix places weights between inputs requiring different answers. For a nonconstant Boolean function , choose a nonzero Hermitian matrix indexed by with whenever . Let
The negative-weight adversary bound is
The symbol denotes entrywise multiplication. The original positive adversary bound restricts to real, entrywise nonnegative matrices. “Positive” here does not mean positive semidefinite. Constant functions have adversary bound zero by convention.
For Boolean output and , the Høyer–Lee–Špalek bound gives
At this prefactor is . It is a valid, generally loose constant; it does not turn a matrix ratio into an exact finite query count. The more powerful tightness result is , including partial Boolean functions. Neither statement concerns exact-query complexity or gate implementation cost.
The intuition is that different inputs initially produce the same algorithm state. A successful algorithm must eventually distinguish inputs with different answers. The denominator bounds the progress obtainable from one coordinate query, while the numerator measures the total distinction to be achieved. Hybrid arguments follow related state-distance changes directly, as in the Bennett–Bernstein–Brassard–Vazirani search lower bound. A final-information bound such as Holevo’s theorem is not by itself a per-query bound; one still needs to relate progress to individual calls.
A star matrix for promised search
Section titled “A star matrix for promised search”Take the no-mark-versus-one-mark decision promise
The star matrix connecting to every is
On the span of the center and uniform leaf vector, it acts as ; it vanishes on the remaining leaf combinations. Its norm is therefore . Filtering with retains only the center– edge, whose norm is one. The ratio proves an lower bound. Grover search followed by candidate verification gives the matching upper order.
At , the star ratio is four. Independently, three Grover iterations followed by one ordinary bit query to verify the measured candidate give a four-query upper bound: success is on a one-mark input and one on the all-zero input. The numerical agreement with the star ratio does not prove that four is the optimum; the adversary theorem includes a prefactor.
Classically, for this finite promise. Query eight uniformly chosen distinct positions, return 1 after a hit, and otherwise return 1 with probability . Its error is on both input types.
For the lower bound at a proposed cap , give weight and spread the remaining probability uniformly over the marks. A deterministic tree can learn only a hit or an all-negative transcript. Querying distinct positions is at least as informative as stopping earlier or repeating positions. On the negative transcript, guessing 1 errs on the all-zero input with total probability , while guessing 0 misses the unqueried marks with total probability
Thus every such tree has average error greater than . Yao’s principle rules out randomized depth too. The hard distribution may depend on the candidate depth.
Reductions, composition and existence of algorithms
Section titled “Reductions, composition and existence of algorithms”Restricting the input promise transfers a lower bound to a larger problem under the same oracle and output definition. A more general reduction must count each call used to simulate the other interface and preserve correctness and error.
For partial Boolean and , use disjoint -bit blocks and the full composed domain of block inputs in whose -outputs lie in . Then
Kimmel’s Appendix A treats the partial-function issue explicitly. Tightness implies bounded-error Boolean query composition up to constants. Arbitrarily restricting the composed domain can make the task easier, and overlapping blocks, relations or many-bit queries require separate results.
An upper bound can follow from an explicit algorithm or from a nonconstructive existence proof. Adversary tightness and composition can establish that a query algorithm exists without furnishing its useful circuit; Kimmel gives examples of this distinction. If an explicit implementation is claimed, its schedule, repetitions, verification and nonquery work must still be supplied. A bare oracle theorem neither resolves BQP versus BPP nor gives a physical speedup.
For concrete separations, continue with Deutsch–Jozsa, Bernstein–Vazirani and Simon, whose promises and query units differ. Lower bounds and limitations discusses input/output and runtime barriers beyond query counts.
Exercises
Section titled “Exercises”Classify the model and currency
Section titled “Classify the model and currency”A bounded-error procedure uses 40 oracle calls arranged in ten sequential rounds. Each oracle call is synthesized with 800 logical gates and coherent depth 120; nonquery processing adds 12,000 gates, depth 900, 70 nonquery ancillas, and 500 classical operations. State which numbers are query count, rounds, gates, depth, memory, and classical work. Which runtime or hardware conclusions follow without an additional conversion model?
Solution
The query count is 40 and the query-round count is 10. Oracle synthesis contributes
logical gates, so the total logical-gate count is . If each round contains four oracle calls that genuinely run in parallel, oracle depth contributes rather than ; including nonquery depth gives . That depth conclusion depends on the stated parallel-access license and scheduling assumption. The nonquery workspace uses 70 ancillas; any additional oracle workspace and the data register must be included before claiming a total memory requirement. The reported classical work is 500 operations.
No wall-clock time, physical-qubit count, error-correction overhead, energy cost, or hardware advantage follows. Those claims require gate durations, connectivity and routing, code parameters, factory and control costs, memory construction, readout, and a matched classical implementation. Even the depth total would change if the four calls in a round contend for one oracle implementation.
Exact, zero-error, or bounded-error?
Section titled “Exact, zero-error, or bounded-error?”Classify three fixed-cap contracts: (a) the algorithm always outputs the unique correct bit within 25 queries; (b) within 25 queries it outputs the correct bit or ?, never a wrong bit, and ; (c) within 25 queries it always outputs a bit and is correct with probability at least . Explain why ? is not an error of the same kind as an incorrect bit.
Solution
Contract (a) is exact and establishes . Contract (b) is zero-error under this page’s conclusive/inconclusive fixed-cap convention and establishes . Contract (c) is bounded-error with and establishes .
An incorrect bit asserts a false answer and contributes directly to the error probability. The symbol ? certifies no answer at all. Because a zero-error procedure never lies when it concludes, it can be repeated or combined with a stopping rule; the cost of the inconclusive branches must then be counted. Replacing ? by a random bit can convert a Boolean zero-error routine to an ordinary bounded-error one, but it changes the output contract.
Amplification pays for every call
Section titled “Amplification pays for every call”A Boolean decision procedure uses queries and has independent-run error probability on every promised input. Repeat it an odd number of times and return the majority bit. Derive a constant-error guarantee, count the queries, and name the independence assumptions. Why is the same rule not automatic for a relation?
Solution
Let indicate an error on run . With fresh workspace, fresh measurements, and independent random seeds or independent preparations, the are independent Bernoulli variables with means at most . Majority fails only if . Hoeffding’s inequality gives
Choosing any odd
up to rounding makes the error at most . The amplified procedure uses exactly oracle calls; repetitions do not make the base queries free.
For a general relation, several different outputs may all be valid for the same input, so a bitwise or plurality majority need not return any valid output. Amplification requires an output-combining rule whose validity is proved, or a verifier whose own queries and error are included.
Degree of an acceptance polynomial
Section titled “Degree of an acceptance polynomial”Prove that a -query bit-oracle algorithm has final event probabilities of degree at most . Include the distinction between a partial-domain approximation and the full-cube probability polynomial, and explain the modification for relation outputs.
Solution
Initially each basis amplitude is constant in . In a complete bit query, an output amplitude is assembled from an old amplitude multiplied by either or , so one call raises degree by at most one. An input-independent unitary forms fixed linear combinations and does not raise degree. Induction gives complex amplitudes of degree at most .
A measurement-event probability is a sum of terms , hence has real degree at most . On Boolean inputs, replacing every with makes it multilinear without changing its values. For a partial function, an approximate-degree witness need only approximate on under the convention used here; no off-promise bound is imposed on an arbitrary approximant. An actual event probability nevertheless remains in on the full cube because it comes from a fully defined algorithm.
For a relation, use one polynomial for each output. They obey nonnegativity and , while correctness is the joint constraint on . There may be no single input-independent “accept” event.
Exact four-bit parity
Section titled “Exact four-bit parity”Reconstruct the two pair-parity queries, enumerate all sixteen inputs, and use degree four for the matching lower bound. State the exact, zero-error, and fixed-bounded-error values.
Solution
For a pair , prepare . One bit query produces the plus pair-basis state when and the minus state when it is 1. Query and and XOR those two certain outcomes.
For each of the sixteen inputs, the XOR of the two pair outputs equals the XOR of all four bits. Its real multilinear polynomial has degree four; its approximate degree is also four for every fixed error below . The degree- bound gives , matching the construction. Replacing a zero-error routine’s ? by a fair bit gives error at most , so the same lower bound applies. Therefore
for every fixed .
Star adversary matrices
Section titled “Star adversary matrices”For the no-mark-versus-one-mark promise, compute the eigenvalues of the star witness and the norm of every coordinate-filtered matrix for and . State precisely what the resulting ratios prove.
Solution
Let be the center and the uniform leaf vector. The star matrix satisfies
and annihilates the leaf vectors orthogonal to . Its spectrum is therefore and its norm is .
For each , keeps only the center– edge. Its nonzero block is
with eigenvalues , so every filtered norm equals one. At , the witness norm and ratio are 2; at , they are 4.
The adversary theorem turns these ratios into a bounded-error quantum lower bound with its theorem-dependent constant, and the family gives the scale. The ratios do not assert exact optimal query counts 2 and 4, do not supply the upper-bound search procedure, and say nothing by themselves about gates or runtime.
Restriction, reduction, and Boolean block composition
Section titled “Restriction, reduction, and Boolean block composition”Assess three proposed transfers: (a) restrict total OR to inputs of Hamming weight at most one; (b) compose partial Boolean and on disjoint blocks, using every block input in whose -output string lies in ; (c) replace a relation on overlapping blocks accessed by a many-bit value oracle with the Boolean block product theorem. Which retain the hypotheses needed by the result?
Solution
Proposal (a) is a valid restriction for a lower bound. Any algorithm solving total OR under the same bit-query, output, and error convention also solves the promised subset, so a lower bound for that subset transfers to total OR.
Proposal (b) uses the full compatible composed domain and satisfies the Boolean block hypotheses. An additional promise restricting those block inputs would require a new argument. With , disjoint blocks, and , one may use
Adversary tightness then gives fixed-bounded-error query composition up to constants.
Proposal (c) does not satisfy the theorem’s hypotheses: the output is a relation, blocks overlap, and the query unit is a many-bit value call rather than the specified coordinate bit call. It needs a separately proved composition or reduction that charges the interface simulation and preserves valid outputs and error. The Boolean product equality cannot simply be imported.
Separate a search upper bound from its witness
Section titled “Separate a search upper bound from its witness”For the no-mark-versus-one-mark decision problem, explain why three Grover queries plus one verification query give bounded error below . Compare this upper bound with the star ratio four and the exact classical fixed-cap value eight. Does the star witness prove optimality of the four-query algorithm?
Solution
On a one-mark input, three Grover iterations produce the marked index with probability . Verification outputs 1 exactly when that candidate is marked. On the all-zero input it always outputs 0, regardless of the measured candidate. Thus the worst error is about with a cap of four calls.
The star ratio is also four, but the displayed adversary lower bound is that ratio times a prefactor, not four itself. It proves an asymptotic square-root lower bound across the family, not this finite optimum. The classical result eight follows from the separate matching randomized construction and hard-distribution argument above.
References
Section titled “References”- A. Ambainis, “Quantum Lower Bounds by Quantum Arguments,” Journal of Computer and System Sciences 64, 750–767 (2002), doi:10.1006/jcss.2002.1826.
- R. Beals, H. Buhrman, R. Cleve, M. Mosca, and R. de Wolf, “Quantum Lower Bounds by Polynomials,” Journal of the ACM 48, 778–797 (2001), doi:10.1145/502090.502097.
- C. H. Bennett, E. Bernstein, G. Brassard, and U. Vazirani, “Strengths and Weaknesses of Quantum Computing,” SIAM Journal on Computing 26, 1510–1523 (1997), doi:10.1137/S0097539796300933.
- H. Buhrman, R. Cleve, R. de Wolf, and C. Zalka, “Bounds for Small-Error and Zero-Error Quantum Algorithms,” in Proceedings of the 40th Annual Symposium on Foundations of Computer Science, 358–368 (1999), doi:10.1109/SFFCS.1999.814607.
- E. Farhi, J. Goldstone, S. Gutmann, and M. Sipser, “A Limit on the Speed of Quantum Computation in Determining Parity,” Physical Review Letters 81, 5442–5444 (1998), doi:10.1103/PhysRevLett.81.5442.
- P. Høyer, T. Lee, and R. Špalek, “Negative Weights Make Adversaries Stronger,” in Proceedings of the 39th Annual ACM Symposium on Theory of Computing, 526–535 (2007), doi:10.1145/1250790.1250867.
- S. Kimmel, “Quantum Adversary (Upper) Bound,” Chicago Journal of Theoretical Computer Science 2013, Article 4 (2013), doi:10.4086/cjtcs.2013.004.
- B. W. Reichardt, “Reflections for Quantum Query Algorithms,” in Proceedings of the Twenty-Second Annual ACM–SIAM Symposium on Discrete Algorithms, 560–569 (2011), doi:10.1137/1.9781611973082.44.
- A. C.-C. Yao, “Probabilistic Computations: Toward a Unified Measure of Complexity,” in Proceedings of the 18th Annual Symposium on Foundations of Computer Science, 222–227 (1977), doi:10.1109/SFCS.1977.24.