The Deutsch-Jozsa Algorithm

qc/algorithms qc/gates

Generalizes Deutsch’s Algorithm from one bit to bits: given , promised to be either constant (same output for all inputs) or balanced (output 1 for exactly half of all inputs), determine which — in 1 query, regardless of .

Why this is a bigger deal than Deutsch’s algorithm

Classically, a deterministic algorithm needs queries in the worst case to be certain (you could query inputs, get the same answer every time, and still be looking at a balanced function whose other half you haven’t checked). Deutsch-Jozsa’s constant-vs- gap is the first algorithm with a proven exponential speedup over any deterministic classical algorithm — not just a constant-factor win like Deutsch’s original 2-vs-1.

Circuit

Same structure as Deutsch’s algorithm, extended to query qubits: prepare , apply to the query register and to the ancilla, apply the oracle (phase-kicked back onto the query register exactly as in Deutsch’s algorithm), apply to the query register again, then measure it.

Result: the query register reads all-zeros () with certainty if is constant, and never reads all-zeros if is balanced. One measurement, one bit of information (“was it all-zeros or not”), fully resolves the promise.

Self-Check

  • Why does a classical deterministic algorithm need queries in the worst case, not just 2?
  • What specifically makes Deutsch-Jozsa’s speedup “exponential” rather than just “faster”?
  • What does measuring “not all-zeros” tell you, and why is that enough to conclude “balanced” with certainty?