Fiveable

โžฟQuantum Computing Unit 6 Review

QR code for Quantum Computing practice questions

6.3 Simon's algorithm: problem statement and implementation

6.3 Simon's algorithm: problem statement and implementation

Written by the Fiveable Content Team โ€ข Last updated August 2025
Written by the Fiveable Content Team โ€ข Last updated August 2025
โžฟQuantum Computing
Unit & Topic Study Guides

Simon's algorithm tackles a problem involving a secret string and a special function. It showcases quantum computing's power by solving it exponentially faster than classical methods. This efficiency stems from exploiting quantum superposition and interference.

The algorithm's implementation involves preparing quantum states, querying an oracle function, and measuring results. It demonstrates a clear quantum advantage, requiring only O(n) queries compared to classical algorithms' ฮฉ(2^(n/2)) queries.

Simon's Algorithm: Problem Statement and Implementation

Problem statement of Simon's algorithm

  • Involves finding a secret string ss given a function ff that is either one-to-one or two-to-one with a specific property
  • For a two-to-one function, any two distinct inputs xx and yy satisfy f(x)=f(y)f(x) = f(y) if and only if xโŠ•y=sx \oplus y = s, where โŠ•\oplus denotes bitwise XOR (exclusive OR)
  • Solves the problem exponentially faster than the best known classical algorithm
    • Classical algorithm requires ฮฉ(2n/2)\Omega(2^{n/2}) queries to ff (nn is the input size)
    • Simon's algorithm solves the problem with only O(n)O(n) queries to ff and O(n3)O(n^3) additional quantum gates
  • Demonstrates quantum advantage by solving a problem more efficiently using a quantum algorithm compared to the best known classical algorithm (exponential speedup)

Periodic functions in Simon's problem

  • In Simon's problem, the function ff is periodic (repeating pattern) if it is two-to-one
  • Periodicity is defined by the secret string ss
    • For any two distinct inputs xx and yy, f(x)=f(y)f(x) = f(y) if and only if xโŠ•y=sx \oplus y = s
  • The periodicity of ff allows Simon's algorithm to find the secret string ss efficiently by exploiting quantum superposition (multiple states simultaneously) and interference (constructive and destructive)
Problem statement of Simon's algorithm, Quantum Computing

Implementation of Simon's algorithm

  1. Prepare a uniform superposition over all input states by applying Hadamard gates to nn qubits initialized to โˆฃ0โŸฉ|0\rangle
  2. Query the oracle function ff using the superposition state as input, mapping โˆฃxโŸฉโˆฃ0โŸฉ|x\rangle|0\rangle to โˆฃxโŸฉโˆฃf(x)โŸฉ|x\rangle|f(x)\rangle
  3. Measure the second register (output of ff) and discard it, collapsing the state to a superposition of inputs that map to the same output under ff
  4. Apply Hadamard gates to the remaining nn qubits
  5. Measure the nn qubits to obtain a random nn-bit string yy, which is guaranteed to be orthogonal (perpendicular) to the secret string ss under the bitwise dot product
  6. Repeat steps 1-5 for O(n)O(n) iterations to obtain a set of linearly independent strings yiy_i
  7. Solve the system of linear equations yiโ‹…s=0y_i \cdot s = 0 to find the secret string ss

Performance vs classical solutions

  • Simon's algorithm has a quantum query complexity of O(n)O(n)
    • Requires O(n)O(n) queries to the oracle function ff
    • Additional O(n3)O(n^3) quantum gates for the Hadamard transforms and measurements
  • Best known classical algorithm for Simon's problem has a query complexity of ฮฉ(2n/2)\Omega(2^{n/2}), exponentially worse than Simon's algorithm
  • Provides an exponential speedup over classical algorithms for this specific problem
  • Demonstrates the potential of quantum algorithms to outperform classical algorithms for certain tasks (integer factorization, database search)
  • Laid the foundation for more practical quantum algorithms, such as Shor's algorithm for factoring integers (cryptography implications)