The algorithm that started it all. One quantum query does what two classical queries cannot avoid. Watch superposition and interference solve the problem in a single shot.
Is f(x) constant (always same output) or balanced (different outputs)? Classical: 2 queries. Quantum: 1 query.
A black-box quantum gate Uf that encodes f(x) without revealing it. You can only query it โ not look inside.
H โ Uf โ H. Superposition queries both inputs at once. Interference makes the answer appear in the measurement.
Generalises to n bits. Classical needs up to 2โฟโปยน+1 queries. Quantum still needs only 1. Exponential speedup.
Always outputs 0. Never changes the ancilla qubit.
Always outputs 1. Flips ancilla qubit always.
Outputs what it receives. Ancilla flips iff x=1.
Flips every input. Ancilla flips iff x=0.
You understood the algorithm that launched the quantum computing revolution!
Quantum algorithms are usually analysed in terms of oracle queries โ how many times must you call the black box? Reducing this count is the quantum advantage.
Preparing the ancilla as |โโฉ converts oracle function evaluation into phase manipulation โ and phases are manipulated by H gates into probabilities. This exact trick powers Grover and Shor.
Constant oracle: both paths have same phase โ constructive interference โ measure 0. Balanced oracle: opposite phases โ destructive interference โ measure 1. One query, definite answer.
The n-bit version of Deutsch's algorithm gave the first proof of an exponential quantum speedup over classical computation. Historically crucial, even if the problem was contrived.