Skip to main content

Plain-Language Intuition

Mode: Simple / School
Two black boxes compute the same pattern, except that one of them has its inputs secretly shifted. Find the shift. Classically you would have to feed in many inputs and hunt for where the two patterns line up. For a well-chosen pattern that takes a number of tries that grows exponentially. The quantum algorithm asks each box just once: 1. Query the shifted box on all inputs at once. It writes its pattern into the phases. 2. A Hadamard layer transforms the pattern. A shift in the input becomes a simple set of sign changes that spell out the shift. 3. Query the unshifted box to cancel the pattern itself, leaving only the signs. 4. A final Hadamard layer converts those signs into the bits of the shift. Measure, and the hidden shift appears with certainty.

Oracle Algorithms

Hidden Shift Algorithm: quick reference

Finds the secret offset s between two functions g(x) = f(x ⊕ s) with a single query to each, using Hadamard interference.

Topic
Oracle Algorithms
Level
Intermediate
Circuit size
2 Qubits
Key result
1 query to each oracle vs exponentially many classically

Concepts covered: Hidden Shift Problem, Bent Functions, Hadamard Transform, Phase Oracles

How Hidden Shift Algorithm works, step by step

  1. Superpose All Inputs. Hadamards prepare every input at once.
  2. Query the Shifted Function g. The shifted box marks inputs with minus signs. It is built from the plain box by flipping the shifted qubits before and after.
  3. Hadamard Transform. A Hadamard layer turns the shift into a pattern of signs on top of the transformed function.
  4. Query the Dual Function. A second CZ cancels the pattern of the function, leaving only the signs caused by the shift.
  5. Final Hadamard Layer. The last Hadamards convert the sign pattern directly into the shift.
  6. Read the Shift. The two measured bits are the hidden shift, every time.

Frequently asked questions

What is Hidden Shift Algorithm?

Finds the secret offset s between two functions g(x) = f(x ⊕ s) with a single query to each, using Hadamard interference. It is a intermediate-level topic in oracle algorithms.

How many qubits does the Hidden Shift circuit use?

The QuanBit tutorial uses a 2 qubits circuit. Key result: 1 query to each oracle vs exponentially many classically.

Can I simulate Hidden Shift online for free?

Yes. The interactive Hidden Shift tutorial at https://www.quanbit.tech/learn/hidden-shift runs free in the browser with nothing to install. You can step through the circuit gate by gate, watch the probabilities, statevector and Bloch spheres update, build the circuit yourself and take a short quiz.