Quantum Algorithm Paradigms
Quantum algorithms achieve speedups over classical algorithms through three main mechanisms:
- Quantum parallelism β superposition allows evaluating a function on all inputs simultaneously
- Interference β amplifying correct answers while canceling wrong ones
- Entanglement β correlating qubits to encode global properties
The most significant speedups come from algorithms using the quantum Fourier transform (QFT) as a subroutine.
Deutsch-Jozsa Algorithm
The Deutsch-Jozsa algorithm determines whether a Boolean function is constant or balanced with a single query, whereas a classical algorithm requires queries in the worst case.
Algorithm Steps
- Prepare qubits in and one ancilla in
- Apply Hadamard to all qubits
- Apply the oracle (phase oracle)
- Apply Hadamard to the first qubits
- Measure the first qubits
The output is if is constant, and a non-zero state if is balanced.
Simon's Algorithm
Simon's algorithm finds a hidden period of a function where:
Classically, this requires queries (birthday paradox). Simon's algorithm uses only queries.
Key Insight
The quantum circuit uses the same structure as Shor's algorithm. By measuring the output of in superposition and applying the QFT, we obtain linearly independent equations modulo 2 that determine .
Quantum Speedup Hierarchy
| Algorithm | Classical | Quantum | Speedup |
|---|---|---|---|
| Unstructured search | O(N) | O(sqrtN) | Quadratic |
| Integer factoring | O(e^n^1/3) | O(n^3) | Super-polynomial |
| Simulation of dynamics | O(2^n) | O(n) | Exponential |
| Linear systems | O(N kappa) | O(log N cdot kappa) | Exponential |
The dequantization results of Tang (2018) showed that some quantum machine learning speedups can be matched classically, highlighting the subtlety of quantum advantage claims.
Quantum Advantage
Quantum advantage (or supremacy) refers to demonstrating a computational task that a quantum computer can solve faster than any classical computer.
In 2019, Google's Sycamore processor performed random circuit sampling in 200 seconds, claiming this would take a classical supercomputer 10,000 years. IBM contested this, estimating 2.5 days with better classical algorithms.
The key criteria for quantum advantage:
- The task must be well-defined and verifiable
- The quantum algorithm must be proven or believed to have no efficient classical simulation
- The quantum computer must actually implement the algorithm correctly
Amplitude Amplification
The amplitude amplification framework generalizes Grover's search. For an algorithm that succeeds with probability , amplitude amplification boosts the success probability to 1 using applications of the Grover operator:
where prepares the initial state and marks the target states.
This provides a quadratic speedup for any algorithm whose success probability is bounded away from zero.
Python: Deutsch-Jozsa Oracle
import numpy as np
def deutsch_jozsa_oracle(n, balanced=True):
# Create a Deutsch-Jozsa oracle as a unitary matrix.
N = 2 ** (n + 1)
oracle = np.zeros((N, N), dtype=complex)
for x in range(2**n):
for y in range(2):
fx = x & 1 if balanced else 0
out = y ^ fx
oracle[out * 2**n + x, y * 2**n + x] = 1
return oracle
# Test with n=2 qubits
n = 2
Uf = deutsch_jozsa_oracle(n, balanced=True)
print(f"Oracle shape: {Uf.shape}")
print(f"Oracle is unitary: {np.allclose(Uf @ Uf.conj().T, np.eye(2**(n+1)))}")
This constructs an oracle for the Deutsch-Jozsa problem and verifies its unitarity.
Quantum Lower Bounds
The quantum query complexity lower bound for unstructured search:
This was proven by Bennett, Bernstein, Brassard, and Vazirani (1997) using the polynomial method and adversary method.
The polynomial method: any quantum algorithm computing with queries produces a polynomial of degree approximating . Since some functions require high-degree polynomial approximation, must be large.
The adversary method: constructs an adversary strategy that forces any quantum algorithm to make many queries.
Algorithm Summary Table
| Algorithm | Problem | Classical | Quantum | Speedup |
|---|---|---|---|---|
| Deutsch-Jozsa | Constant/balanced | 2^n-1+1 | 1 | Exponential |
| Simon's | Hidden subgroup | O(2^n/2) | O(n) | Exponential |
| Shor's | Factoring | e^O(n^1/3) | O(n^3) | Super-poly |
| Grover's | Search | O(N) | O(sqrtN) | Quadratic |
| HHL | Linear systems | O(Nkappa) | O(log N cdot kappa) | Exponential |