|q⟩ Bad Qubits

intermediate · Programming · The Hidden Subgroup Problem (Intro)

Simon’s Problem

Setting the stage

Before quantum computers were expected to factor large numbers they were expected to do something more elementary: solve a hidden-structure problem in exponentially fewer queries than any classical computer. That is exactly what Simon's algorithm does, and the key to understanding it is first grasping the problem it solves.

The problem

You are given black-box (oracle) access to a function

f:{0,1}n    {0,1}nf : \{0,1\}^n \;\to\; \{0,1\}^n

that satisfies a promise: there exists a secret string s{0,1}ns \in \{0,1\}^n such that for all x,y{0,1}nx, y \in \{0,1\}^n,

f(x)=f(y)        y=xs.f(x) = f(y) \;\iff\; y = x \oplus s.

Here \oplus denotes bitwise XOR. Two cases cover every allowed ff:

Goal: determine ss using as few queries to ff as possible.

Why it is hard classically

A classical algorithm must find two inputs xyx \neq y with f(x)=f(y)f(x) = f(y) to identify a non-trivial ss, or it must check enough distinct outputs to certify that ff is injective. By a birthday-paradox argument, finding a collision requires Ω(2n)\Omega(\sqrt{2^n}) queries in the worst case — exponential in nn. More carefully, any classical (even randomised) algorithm needs at least Ω(2n/2)\Omega(2^{n/2}) queries to succeed with constant probability (de Wolf, Lecture Notes, Theorem 6.5).

Simon's promise as an HSP

Simon's problem is the simplest non-trivial instance of the Hidden Subgroup Problem (HSP). The group is (Z2)n(\mathbb{Z}_2)^n (bit strings under XOR), and the hidden subgroup HH is

H={0n,  s}(Z2)n.H = \{0^n,\; s\} \subseteq (\mathbb{Z}_2)^n.

When s=0ns = 0^n the subgroup is trivial (H={0n}H = \{0^n\}); when s0ns \neq 0^n the subgroup has order 2. The function ff is constant on the cosets of HH and distinct across them — precisely the HSP promise applied to this abelian group.

Deutsch-Jozsa is the n=1n = 1 special case: the "is ff constant or balanced?" question translates to "is s=0s = 0 or s=1s = 1?" Simon's problem generalises this to arbitrary nn, introducing the full collision structure that makes the exponential quantum speedup possible.

The quantum advantage — a preview

Simon's algorithm (covered in the next lesson) makes O(n)O(n) quantum queries to ff and recovers ss with high probability. The circuit uses two nn-qubit registers:

  1. Prepare the first register in a uniform superposition 12nxx0\frac{1}{\sqrt{2^n}}\sum_x |x\rangle |0\rangle.
  2. Query the oracle to entangle both registers: 12nxxf(x)\frac{1}{\sqrt{2^n}}\sum_x |x\rangle |f(x)\rangle.
  3. Measure the second register. The post-measurement state of the first register collapses to the uniform superposition over the coset {x0,  x0s}\{x_0,\; x_0 \oplus s\} for some random x0x_0.
  4. Apply nn Hadamard gates to the first register. The amplitudes constructively interfere only on bit strings yy satisfying ys0(mod2)y \cdot s \equiv 0 \pmod{2} (where \cdot is the bitwise inner product). Measuring yields such a yy.

After O(n)O(n) rounds the learner accumulates n1n - 1 linearly independent constraints ys=0y \cdot s = 0 over F2\mathbb{F}_2, from which ss is recovered by Gaussian elimination. The total query count is O(n)O(n) — exponentially fewer than the classical lower bound of Ω(2n/2)\Omega(2^{n/2}).

Formalising the promise

To be precise: an oracle for Simon's problem is any function ff satisfying the two-to-one (or injective) condition above. A quantum algorithm is allowed to call the quantum oracle Of:xyxyf(x)O_f : |x\rangle|y\rangle \mapsto |x\rangle|y \oplus f(x)\rangle in superposition. Classical algorithms may only evaluate ff on one input at a time.

The remarkable fact Simon proved in 1994 (published 1997) is that this exponential query separation is unconditional — it holds in the black-box model regardless of computational complexity assumptions. This was the first unconditional, non-trivial exponential quantum speedup and directly inspired Shor to look for an exponential speedup in the non-black-box (structured) setting, leading to the factoring algorithm.

Sign in on the full site to ask questions and join the discussion.