QUANTUM 06

The Deutsch-Jozsa
algorithm

The first proof that one quantum query can beat many classical ones

Sinclair College - Dr. Mike Libassi

TODAY

What we will cover

01The problemConstant or balanced?
02ClassicalQuery one input at a time
03QuantumOne query plus interference
04Why it mattersThe road to Shor
Quantum 06 · Deutsch-Jozsa2

01 · THE PROBLEM

Constant or balanced?

A sealed oracle computes f(x) for an n-bit input and returns one bit. You're promised the function is one of two kinds.

Constant

Returns the same output for every input: always 0, or always 1.

Balanced

Returns 0 for exactly half the inputs and 1 for the other half.

Goal

Decide which kind, with 100% certainty, in as few queries as possible.

Quantum 06 · Deutsch-Jozsa3

02 · CLASSICAL VS. QUANTUM

Queries needed for a guaranteed answer

Input bits (n)Possible inputsClassical worst caseQuantum
1221
3851
101,0245131
50≈ 1.1 quadrillion≈ 563 trillion1

Classically you must check more than half the inputs (2ⁿ⁻¹ + 1) to rule out "balanced" for certain.

Quantum 06 · Deutsch-Jozsa4

03 · THE QUANTUM WAY

One query, then interference

1

Prepare

n qubits at |0⟩, helper qubit at |−⟩

›
2

Hadamards

Superposition over all 2ⁿ inputs

›
3

Oracle ×1

Each input gets sign (−1)f(x): phase kickback

›
4

Hadamards

Signs interfere

›
5

Measure

All zeros = constant; else balanced

Quantum 06 · Deutsch-Jozsa5

03 · WHY IT WORKS

The all-zeros amplitude averages the signs

amplitude of|0…0⟩=(1/2ⁿ) Σx (−1)f(x)
constant: all signs equal → ±1 → always measure 0…0
balanced: half +, half − → 0 → never measure 0…0

This is interference at scale: wrong answers cancel, the right answer reinforces.

Quantum 06 · Deutsch-Jozsa6

04 · WHY IT MATTERS

A toy problem with a serious lesson

Artificial

Nobody needs this answer, and a classical computer allowing tiny error needs only a few random queries.

The toolkit

Superposition, phase kickback, and interference: the pattern behind every major quantum algorithm.

The lineage

Deutsch-Jozsa (1992) → Simon (1994) → Shor (1994), which breaks RSA.

Quantum 06 · Deutsch-Jozsa7

WRAP-UP

Key takeaways

1

The oracle is constant or balanced; the task is to tell which

2

Classically, certainty can take 2ⁿ⁻¹ + 1 queries

3

Quantumly, it takes exactly one query plus interference

4

The same pattern leads directly to Shor's algorithm

Quantum 06 · Deutsch-Jozsa8

DISCUSSION

Deutsch-Jozsa has no practical use. Why is it still taught in nearly every quantum computing course?

Think about what it proved, and which later algorithms reuse its structure.

Quantum 06 · Deutsch-Jozsa Algorithm · Questions?  ·  Open the interactive page