The displayed Bernstein-Vazirani algorithm prepares its ancilla qubit in the computational-basis state before the first Hadamard gate. At the function oracle it is therefore the eigenstate of the Pauli X gate, which enables phase kickback. Preparing instead yields at the function oracle; target flips leave this state unchanged, so the data contain no information about .
The Hadamard-conjugated linear oracle makes the more general statement transparent. With zero data and initial ancilla qubit , the full fixed quantum circuit outputs
For nonzero , the correct data outcome has probability . To obtain exact identification for all , this preparation must have , so it is up to global phase. This is a condition on the prescribed preparation circuit: any alternative quantum state preparation that supplies at the function oracle is equivalent.
The Bernstein-Vazirani algorithm identifies the coefficient string of a linear Boolean function with one Boolean quantum oracle call. It contrasts with the calls required by the classical query complexity of linear Boolean function identification. Prepare the data qubits at and an ancilla qubit at , apply a Hadamard gate to every wire, query the function oracle, and apply the Hadamard gates again. The full output is .
The mechanism is Bernstein-Vazirani phase kickback. The Pauli X gate has eigenvector with eigenvalue . Thus the target flips become relative quantum phases on the data, giving
The final Hadamard transform maps this product to , so computational-basis measurement recovers every coefficient with certainty. The ancilla preparation for the Bernstein-Vazirani algorithm ensures the required minus sign, and the Hadamard-conjugated linear oracle gives an exact quantum circuit interpretation. One query is optimal for , since without a query the output cannot depend on the unknown string.
In exact classical identification of an unknown linear Boolean function , a function oracle call returns one bit . The query complexity is exactly for . Queries on the standard basis inputs reveal , proving sufficiency. For necessity, a depth- decision tree has at most answer histories and must distinguish hidden binary strings; hence , even with adaptive inputs. A reversible circuit that preserves and updates a known target by exclusive or reveals the same one bit per call.
There is also a useful linear algebra proof. Along a fixed history, the chosen inputs form the rows of a matrix over the two-element finite field, and the replies specify . If there are queries, the rank-nullity theorem gives a nonzero vector with . Then and give identical replies throughout this history. This also explains why adaptive choices cannot evade the bound: equal earlier replies force the same later choices.
Function oracle 2026-10-24
A function oracle supplies access to an unknown function : given an allowed input , one query returns . Query complexity counts these accesses separately from known local computation. A classical query receives one definite answer; a quantum oracle specifies coherent access through a unitary operator, allowing inputs in quantum superposition. The distinction is part of the access model, not a change to the mathematical function.
A Boolean quantum oracle preserves and adds a one-bit value into an answer qubit by exclusive or. On known computational-basis states, its output determines the same value as a classical function oracle query.
Write and , with the top wire carrying , the middle wire , and the bottom wire the ancilla bit . The binary inner product is , where is exclusive or. Let denote a CNOT gate controlled by wire and targeting . The four linear Boolean functions and their Boolean quantum oracles are:
Reversible circuit for : three unchanged wires
The CNOT gates in the last row commute: their common target acquires the exclusive or of the two controls. Each input wire is preserved, and applying any of these reversible circuits twice restores .
Figure 1.
The four two-bit linear oracles and their exact simplifications after Hadamard gates on all three wires; a filled dot is a control and a circled plus is a target
. Details.
For classical reversible computation, call the unknown function oracle on and . The resulting ancilla bits are respectively and :
Use a fresh zero ancilla bit for each call, or preserve the first result in workspace before restoring the target to zero. Thus two classical calls determine the two-bit string.
For input bits, query the standard basis strings , since . This gives an upper bound of calls. It is also optimal for exact identification: every classical query reveals at most one new bit, since is unchanged and reveals just when is known. A depth- decision tree has at most answer histories, but must distinguish possible hidden strings. Hence , including adaptive strategies. The classical query complexity of linear Boolean function identification is therefore
Use the Hadamard basis states . The Hadamard gate satisfies , , and . After the first three Hadamard gates, the full quantum state is
The Pauli X gate obeys . Consequently the Boolean quantum oracle produces phase kickback:
Factoring out the ancilla qubit, the four states immediately after the function oracle are
The final Hadamard gates send to and to . In particular, the printed quantum circuit includes a final Hadamard gate on the ancilla qubit too. Its full outputs, ordered as , are
Thus one oracle call identifies with certainty: a computational-basis measurement of the first two qubits returns . The ancilla qubit returns to and carries no additional information about . The Bernstein-Vazirani algorithm turns the pattern of relative quantum phases into a definite computational-basis state.
The required identity is CNOT control reversal in the Hadamard basis. To derive it using standard quantum circuit identities, let be the Controlled-Z gate, which multiplies by and fixes the other computational-basis states. Since ,
The Controlled-Z gate is symmetric in its two wires. Combining this symmetry with gives
This is an exact operator identity, including its global phase, and applies to arbitrary inputs. One can also check it directly from the orthogonal projectors : conjugating by gives
For the three-wire quantum circuit, put . Conjugation distributes over products because : . Each CNOT gate in therefore reverses direction, while the Hadamard gates on untouched wires cancel. The Hadamard-conjugated linear oracle is
These are the simplified quantum circuits in the figure: for there are no gates; for there is ; for there is ; and for there are both. The ancilla qubit becomes their common control. On every computational-basis state, the entire simplified circuit acts as
Starting the data qubits at , the prescribed computational basis preparation of the ancilla qubit must therefore be : it activates the required flips and gives . Starting it at instead gives for every , so no information is obtained.
More generally, an initial ancilla qubit state in this same fixed quantum circuit gives
For nonzero , the desired data output has probability , and exact identification for every requires . This condition refers to the displayed ancilla preparation for the Bernstein-Vazirani algorithm: the state entering the function oracle must be , up to global phase. Other quantum state preparation procedures that deliver this same state are equivalent; is the prescribed input before the first Hadamard gate.
For arbitrary , linearity of the linear Boolean function supplies
This decomposition is for analysis: the Bernstein-Vazirani algorithm calls the unknown function oracle as one supplied operation. The common control starts at , so the simplified quantum circuit takes to . Equivalently, phase kickback gives a product state
which the final Hadamard transform decodes to . Thus one quantum oracle call suffices for every , compared with classical calls. This counts function oracle uses; the surrounding Hadamard gates and final computational-basis measurement still act on and qubits, respectively.