Interference Does the Work
Deutsch's algorithm solves its problem in one oracle query rather than two. The reason is not magic — it is quantum interference. Understanding exactly how interference converts a phase difference into a measurable bit is the key insight that carries forward to every query algorithm you will see.
What the algorithm produces
After the oracle call, the register qubit (qubit 0) is in one of two states:
Here and .
The global sign is unobservable, but the relative sign between the two amplitudes is not: has a relative sign; has a relative sign. These are orthogonal states, and the final Hadamard maps them back onto the computational basis so a measurement can distinguish them.
Phase kickback plants the relative sign
Before the oracle, the ancilla qubit is prepared in . When the oracle applies , the XOR with the ancilla does not change the ancilla's state — instead it kicks back a phase factor to the input qubit (a global phase on each |x⟩ component, which becomes a relative phase once x is in superposition):
So for the superposition , the oracle produces
If is constant, both signs are the same, so the register qubit is . If is balanced (), the signs differ by exactly , giving .
Constructive vs destructive interference closes the case
The final Hadamard on the register qubit transforms:
This is interference in action. For a constant function, the two amplitudes entering the Hadamard have the same sign, so they add constructively toward and destructively away from . For a balanced function, the opposite signs cause constructive interference toward and complete cancellation at .
A single measurement then yields 0 (constant) or 1 (balanced) with certainty — revealing a
global property of the function from a single query.
Why classical methods need two queries
Classically, evaluating at one point tells you only or in isolation. To compare them you must call the oracle twice. There is no way to simultaneously probe both inputs without superposition, and there is no mechanism to cancel one outcome against another without interference. The quantum algorithm does both at once: superposition evaluates and in a single call, and interference translates the phase difference into a distinguishable measurement outcome.
Sign in on the full site to ask questions and join the discussion.