In computational complexity theory, bounded-error quantum polynomial time (BQP) is the class of decision problems solvable by a quantum computer in polynomial time, with an error probability of at most 1/3 for all instances. It is the quantum analogue to the complexity class BPP.
A decision problem is a member of BQP if there exists a quantum algorithm (an algorithm that runs on a quantum computer) that solves the decision problem with high probability and is guaranteed to run in polynomial time. A run of the algorithm will correctly solve the decision problem with a probability of at least 2/3.
|BQP algorithm (1 run)|
|Yes||≥ 2/3||≤ 1/3|
|No||≤ 1/3||≥ 2/3|
|BQP algorithm (k runs)|
|Yes||> 1 − 2−ck||< 2−ck|
|No||< 2−ck||> 1 − 2−ck|
|for some constant c > 0|
BQP can be viewed as the languages associated with certain bounded-error uniform families of quantum circuits. A language L is in BQP if and only if there exists a polynomial-time uniform family of quantum circuits , such that
- For all , Qn takes n qubits as input and outputs 1 bit
- For all x in L,
- For all x not in L,
Alternatively, one can define BQP in terms of quantum Turing machines. A language L is in BQP if and only if there exists a polynomial quantum Turing machine that accepts L with an error probability of at most 1/3 for all instances.
Similarly to other "bounded error" probabilistic classes the choice of 1/3 in the definition is arbitrary. We can run the algorithm a constant number of times and take a majority vote to achieve any desired probability of correctness less than 1, using the Chernoff bound. The complexity class is unchanged by allowing error as high as 1/2 − n−c on the one hand, or requiring error as small as 2−nc on the other hand, where c is any positive constant, and n is the length of input.
A BQP-complete problem
Here is an intuitive BQP-complete problem, which stems directly from the definition of BQP.
Given a description of a quantum circuit acting on qubits with gates, where is a polynomial in and each gate acts on one or two qubits, and two numbers , distinguish between the following two cases:
- measuring the first qubit of the state yields with probability
- measuring the first qubit of the state yields with probability
Note that the problem does not specify the behavior if an instance is not covered by these two cases.
Claim. Any BQP problem reduces to APPROX-QCIRCUIT-PROB.
Proof. Suppose we have an algorithm that solves APPROX-QCIRCUIT-PROB, i.e., given a quantum circuit acting on qubits, and two numbers , distinguishes between the above two cases. We can solve any problem in BQP with this oracle, by setting .
For any , there exists family of quantum circuits such that for all , a state of qubits, if ; else if . Fix an input of qubits, and the corresponding quantum circuit . We can first construct a circuit such that . This can be done easily by hardwiring and apply a sequence of CNOT gates to flip the qubits. Then we can combine two circuits to get , and now . And finally, necessarily the results of is obtained by measuring several qubits and apply some (classical) logic gates to them. We can always defer the measurement and reroute the circuits so that by measuring the first qubit of , we get the output. This will be our circuit , and we decide the membership of in by running with . By definition of BQP, we will either fall into the first case (acceptance), or the second case (rejection), so reduces to APPROX-QCIRCUIT-PROB.
APPROX-QCIRCUIT-PROB comes handy when we try to prove the relationships between some well-known complexity classes and BQP.
Relationship to other complexity classes
What is the relationship between and ?
BQP is defined for quantum computers; the corresponding complexity class for classical computers (or more formally for probabilistic Turing machines) is BPP. Just like P and BPP, BQP is low for itself, which means BQPBQP = BQP. Informally, this is true because polynomial time algorithms are closed under composition. If a polynomial time algorithm calls polynomial time algorithms as subroutines, the resulting algorithm is still polynomial time.
BQP contains P and BPP and is contained in AWPP, PP and PSPACE. In fact, BQP is low for PP, meaning that a PP machine achieves no benefit from being able to solve BQP problems instantly, an indication of the possible difference in power between these similar classes. The known relationships with classic complexity classes are:
As the problem of P ≟ PSPACE has not yet been solved, the proof of inequality between BQP and classes mentioned above is supposed to be difficult. The relation between BQP and NP is not known. In May 2018, computer scientists Ran Raz of Princeton University and Avishay Tal of Stanford University published a paper which showed that, relative to an oracle, BQP was not contained in PH.
We will prove or discuss some of these results below.
BQP and EXP
We begin with an easier containment. To show that , it suffices to show that APPROX-QCIRCUIT-PROB is in EXP since APPROX-QCIRCUIT-PROB is BQP-complete.
The idea is simple. Since we have exponential power, given a quantum circuit C, we can use classical computer to stimulate each gate in C to get the final state.
More formally, let C be a polynomial sized quantum circuit on n qubits and m gates, where m is polynomial in n. Let and be the state after the i-th gate in the circuit is applied to . Each state can be represented in a classical computer as a unit vector in . Furthermore, each gate can be represented by a matrix in . Hence, the final state can be computed in time, and therefore all together, we have an time algorithm for calculating the final state, and thus the probability that the first qubit is measured to be one. This implies that .
Note that this algorithm also requires space to store the vectors and the matrices. We will show in the following section that we can improve upon the space complexity.
BQP and PSPACE
To prove , we first introduce a technique called the sum of histories.
Consider a quantum circuit C, which consists of t gates, , where each comes from a universal gate set and acts on at most two qubits. To understand what the sum of histories is, we visualize the evolution of a quantum state given a quantum circuit as a tree. The root is the input , and each node in the tree has children, each representing a state in . The weight on a tree edge from a node in j-th level representing a state to a node in -th level representing a state is , the amplitude of after applying on . The transition amplitude of a root-to-leaf path is the product of all the weights on the edges along the path. To get the probability of the final state being , we sum up the amplitudes of all root-to-leave paths that ends at a node representing .
More formally, for the quantum circuit C, its sum over histories tree is a tree of depth m, with one level for each gate in addition to the root, and with branching factor .
Define — A history is a path in the sum of histories tree. We will denote a history by a sequence for some final state x.
Define — Let . Let amplitude of the edge in the j-th level of the sum over histories tree be . For any history , the transition amplitude of the history is the product .
Claim — For a history . The transition amplitude of the history is computable in polynomial time.
Each gate can be decomposed into for some unitary operator acting on two qubits, which without loss of generality can taken to be the first two. Hence, which can be computed in polynomial time in n. Since m is polynomial in n, the transition amplitude of the history can be computed in polynomial time.
Claim — Let be the final state of the quantum circuit. For some , the amplitude can be computed by .
We have . The result comes directly by inserting between , and , and so on, and then expand out the equation. Then each term corresponds to a , where
Notice in the sum over histories algorithm to compute some amplitude , only one history is stored at any point in the computation. Hence, the sum over histories algorithm uses space to compute for any x since bits are needed to store the histories in addition to some workspace variables.
Therefore, in polynomial space, we may compute over all x with the first qubit being 1, which is the probability that the first qubit is measured to be 1 by the end of the circuit.
Notice that compared with the simulation given for the proof that , our algorithm here takes far less space but far more time instead. In fact it takes time to calculate a single amplitude!
BQP and PP
A similar sum-over-histories argument can be used to show that . 
BQP, P, and NP
First of all, we know , since every classical circuit can be simulated by a quantum circuit. 
It is conjectured that BQP solves hard problems outside of P, specifically, problems in NP. The claim is indefinite because we don't know if P=NP, so we don't know if those problems are actually in P. Below are some evidence of the conjecture:
- Integer factorization (see Shor's algorithm)
- Discrete logarithm
- Simulation of quantum systems (see universal quantum simulator)
- Approximating the Jones polynomial at certain roots of unity
- Harrow-Hassidim-Lloyd (HHL) algorithm
However, we also know an analogue of in a "black-box" sense. Consider the unstructured search problem: given an oracle access to an unknown function , find x such that . This problem is clearly in NP. The optimal quantum algorithm for this problem, on the other hand, is Grover's algorithm, which has a complexity of if only allowed to access f via that oracle.
- Hidden subgroup problem
- Polynomial hierarchy (PH)
- Quantum complexity theory
- QMA, the quantum equivalent to NP.
- Michael Nielsen and Isaac Chuang (2000). Quantum Computation and Quantum Information. Cambridge: Cambridge University Press. ISBN 0-521-63503-9.
- Bernstein, Ethan; Vazirani, Umesh (October 1997). "Quantum Complexity Theory". SIAM Journal on Computing. 26 (5): 1411–1473. CiteSeerX 10.1.1.655.1186. doi:10.1137/S0097539796300921.
- Barak, Sanjeev Arora, Boaz (2009). Computational Complexity: A Modern Approach / Sanjeev Arora and Boaz Barak. Cambridge. p. 122. Retrieved 24 July 2018.
- Michael A. Nielsen; Isaac L. Chuang (9 December 2010). "4.4 Measurement". Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press. p. 186. ISBN 978-1-139-49548-6.
- Odel A. Cross (5 November 2012). "5.2.2 Deferred Measurement". Topics in Quantum Computing. O. A. Cross. p. 348. ISBN 978-1-4800-2749-7.
- Fortnow, Lance; Rogers, John (1999). "Complexity limitations on Quantum computation" (PDF). J. Comput. Syst. Sci. 59 (2): 240–252. arXiv:cs/9811023. doi:10.1006/jcss.1999.1651. ISSN 0022-0000. S2CID 42516312.
- L. Adleman, J. DeMarrais, and M.-D. Huang. Quantum computability. SIAM J. Comput., 26(5):1524–1540, 1997.
- George, Michael Goderbauer, Stefan. "ECCC - TR18-107". eccc.weizmann.ac.il. Retrieved 2018-08-03.
- Aaronson, Scott (2005). "Quantum computing, postselection, and probabilistic polynomial-time". Proceedings of the Royal Society A. 461 (2063): 3473–3482. arXiv:quant-ph/0412187. Bibcode:2005RSPSA.461.3473A. doi:10.1098/rspa.2005.1546. S2CID 1770389.. Preprint available at 
- Aaronson, Scott (2004-01-11). "Complexity Class of the Week: PP". Computational Complexity Weblog. Retrieved 2008-05-02.
- E. Bernstein and U. Vazirani. Quantum complexity theory, SIAM Journal on Computing, 26(5):1411-1473, 1997.
- L. Adleman, J. DeMarrais, and M. Huang. Quantum computability, SIAM Journal on Comput- ing 26:1524-1540, 1997.
- Nielsen, Michael A.; Chuang, Isaac L. (2000), Quantum Computation and Quantum Information, Cambridge: Cambridge University Press, ISBN 0-521-63235-8, MR 1796805.
- arXiv:quant-ph/9508027v2 Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer, Peter W. Shor
- Zalka, Christof (1999-10-01). "Grover's quantum searching algorithm is optimal". Physical Review A. 60 (4): 2746–2751. arXiv:quant-ph/9711070. doi:10.1103/PhysRevA.60.2746.