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.
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.