Simon’s Algorithm
Track: Quantum Algorithms · Difficulty: Intermediate · Est: 15 min
Simon’s Algorithm
Overview
Simon’s algorithm is an early “period-finding” algorithm. It is historically important because it was one of the first clear examples where quantum algorithms can use interference + measurement to uncover hidden structure with dramatically fewer oracle queries than classical strategies (in the black-box model).
Problem setting:
You are given oracle access to a function
with the promise that there exists a secret string such that:
- for every ,
- and these are the only collisions (so is 2-to-1).
Goal: find the hidden period .
Intuition
The algorithm uses a very “quantum” style of information extraction:
- Query the oracle in a superposition over all .
- Measure the output register. This doesn’t give directly, but it collapses the input into a superposition of two values that are paired by the hidden period:
- Apply Hadamards to the input. This converts the “two-point structure” into a constraint on what you can measure.
- Repeat to gather multiple constraints.
- Solve for using classical reasoning.
The key idea: measurement gives you constraints that are consistent with . After enough repeats, those constraints determine .
This is entanglement and measurement used operationally:
- entanglement ties input and output,
- measuring output forces input into a structured superposition,
- interference reveals information about the hidden structure.
Algorithm Structure
High-level steps:
- Prepare two -qubit registers: input and output, starting at .
- Apply to the input to create a uniform superposition over .
- Query the oracle once:
- Measure the output register. This collapses the input to a superposition of two inputs that share the same output.
- Apply to the input register.
- Measure the input register to get a bitstring .
- Repeat steps 1–6 to collect several different values.
- Use classical post-processing to reconstruct from the collected constraints.
Formal Description
After step 2, the joint state is
After the oracle:
Now measure the output register. Because is 2-to-1 with period , observing some value tells you the input must be either or . So the input collapses to
Apply . The result is a superposition where many measurement outcomes cancel. What survives are outcomes that satisfy a parity-like constraint with .
A standard way to state this constraint is:
Interpretation (no heavy algebra):
- each measured is a bitstring that is “compatible” with the hidden period,
- collecting multiple such values gives enough information to determine .
This is why Simon’s algorithm is a period-finding method: it turns a hidden XOR-period into measurable constraints.
Worked Example
Take and secret period . Then the constraint becomes:
meaning . So the measured values can only be:
- or .
A single run might produce (which is not very informative by itself), but repeated runs will also produce . With enough samples, you can infer that the hidden period must be 11.
This example illustrates the workflow:
- each run gives a constraint-consistent sample,
- classical post-processing combines them into the secret.
Turtle Tip
In Simon’s algorithm, measurement is not the “end.” Measurement is how you extract constraints, then classical processing turns constraints into the hidden period.
Common Pitfalls
- Don’t expect one run to reveal . The algorithm is designed to produce constraint samples; you need multiple runs.
- Don’t get stuck on the algebra. The operational story is: collapse to paired inputs, then Hadamards turn that pairing into measurable constraints.
Quick Check
- After measuring the output register, what kind of superposition does the input register collapse into?
- What kind of information does each measured provide about ?
What’s Next
Simon’s algorithm is a bridge from simple interference tricks to deeper period-finding ideas. Next we turn to Grover-style search at a conceptual level: Grover’s algorithm uses amplitude amplification to bias measurement toward marked solutions.
