Simon's Algorithm

Graduate Depth 130 in the knowledge graph I know this Set as goal
Unlocks 1 downstream topic
Simon hidden-subgroup period-finding exponential-speedup

Core Idea

Simon's algorithm finds a hidden period string s for a function f:{0,1}^n -> {0,1}^n satisfying f(x) = f(y) if and only if x = y or x = y xor s. Classically, finding s requires O(2^(n/2)) queries (birthday bound). Simon's algorithm uses O(n) quantum queries, each producing a random vector orthogonal to s, and classical Gaussian elimination recovers s — achieving an exponential speedup. It was the first algorithm to prove an exponential quantum advantage over all classical algorithms (including probabilistic ones) and directly inspired Shor's factoring algorithm.

Explainer

Simon's problem is the bridge between the toy oracle problems (Deutsch-Jozsa, Bernstein-Vazirani) and the practically significant quantum algorithms (Shor). You are given a black-box function f:{0,1}^n -> {0,1}^n with the promise that there exists a secret string s such that f(x) = f(y) if and only if x = y or x = y xor s. If s = 0...0, the function is one-to-one; otherwise, it is two-to-one with period s. Your task is to find s.

Classically, this is essentially a collision-finding problem. By the birthday paradox, you need O(2^(n/2)) queries before you expect to find a collision f(x) = f(y) with x != y, from which s = x xor y. No classical algorithm — deterministic or randomized — can do substantially better. Simon's quantum algorithm uses only O(n) queries and O(n^2) total time (including classical post-processing), achieving an exponential speedup.

The quantum subroutine works as follows. Prepare two n-qubit registers, both initialized to |0>^n. Apply Hadamard to the first register to create a uniform superposition. Apply the oracle to compute f into the second register, producing the state (1/sqrt(2^n)) sum_x |x>|f(x)>. Now measure the second register, obtaining some value f(x_0). The first register collapses to (|x_0> + |x_0 xor s>)/sqrt(2) — a superposition of the two preimages. Apply Hadamard to the first register and measure, obtaining a random n-bit string y. The key constraint is that y dot s = 0 (mod 2): only strings orthogonal to s have nonzero amplitude after the Hadamard transform, because the two terms |x_0> and |x_0 xor s> interfere constructively only for such y.

Each run yields one random equation y dot s = 0 (mod 2). After O(n) runs, you have a system of linear equations over GF(2) that you solve by Gaussian elimination. With high probability, n-1 of these equations are linearly independent, uniquely determining s (the only nontrivial element of the null space of the constraint matrix). The total cost is O(n) quantum oracle queries plus O(n^3) classical computation for Gaussian elimination — exponentially better than the classical 2^(n/2). Simon's algorithm established the template of quantum Fourier sampling that Shor later adapted: create a periodic quantum state, apply a Fourier transform to extract the period, and use classical post-processing to recover the answer.

Practice Questions 3 questions

Prerequisite Chain

Counting to 10Counting to 20Understanding ZeroThe Number ZeroCounting to FiveOne-to-One CorrespondenceCombining Small Groups Within 5Addition Within 10Addition Within 20Two-Digit Addition Without RegroupingTwo-Digit Addition with RegroupingAddition Within 100Repeated Addition as MultiplicationMultiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Two-Digit by One-Digit DivisionDivision with RemaindersRemainders and Quotients in DivisionDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueReading and Writing DecimalsComparing and Ordering DecimalsAdding and Subtracting DecimalsMultiplying DecimalsDividing DecimalsDividing FractionsMixed Number ArithmeticOrder of OperationsInteger Order of OperationsVariable ExpressionsCombining Like TermsOne-Step EquationsTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesAngle Pairs: Complementary, Supplementary, and VerticalParallel Lines and TransversalsCorresponding AnglesAlternate Interior AnglesTriangle Angle Sum TheoremExterior Angle TheoremTriangle Inequality TheoremSimilar Triangles: AA SimilaritySimilar Triangles: SSS and SAS SimilarityProportions in Similar TrianglesRight Triangle Trigonometry IntroductionTrigonometric Ratios ReviewRadian MeasureConverting Between Degrees and RadiansThe Unit CircleGraphing Sine and CosineGraphing Tangent and Reciprocal Trigonometric FunctionsDerivatives of Trigonometric FunctionsAntiderivativesIterated Integrals and Fubini's TheoremDouble Integrals in Cartesian CoordinatesDouble Integrals over Rectangular RegionsDouble Integrals in Polar CoordinatesDouble Integrals: Definition and SetupIterated Integrals and Fubini's TheoremDouble Integrals over Rectangular RegionsDouble Integrals over General RegionsApplications of Double Integrals: Area, Mass, and MomentsTriple Integrals in Cartesian CoordinatesTriple Integrals in Cylindrical and Spherical CoordinatesChange of Variables and the Jacobian DeterminantApplications of Triple Integrals: Volume and MassVector Fields and Their RepresentationsLine Integrals of Vector FieldsGreen's TheoremSurface Integrals and Flux of Vector FieldsSurface Integrals and Flux of Vector FieldsDivergence Theorem: Flux and OutflowDivergence TheoremElectric FluxGauss's LawConductors in Electrostatic EquilibriumCapacitance and CapacitorsDielectricsDielectric Constant and Relative PermittivityElectric Field Inside Dielectric MaterialsDielectric Materials and PolarizationDielectric Susceptibility and PermittivityEnergy Density in Electric FieldsElectric Current and Current DensityElectrical Resistance and ResistivityOhm's Law and Circuit ElementsElectromotive Force (EMF) and BatteriesKirchhoff's Circuit Laws: Voltage and CurrentDC Circuit Network Analysis MethodsTransient Response in RC CircuitsRC CircuitsLC and RLC CircuitsAC Circuits: FundamentalsImpedance and ReactanceAC Power and ResonanceElectromagnetic WavesThe Electromagnetic SpectrumBlackbody Radiation and Planck's LawPhotoelectric EffectThe Photon: Light as QuantaCompton ScatteringWave-Particle Dualityde Broglie WavelengthHeisenberg Uncertainty PrincipleWavefunction and the Born RuleThe Schrödinger EquationSchrödinger Equation: Time-Dependent FormWavefunctions and Boundary ConditionsBoundary Value Problems in ElectrostaticsParticle in a Box (Infinite Square Well)Quantum NumbersSpin-1/2 SystemsPauli MatricesQuantum GatesQuantum CircuitsDeutsch-Jozsa AlgorithmBernstein-Vazirani AlgorithmSimon's Algorithm

Longest path: 131 steps · 674 total prerequisite topics

Prerequisites (2)

Leads To (1)