Phase kickback: how an oracle writes its answer into signs

Put the answer qubit in the minus state and the oracle stops changing it. Instead it flips the sign of every input where f is 1. That one trick powers all three algorithms.

8 min read · reviewed December 2026

The two-line calculation

Take the answer qubit in the state |−⟩ = (|0⟩ − |1⟩)/√2. Adding a bit c into it with ⊕ gives |c⊕0⟩ − |c⊕1⟩ over √2. If c is 0 nothing changes. If c is 1 the two terms swap and the state becomes (|1⟩ − |0⟩)/√2, which is −|−⟩. So the oracle’s effect on the answer qubit is just a factor of (−1)^c.

Now apply this to the oracle with c = f(x). The input is |x⟩, the answer qubit is |−⟩, and the oracle returns (−1)^f(x) |x⟩|−⟩. The answer qubit is unchanged and the sign has moved, or kicked back, onto the input register. For a superposition of inputs the sign attaches to each term separately.

U_f |x⟩|−⟩ = (−1)^f(x) |x⟩|−⟩

U_f ( Σ_x a_x |x⟩ ) |−⟩ = ( Σ_x (−1)^f(x) a_x |x⟩ ) |−⟩

Why this is useful

A sign on a basis state cannot be seen by measuring that state: the chances are the same. But a sign changes how the terms interfere when another Hadamard layer mixes them. The algorithms encode the property of f they want in a pattern of signs across all inputs, then use a Hadamard layer to turn the sign pattern into a measurable pattern of chances.

The lab’s Deutsch–Jozsa tab shows this directly. At the Hadamard step every input has the same positive amplitude. At the oracle step the amplitudes of inputs where f is 1 turn negative, and nothing else changes. The last step reveals the pattern.

Getting the minus state

The answer qubit starts in |0⟩. An X gate makes it |1⟩, and a Hadamard makes it |−⟩. That is why the lab’s first two steps are Start and Flip answer qubit, and why the Hadamard step touches every qubit including the last.

A picture in three lines

  • Before the oracle: all amplitudes equal, 1/√N each, all positive.
  • After the oracle: amplitude of x is (−1)^f(x)/√N.
  • After the final Hadamards: amplitude of z is (1/N) Σ_x (−1)^(f(x) + x·z).

Phase kickback is also what lets Grover’s algorithm mark a solution and what lets phase estimation read an eigenvalue. It is the most reused trick in the subject.

Try it

Questions

Does the answer qubit really not change?

Right: it stays in |−⟩ throughout. That is what lets the sign be attributed entirely to the input register.

Is the sign a global phase?

A single overall sign would be. Here each basis state gets its own sign, so the signs are relative phases, which interference can reveal.

Read next

Sources and further reading

Check the original sources for exact citations.