• Algorithms
  • Also: Simon's problem

Simon's Algorithm

A quantum algorithm that finds the hidden period of a two-to-one function using O(n) queries, exponentially faster than any classical algorithm which requires O(2^(n/2)) queries.

Simon’s algorithm, published by Daniel Simon in 1994, solves the following problem: given a function f:{0,1}n{0,1}nf: \{0,1\}^n \to \{0,1\}^n with the promise that there exists a secret string s{0,1}ns \in \{0,1\}^n such that f(x)=f(y)f(x) = f(y) if and only if x=yx = y or x=ysx = y \oplus s, find ss. The algorithm uses O(n)O(n) quantum queries to the function, while any classical algorithm requires Ω(2n/2)\Omega(2^{n/2}) queries. This was the first example of an exponential quantum speedup over classical computation for a concrete (if contrived) problem.

The algorithm

  1. Initialize two nn-qubit registers to 0n0n|0^n\rangle|0^n\rangle
  2. Apply Hadamard gates to the first register: 12nxx0n\frac{1}{\sqrt{2^n}}\sum_x |x\rangle|0^n\rangle
  3. Apply the oracle UfU_f: 12nxxf(x)\frac{1}{\sqrt{2^n}}\sum_x |x\rangle|f(x)\rangle
  4. Measure the second register (obtaining some value f(z)f(z)), collapsing the first register to 12(z+zs)\frac{1}{\sqrt{2}}(|z\rangle + |z \oplus s\rangle)
  5. Apply Hadamard gates to the first register
  6. Measure the first register to obtain a string yy

After step 5, the amplitude of y|y\rangle is:

1212n[(1)yz+(1)y(zs)]\frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2^n}} \left[(-1)^{y \cdot z} + (-1)^{y \cdot (z \oplus s)}\right]

This is nonzero only when ys=0(mod2)y \cdot s = 0 \pmod{2}, meaning the measurement always yields a string yy orthogonal to ss (in the binary inner product sense).

Repeating this procedure O(n)O(n) times gives nn linearly independent equations yis=0y_i \cdot s = 0, from which ss can be determined by Gaussian elimination over GF(2)\text{GF}(2).

Complexity analysis

ApproachQuery complexity
Classical deterministicΘ(2n/2)\Theta(2^{n/2}) (birthday bound)
Classical randomizedΘ(2n/2)\Theta(2^{n/2})
Quantum (Simon’s)O(n)O(n)

The exponential separation is in the query complexity model. The classical lower bound comes from a birthday-type argument: any classical algorithm must query enough inputs to find a collision f(x)=f(y)f(x) = f(y) with xyx \neq y, which requires Ω(2n/2)\Omega(2^{n/2}) queries by the birthday paradox.

Historical significance

Simon’s algorithm is historically pivotal for two reasons:

  1. It provided the first exponential quantum speedup, predating Shor’s algorithm by about a year. The speedup is proven unconditionally in the query model (no complexity-theoretic assumptions needed).

  2. It directly inspired Shor’s algorithm. Shor recognized that the hidden subgroup structure in Simon’s problem had an analogue in the integers: finding the period of a function f(x)=axmodNf(x) = a^x \bmod N is a hidden subgroup problem over Z\mathbb{Z}, solvable using the quantum Fourier transform instead of Hadamard transforms.

This conceptual connection, from Simon’s problem over Z2n\mathbb{Z}_2^n to the period-finding problem over Z\mathbb{Z}, is one of the most important intellectual threads in quantum algorithm design.

Why it matters for learners

Simon’s algorithm is the clearest demonstration of exponential quantum speedup in a setting simple enough to fully understand. It introduces the hidden subgroup problem framework, which unifies many quantum algorithms, and it shows the power of combining superposition, interference, and classical post-processing. If you understand Simon’s algorithm well, you have the conceptual foundation for understanding Shor’s algorithm.

See also