Quantum computational complexity
Clear, exam-oriented notes on quantum computational complexity: definitions of the main complexity classes (P, BPP, BQP, QMA, PP, PSPACE), standard inclusions and what is unknown, with exact definitions, proofs/sketches (BPP ⊆ BQP and BQP ⊆ PP), diagram instructions, formulas, worked exam-style answ
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Quantum computational complexity tells an engineer which problems quantum computers can solve faster or with different resources than classical computers. For hardware or software engineers this guides which algorithms to implement on quantum devices (for example, choosing Shor's algorithm because factoring lies in BQP) and which problems remain hard even for quantum machines (for example, NP-complete problems are not known to be in BQP).
Key ideas
Start by defining terms used below.
- Decision problem: a problem whose answer is YES or NO for each input string. Used to define complexity classes.
- Polynomial time: an algorithm (deterministic or probabilistic or quantum) runs in time bounded by a polynomial p(n) in the input length n.
- Uniform family of circuits: a sequence of circuits {C_n} such that there is a (classical) Turing machine producing the description of C_n in time polynomial in n. This ensures we are not hiding non-uniform advice.
- Bounded-error quantum polynomial time (BQP): the class of decision problems for which there exists a uniform family of polynomial-size quantum circuits {C_n} such that for every input x of length n the circuit outputs the correct answer with probability at least 2/3, and wrong answer with probability at most 1/3. The constants 2/3 and 1/3 are arbitrary constants strictly between 1/2 and 1 and can be amplified to exponentially small error.
- Bounded-error probabilistic polynomial time (BPP): like BQP, but circuits are classical randomized circuits (or polynomial-time randomized Turing machines) with two-sided error bounded by 1/3.
- Probabilistic polynomial time (PP): the class of decision problems solvable by a polynomial-time probabilistic Turing machine that accepts with probability strictly greater than 1/2 for YES instances and at most 1/2 for NO instances. (No bounded-gap requirement.)
- Quantum Merlin–Arthur (QMA): the quantum analogue of NP. A language is in QMA if there is a polynomial-time uniform quantum verifier circuit that given a polynomial-size quantum witness state two-sidedly tests membership with completeness at least 2/3 and soundness at most 1/3.
- PSPACE: the class of problems solvable by a classical Turing machine using polynomial space (memory), regardless of time.
Exact statements of commonly used inclusions and assumptions (state them as you might in an exam):
- P ⊆ BPP ⊆ BQP ⊆ AWPP ⊆ PP ⊆ PSPACE. Assumptions: standard definitions of these classes, uniformity of circuit families, and acceptance probabilities as defined above. Each inclusion is proved below or sketched; a tighter known containment is BQP ⊆ AWPP ⊆ PP (Fortnow–Rogers), and a related fact is PostBQP = PP (Aaronson).
- NP ⊆ QMA (a classical witness can be presented as a quantum state encoding the classical string; verifier ignores superposition). Relationship between NP and BQP is unknown: it is not known whether NP ⊆ BQP or BQP ⊆ NP. Also, QMA ⊆ PP ⊆ PSPACE is known (via Marriott–Watrous amplification and the containment QMA ⊆ A0PP ⊆ PP).
- Error-amplification (amplification theorem for BQP): if a language L is in BQP with one-sided/bounded error c < 1/2, then by repeating and taking majority (or by using other quantum amplification procedures) you can reduce the error to exponentially small in polynomial extra time. For QMA the amplification is possible but requires care (Marriott–Watrous amplification): completeness and soundness can be amplified while keeping witness size polynomial.
Proof sketches/exact derivations universities expect:
- Proof (sketch) that BPP ⊆ BQP: simulate classical randomness by applying Hadamard gates to fresh ancilla qubits to create uniform superposition over bits; simulate classical boolean gates with reversible (Toffoli) gates embedded in quantum circuits; measure the output qubit(s) to sample the classical randomized machine's distribution. Because quantum circuits can implement all classical reversible logic, any polynomial-time randomized classical algorithm can be implemented by a polynomial-size quantum circuit with the same acceptance probabilities. Diagram to draw: a two-row circuit: top row labeled "work qubits" implementing reversible classical computation; bottom row labeled "ancilla random qubits" prepared by H gates to produce uniform randomness; final measurement qubit labeled OUTPUT.
- Proof (outline) that BQP ⊆ PP (Adleman–DeMarrais–Huang style): For a quantum circuit with m gates on n qubits, the acceptance probability is a sum of squared magnitudes of amplitudes. Each amplitude is a sum of exponentially many terms, each term a product of matrix entries from gates (which are constant-sized matrices). For gates with entries that are algebraic (or rational approximable), the acceptance probability can be expressed as a GapP function divided by an exponential normalising factor. Thus deciding whether acceptance probability ≥ 2/3 reduces to comparing a GapP function to zero, which is in PP. The full technical proof requires defining GapP and showing the mapping; provide this in exams as a clear outline and cite that the result is standard.
Diagram instruction for an exam answer: draw a Venn-style diagram (no need to be to scale) with nested or overlapping regions: draw a circle labelled PSPACE. Inside it draw a smaller circle labelled PP. Inside that draw BQP, inside that BPP, and inside that P. Draw NP as a circle that contains P (since P ⊆ NP) and is placed with unknown overlap relative to BQP (so that P lies in the intersection of NP and BQP); do not depict NP as merely overlapping P/BPP without containment. Label the NP–BQP overlap "unknown relationship". Add an arrow from "Shor's algorithm (factoring)" pointing to BQP, to indicate an example problem in BQP not known in P.
Assumptions to state when writing proofs:
- The gate set for quantum circuits is fixed and universal (e.g., {H, T, CNOT}) and entries are efficiently approximable numbers.
- Uniformity: circuits are generated by a classical polynomial-time Turing machine.
- Probabilities are defined via Born rule (measurement of a designated output qubit produces accept with specified probability). Also note that, in rigorous treatments, BQP and QMA are promise-problem classes; unless otherwise stated, adopt the promise-problem formulation.
Clarification: It is known that BQP ⊆ AWPP ⊆ PP ⊆ PSPACE (Fortnow–Rogers), and that PostBQP = PP (Aaronson). The GapP-based containment proofs fix constant thresholds via standard amplification and comparisons to zero.
Formulas
Pr[accept] ≥ 2/3 — Pr[accept] is the probability the quantum circuit outputs YES, dimensionless, applies in defining membership in BQP when the input is a YES instance.
Pr[accept] ≤ 1/3 — applies for NO instances in BQP.
BPP ⊆ BQP ⊆ PP ⊆ PSPACE — each symbol denotes a complexity class as defined above; inclusion inequality means every language in the left class is also in the right class.
P ⊆ BPP — deterministic polynomial-time algorithms are a subset of randomized polynomial-time.
NP ⊆ QMA — NP (nondeterministic polynomial time) is contained in QMA (quantum proof verification with bounded error).
GapP — shorthand for the class of integer-valued functions equal to the difference of two #P functions; used in formal proofs connecting quantum amplitudes to counting classes.
error_amplification: new_error ≤ exp(-poly(n)) — meaning bounded error for BQP can be reduced to exponentially small in polynomial extra work (new_error is probability of incorrect answer after amplification), applies to BQP and via Marriott–Watrous to QMA with care.
Worked examples
Example 1 — Show BPP ⊆ BQP (model answer expected in an exam):
- State what to prove: every language decided by a polynomial-time randomized classical machine with error ≤ 1/3 can be decided by a polynomial-size quantum circuit with error ≤ 1/3.
- Construction: replace each classical random coin flip by preparing an ancilla qubit in state H|0> = (|0> + |1>)/√2 and measuring it when the classical machine would use the random bit. Better: perform the entire classical randomized algorithm reversibly using Toffoli and NOT gates implemented as quantum gates; randomness comes from ancilla qubits initialized by H gates and measured only when required. The reversible simulation uses at most polynomial extra space and gates.
- Argue correctness: the quantum circuit samples uniformly over the ancilla measurement outcomes; since the classical algorithm's acceptance probability is defined over uniform random bits, the quantum circuit's acceptance probability equals the classical one. Hence the language is in BQP.
- Complexity: the size of the quantum circuit is polynomial because each classical step becomes a constant number of reversible quantum gates. Final statement (bold for exam): Therefore BPP ⊆ BQP.
Example 2 — Sketch the proof BQP ⊆ PP (exam-style long answer):
- Define the quantum circuit: have an n-qubit input and a uniform family of polynomial-size circuits composed from a finite gate set whose matrix entries are algebraic or efficiently approximable numbers.
- Write the acceptance probability as a sum of squared magnitudes of amplitudes; each amplitude is a sum over exponentially many computational paths, where each path contributes a product of constant-size gate matrix entries.
- Observe that the acceptance probability can be expressed as a rational number whose numerator is a GapP function (difference of two #P counts) and denominator is an explicit power-of-two (or other exponential) factor coming from normalization.
- Deciding whether this probability exceeds 1/2 (or ≥ 2/3 compared to ≤ 1/3) can be reduced to comparing an integer GapP value to zero — which defines a PP computation. Therefore BQP ⊆ PP.
- Conclude: BQP ⊆ PP ⊆ PSPACE. Note: in an exam, give explicit expressions for amplitudes for small circuits to demonstrate the counting structure, and cite Adleman–DeMarrais–Huang for the formal mapping.
Common mistakes
- Forgetting uniformity: writing a family of circuits without showing how to generate C_n in polynomial time.
- For BQP ⊆ PP proofs, trying to show exact counting (#P) instead of using GapP differences; the technical step is to convert amplitudes into GapP-type expressions.
- In BPP ⊆ BQP constructions, failing to make the classical reversible simulation (using Toffoli) explicit and leaving out measurements that extract randomness.
For your exam
Typical question types:
- Definitions: define BQP, QMA, PP, GapP; give differences between BPP and BQP.
- Short notes: explain containment relationships (P, BPP, BQP, PP, PSPACE), amplification, and why NP vs BQP is unknown.
- Derivations/proofs: show BPP ⊆ BQP (full construction), outline BQP ⊆ PP (counting argument), prove amplification for BQP.
- Diagrams: draw a Venn diagram of classes with unknown overlaps and annotate with example problems (e.g., factoring in BQP).
- Theory questions: explain QMA and how it generalizes NP; discuss oracle separations (sketch). What full-marks answers include:
- Precise definitions with error bounds and uniformity condition.
- Exact statements of inclusions and clear assumptions.
- Correct constructions or proof sketches with key technical steps (e.g., reversible simulation, amplitude-to-counting mapping).
- A small diagram when requested and clear labelling.
Quick check
- Define BQP in one sentence.
- Give one known containment involving BQP and explain whether NP ⊆ BQP is known.
- Why can we simulate a classical randomized algorithm on a quantum computer without increasing asymptotic time (up to polynomial factors)? Answers: 1) BQP is the class of decision problems solvable by a uniform family of polynomial-size quantum circuits with two-sided bounded error (e.g., accept probability ≥ 2/3 on YES instances). 2) BPP ⊆ BQP and BQP ⊆ PP (known); whether NP ⊆ BQP is unknown. 3) Because quantum circuits can implement reversible classical computation (Toffoli) and generate randomness using Hadamard-prepared ancilla, so each classical step maps to a constant number of quantum gates giving polynomial overhead.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?