CHAPTER 09
Oracle algorithms: Deutsch, Deutsch–Jozsa, and Bernstein–Vazirani
Learning goals. Define a reversible oracle, derive phase kickback, and compare three algorithms without confusing query complexity with runtime.
9.1 A black box is an explicit resource assumption
For a Boolean function , the standard oracle is
It preserves x and is reversible even when f is not. An oracle problem counts calls to this operation as units. A physical implementation must still compute f coherently, route its controls, and uncompute temporary work. A black-box separation can teach a mechanism without being a practical application.
Prepare the target in . Since ,
The target returns to the same state and the phase appears on the input branch. This phase kickback implements .
9.2 Deutsch’s one-bit problem
There are four one-bit Boolean functions. Two are constant; two are balanced. The task is to determine . One classical deterministic query cannot distinguish a constant function from a balanced one agreeing at the queried input.
Prepare , query, and apply H to the first qubit. Ignoring the unchanged target,
If the values agree, the second amplitude cancels and result 0 is certain. If they differ, the first amplitude cancels and result 1 is certain. The algorithm reveals parity, not both function values. One query’s information is reorganized through interference [11].
9.3 The Hadamard transform on bit strings
For one bit,
Taking tensor products yields
where is a binary dot product. The exponent may be computed modulo two. This is the Fourier transform of the group of bit strings under XOR.
The useful cancellation identity is
If a bit of z is one, pair each x with the string obtained by flipping that bit. The two terms have opposite signs and cancel. This pairing proof is the engine behind both algorithms below.
9.4 Deutsch–Jozsa and its promise
The promise is that f is either constant or balanced over all inputs. Other functions are outside the problem. Starting in , apply Hadamards, the phase oracle, and Hadamards again. The amplitude of output y is
At , this is the average of . A constant function gives amplitude or . A balanced function gives zero. Therefore observing all zeros means constant and any nonzero output means balanced, under the promise [12].
An exact deterministic classical algorithm can require queries: after seeing the same value on half the domain, both cases remain possible. But a randomized classical algorithm can distinguish the cases with bounded error using only a number of samples logarithmic in the inverse error tolerance. For k independent uniformly sampled inputs to a balanced function, the probability all answers match is . The dramatic exact deterministic comparison is not an exponential separation from bounded-error classical computation.
9.5 Bernstein–Vazirani
Now promise for a hidden n-bit string s. The same circuit has
The cancellation identity gives if , zero otherwise. One quantum oracle query recovers the whole string. Classically, querying each unit vector reveals , requiring n deterministic queries in the worst case [13].
An added constant offset in contributes only global phase . This circuit still returns s but does not identify b. This is a concrete example of a global phase carrying no accessible measurement information.
The BV input state after the oracle actually factors:
Entanglement among these input qubits is unnecessary for this query advantage. Claims that every speedup requires entanglement in every stage would therefore be misleading.
Laboratory L13 — Oracle interference. Choose Deutsch’s complete truth table, a promised Deutsch–Jozsa instance, or a BV secret. Inspect preparation, oracle phases, final amplitudes, and sampled results. The DJ panel uses a stated family of balanced parity functions; the proof applies to every promised balanced function.
9.6 Exercises
9.1. Run Deutsch algebraically for .
Show solution / guidance
The queried state is . H gives , so result 1 is certain.
9.2. For n=3 and BV secret 101, list the inputs where f is one.
Show solution / guidance
. The inputs are 001, 011, 100, 110. Their amplitudes acquire minus signs; the final result is 101.
9.3. In Deutsch–Jozsa, suppose f is one on exactly one quarter of the domain. What is the all-zero output probability?
Show solution / guidance
The amplitude is , giving probability . This is outside the promise, so the circuit is not an exact classifier for this case.
9.4. How many independent classical samples make ?
Show solution / guidance
, so k=8 suffices. This bound assumes uniformly random inputs and the exact promise.
9.5. Why does replacing with in the oracle target remove the useful kickback?
Show solution / guidance
, so both f values leave the target and phase unchanged. The input returns to after the final Hadamards.