Why does Deutsch-Jozsa need to know which functions are allowed?
What happens when an algorithm’s promise is broken
Source research checked . Teaching calculations are ideal models.
Use a three-bit Boolean oracle, so there are eight possible inputs. The Deutsch–Jozsa promise says the function is constant or balanced. The experiment deliberately includes a third case with six zeros and two ones to show why an algorithm’s guarantee depends on its input conditions.
A valid theorem can coexist with unhelpful output on an invalid input. That is why benchmark descriptions must include promised structure and preprocessing. In this toy example the violation is visible by enumerating eight values. In a large application, verifying the promise may itself have a cost, and that cost belongs in any end-to-end argument.
Figure and table scope: Sweep k, the number of ones in an eight-input Boolean truth table, from 0 to 8. Values outside k=0,4,8 illustrate violation of the Deutsch–Jozsa promise.
Derivation step 1: After phase kickback and final Hadamards, the all-zero output amplitude is the average of (-1)^f(x) over all eight inputs.
Derivation step 2: For a constant function this average is either plus one or minus one, so the all-zero output occurs with certainty.
Derivation step 3: For a balanced function four terms are positive and four negative, giving zero all-zero probability.
Derivation step 4: For six zeros and two ones, the average is (6-2)/8=1/2, so the all-zero probability is one quarter. The algorithm’s promised binary interpretation no longer applies.
Separate challenge: For a truth table with seven zeros and one one, find the all-zero probability. Can the all-zero outcome certify constancy for arbitrary functions?
Worked challenge answer: The amplitude is (7-1)/8=3/4 and the probability is 9/16. A nonconstant function can therefore produce that outcome. The certainty statement requires the original constant-or-balanced promise.
Start with the assumptions
- Ideal phase oracle and exact counts over all inputs. Query-complexity comparisons must specify deterministic exact versus randomized bounded-error classical strategies.
P(all-zero output)=(1−2k/8)².

Compare the input regimes
Each case uses invented inputs. The results follow from this model and do not describe measured hardware.
Reference example with separately scoped figure
Complete inputs
- reference scenario
- Use three input bits, so the function has eight outputs. Compare constant, four/four balanced and an unpromised six/two split.
- separate figure scope
- Sweep k, the number of ones in an eight-input Boolean truth table, from 0 to 8. Values outside k=0,4,8 illustrate violation of the Deutsch–Jozsa promise.
- P(all zero) = [(N_0-N_1)/(N_0+N_1)]^2. Constant: 1. Balanced: 0. Six/two: (4/8)^2=1/4.
| Reference | Prediction |
|---|---|
| Original declared example | The intermediate case produces all zeros one quarter of the time in the ideal model. It cannot be classified using the promised deterministic rule because it violates the input contract. |
| Number of ones in an eight-input truth table | All-zero output |
|---|---|
| 0 | 1 |
| 1 | 0.5625 |
| 2 | 0.25 |
| 3 | 0.0625 |
| 4 | 0 |
| 5 | 0.0625 |
| 6 | 0.25 |
| 7 | 0.5625 |
| 8 | 1 |
The declared reference example predicts: The intermediate case produces all zeros one quarter of the time in the ideal model. It cannot be classified using the promised deterministic rule because it violates the input contract.
Try the reasoning: For a truth table with seven zeros and one one, find the all-zero probability. Can the all-zero outcome certify constancy for arbitrary functions?
Sources and model boundaries
- IBM Quantum Learning: Deutsch-Jozsa and Bernstein-Vazirani ↗
Primary scientific context for an original ideal teaching example. Source research checked 19 October 2026; site integration inspected 20 October 2026. These are different checks.