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
- Superpose All Inputs. Hadamards prepare every input at once.
- 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.
- Hadamard Transform. A Hadamard layer turns the shift into a pattern of signs on top of the transformed function.
- Query the Dual Function. A second CZ cancels the pattern of the function, leaving only the signs caused by the shift.
- Final Hadamard Layer. The last Hadamards convert the sign pattern directly into the shift.
- 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.