Each run of Simon's algorithmuses one oracle call and returns one uniform sample from s⊥. Collect samples as rows of a matrixZ and solve Zs=0 over the two-element field using Gaussian elimination. Once the rows have matrix rankn−1, the kernel is {0,s}, so the promised nonzero vector is uniquely determined. Dependent samples, including z=0, must be allowed for; exactly n−1 runs need not suffice.
Alternatively, m=d+t samples fail to span with probability less than 2−t: failure means some nonzero linear functional on the d-dimensional space vanishes on every sample, and a union bound gives (2d−1)2−m. Consequently
Qquantum=O(n) for fixed error,Qquantum=O(n+log(1/ε)) for error ε.
The Gaussian elimination requires only apolynomial amount of classical work, for example O(n3)bit operations for O(n) samples. The degenerate case n=1 needs no calls because the promise already specifies s=1.
Classically, distinct inputs with equal function values reveal s=x⊕x′. Uniformly sampling distinct inputs finds such a function collision after roughly 2n calls, by the birthday square-root scale. For q sampled inputs, the expected number of colliding pairs is (2q)/(2n−1). The usual randomized classical query complexity of Simon's problem is therefore exponential in n, on the scale
Qclassical=Θ(2n/2) for bounded error,Qquantum=O(n).
A straightforward exhaustive classical search instead uses O(2n) calls. The square-rootcollision estimate is the sharper classical comparison; the quantum advantage concerns access to the promised quantum oracle, rather than an explicit table of all function values.
The population-preserving interaction commutes with the quantum oracle on this answer-register input, so its placement before or after the oracle, between the two Hadamard gates, gives the same result. Substitute φ=πb into b:
For real nonnegative environment overlap this is (1+v)/2, ranging from certainty at v=1 to random guessing at v=0. For general complex overlap, a coherent shift can invert the printed answer: for example v=1,α=π makes the printed rule always wrong. If the overlap is known but the printed quantum measurement is retained, choose the better labeling of its outcomes; this gives
There is a further improvement if a known α can be compensated by the phase gateP−α before the final Hadamard gate. It removes the coherent shift without reversing any actual quantum decoherence, and yields
In the oracle machinemodel, afunction is accessed through ablack box whose internal gate cost is excluded; the resource counted is the number of calls. A reversible classical oraclemapsbasis inputs as (x,y)↦(x,y⊕f(x)). Its quantum oracle extension applies the same permutation coherently to arbitrary superpositions, without measuring its input. A classical random mixture of inputs is not that coherent extension.
Write the two truth-table entries as f(0)=b, f(1)=a⊕b. Then f(x)=ax⊕b, with the four cases
Two classical query circuits, (0,0)Uf(0,f(0)) and (1,0)Uf(1,f(1)), recover the whole function with certainty. One call fixes only one entry, leaving two compatible functions; hence two are necessary classically. Randomization cannot remove this obstruction to certainty.
The minimum for full exact function identification remains two even with coherent quantum queries. To see this, expand the oracle target into its Xeigenstates: it is identity on ∣+⟩, and gives phases (−1)f(x) on ∣x⟩∣−⟩. Any one-query input, including an auxiliary system, has orthogonal sector weights w+, w0 and w1 summing to one. The output overlap between functions differing only at 0 is 1−2w0, so perfect distinction requires w0=1/2; differing only at 1 likewise requires w1=1/2. Then w+=0, but functions differing at both entries have overlap 1−2(w0+w1)=−1. They are the same ray rather than distinguishable states. Thus one query cannot identify all four functions. The following one-query task recovers only whether the entries agree.
Here ∣−⟩=(∣0⟩−∣1⟩)/2. Since X∣−⟩=−∣−⟩, phase kickback gives Uf(∣x⟩∣−⟩)=(−1)f(x)∣x⟩∣−⟩. The third qubit remains separable and unchanged. A direct marked-state phase oracleOf∣x⟩=(−1)f(x)∣x⟩ therefore replaces the three-qubit query using only two qubits:
The number of accesses to an unknown input needed to solve a specified task. The input might be astring with individually readable entries, or an implicitly supplied function. A complete statement specifies deterministic, randomized, or quantum access, the accepted error, and worst-case or expected cost. Quantum query complexity permits coherent input access through a quantum oracle.