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.
Let be the Boolean quantum oracle for a linear Boolean function, and put . The CNOT gates implement , where the data wires control the ancilla qubit. CNOT control reversal in the Hadamard basis and imply the exact unitary operator identity
Here on strings is bitwise exclusive or. To conjugate a product, insert between its factors; each factor reverses its control and target, and the unused Hadamard gates cancel. The global phase is exactly . In particular, the identity holds on arbitrary quantum superpositions, not only on the initialized inputs of the Bernstein-Vazirani algorithm.
Linear Boolean function 2026-10-25
A linear Boolean function is a linear map from to . Here is the two-element finite field, whose addition is exclusive or. Every such function has a unique coefficient binary string and takes the form
The dot is the binary inner product. To prove the representation, expand in the standard basis and use linearity, obtaining ; thus . For example, gives . Adding a nonzero constant produces an affine map, not a linear map.
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
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.