- Algorithms
- Also: Deutsch-Jozsa problem
Deutsch-Jozsa Algorithm
A quantum algorithm that determines whether a Boolean function is constant or balanced using a single query, exponentially faster than any deterministic classical algorithm.
The Deutsch-Jozsa algorithm, published by David Deutsch and Richard Jozsa in 1992, is historically the first quantum algorithm to demonstrate a clear separation between quantum and classical computation. Given a black-box function that is promised to be either constant (same output for all inputs) or balanced (outputs 0 for exactly half the inputs and 1 for the other half), the algorithm determines which case holds using exactly one query to . Any deterministic classical algorithm requires queries in the worst case.
The circuit
The algorithm uses input qubits and one ancilla qubit:
- Initialize:
- Apply Hadamard gates to all qubits, producing the state
- Apply the oracle , which maps
- Apply Hadamard gates to the input qubits
- Measure the input qubits
After step 3, the phase kickback effect transforms the state so that each basis state picks up a phase of . The input register becomes:
After applying Hadamard gates in step 4, the amplitude of the all-zeros state is:
If is constant, all phases are equal and this amplitude is , so measuring gives with certainty. If is balanced, the positive and negative phases cancel exactly, giving amplitude 0, so the measurement never yields .
Complexity comparison
| Approach | Queries needed |
|---|---|
| Deterministic classical | (worst case) |
| Randomized classical | with bounded error |
| Quantum (Deutsch-Jozsa) | 1 (exact, no error) |
The quantum advantage here is over deterministic classical algorithms. A randomized classical algorithm can solve the problem with high probability using just a few queries (if the first few queries all return the same value, “constant” is overwhelmingly likely). This makes the Deutsch-Jozsa speedup somewhat academic, but it remains an important proof of concept.
Historical significance
The Deutsch-Jozsa algorithm was the first clear example showing that quantum computers can solve certain problems faster than classical computers. The original 1985 paper by Deutsch considered the single-bit case (), and Jozsa extended it to bits. It directly inspired subsequent oracle-based algorithms including Bernstein-Vazirani and ultimately Grover’s algorithm.
Why it matters for learners
Deutsch-Jozsa is typically the first quantum algorithm taught in courses because it cleanly illustrates three core quantum concepts: superposition (querying all inputs at once), phase kickback (encoding function values into phases), and interference (using Hadamard transforms to make phases constructively or destructively combine). Understanding this algorithm provides the conceptual toolkit for all subsequent oracle-based quantum algorithms.