Quantum oracles and phase kickback
A reversible function evaluation can become a phase that interference can read.
- Describe a reversible Boolean oracle.
- Derive phase kickback using a minus-state target.
Make a function reversible
Section titled “Make a function reversible”A Boolean function may discard information. Its reversible oracle keeps the input and XORs the output into a target:
This map is its own inverse. The oracle is a specified operation, not a magical free answer source; its implementation can dominate an algorithm’s cost.
Use an eigenstate of X
Section titled “Use an eigenstate of X”The state satisfies .
So a function-controlled X on this target gives
The target factors out; the input receives a function-dependent phase. This is phase kickback.
A two-input example
Section titled “A two-input example”Let . The values on 00, 01, 10 and 11 are 0, 1, 0 and 1. A uniform input register receives signs . Applying H to both input qubits converts that phase pattern into a nonzero bitstring.
The Deutsch–Jozsa lab calculates this phase-kickback input register directly. It explicitly factors out the minus-state ancilla; it does not pretend to show an extra simulated wire.
Check yourself: if is constant one, every component acquires the same minus sign. Why is this global phase unobservable, while a balanced pattern is not?
An oracle is a reversible interface
Section titled “An oracle is a reversible interface”The example uses the Boolean function that returns its one-bit input. With a minus-state target, the oracle turns plus on the input into minus. The target remains minus. The function value appears as a phase on each input branch rather than as a classical value read out from the target. A final basis change can make that phase pattern observable.
The oracle retains x and XORs the function value into y. Keeping the original input makes the mapping invertible even when the function itself is many-to-one. A classical function that overwrites its input with its output is not automatically a valid coherent oracle. Reversible implementation may require workspace and a plan to remove unwanted intermediate information.
Work the target eigenstate explicitly
Section titled “Work the target eigenstate explicitly”For one fixed input x, there are two cases. If the function value is zero, the target is untouched. If it is one, the oracle applies X to minus, producing negative minus. The common target factor can therefore be pulled outside the sum over x:
The factor is conditional on x. If the function is constant, every branch gets the same sign and the input changes at most by global phase. If the function varies, different branches can acquire different signs. Their relative phases can then affect interference. This is why a negative sign can be irrelevant in one oracle case and crucial in another.
Worked example: all four one-bit functions
Section titled “Worked example: all four one-bit functions”For constant zero, a plus input stays plus. For constant one, it becomes negative plus, physically the same state. For the function f(x) equal to x, plus becomes minus. For its complement, plus becomes negative minus. Applying H to the input produces zero for either constant function and one for either balanced function, ignoring the common phase.
The procedure identifies a property shared by two functions rather than revealing the whole truth table. It cannot distinguish constant zero from constant one through this input-register measurement, and it does not need to. A quantum algorithm’s output is designed around a question. Claiming that it “evaluates both inputs and reads both answers” would misdescribe what the experiment actually reveals.
Why the target preparation matters
Section titled “Why the target preparation matters”If the target were plus, X would leave it unchanged with eigenvalue positive one, so no phase pattern would be kicked back. If the target were zero, the oracle would generally correlate it with the input rather than factor out an unchanged eigenstate. The minus preparation is a deliberate algorithmic resource, not an arbitrary decoration on the circuit.
More generally, a controlled operation acting on an eigenstate contributes its eigenvalue to the control branch. For an eigenvalue with an arbitrary unit complex phase, that becomes the mechanism behind phase estimation. The minus-target example is the simplest case, where the eigenvalue is just negative one. Understanding this case makes the later controlled-power circuits much less mysterious.
Count what the oracle model leaves out
Section titled “Count what the oracle model leaves out”One oracle call is a unit of query complexity, not necessarily one elementary hardware gate. The function may require many reversible operations, temporary qubits and uncomputation. A truth-table lookup might also require expensive data loading. An abstract query advantage must be combined with those costs before making a runtime claim about an application.
The explorer evaluates a small built-in phase pattern directly in a classical statevector. It does not compile an arbitrary user function into a reversible circuit. Its amplitude output represents the input register after the final H gates, with the unchanged minus ancilla factored out. This modelling choice reduces clutter without changing the promised classification task.
Test constant and balanced cases
Section titled “Test constant and balanced cases”Select one input qubit for the original Deutsch case. Predict the input-register result for constant zero, reveal, then repeat with constant one. Explain why their final amplitudes can differ by a global sign while the probabilities match. Finally choose the balanced last-bit function and predict a nonzero output.
Deutsch–Jozsa explorer
A constant-or-balanced Boolean oracle acts by phase kickback, followed by H on each input qubit. The unchanged |−⟩ ancilla is factored out. One input qubit gives Deutsch’s original case.
Prepare your experiment using the controls. Record a prediction, then reveal the statevector or run the experiment.
Changing the preparation or circuit starts a new prediction.
Take it further
Constant-zero and constant-one differ by a global sign before the final H gates. Explain why their measured probabilities agree.
Initial setup · reference state
| Basis | Amplitude a + bi | Magnitude | Phase (rad) | Probability |
|---|---|---|---|---|
| |00⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
| |01⟩ | 1 + 0i | 1.000000 | 0.000000 | 100.0% |
| |10⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
| |11⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
Signs and complex phases are part of the state. Phase is undefined for a zero amplitude. A shared global phase changes no probabilities; relative phases can affect a later operation. Values are rounded to six decimal places.
Prediction to try: Predict whether the all-zero input-register outcome can occur for the selected promised oracle.
Challenge: Constant-zero and constant-one differ by a global sign before the final H gates. Explain why their measured probabilities agree.
Open the live experiment studioFor two or three input qubits, the same explorer illustrates Deutsch–Jozsa for its selected oracle family. A balanced last-bit function gives a particular nonzero bitstring. The general promised algorithm guarantees that all-zero is absent for a balanced function, not that every possible balanced function returns that same nonzero string.
Practice: change the target
Section titled “Practice: change the target”Replace the minus target with plus in the one-bit example. Work through the oracle for both possible function values and predict the final input measurement after H. Does the circuit still classify the function?
Check your reasoning
X has eigenvalue positive one on plus, so both function values leave the target and the input amplitudes unchanged. The input remains plus and the final H returns zero for every function. The circuit no longer distinguishes constant from balanced. The oracle is unchanged; the lost advantage comes from an unsuitable target preparation.
Check your understanding
Section titled “Check your understanding”Why use a minus-state target for phase kickback?
Answer: X contributes eigenvalue −1 on that state. A controlled X leaves the target eigenstate factored out while attaching a conditional sign to the input branch.
Reference: IBM Quantum — Fundamentals of quantum algorithms.
Ready for the next step?
Your progress stays in this browser.