--- title: "BQP" chunk: 3/3 source: "https://en.wikipedia.org/wiki/BQP" category: "reference" tags: "science, encyclopedia" date_saved: "2026-05-05T11:06:41.292100+00:00" instance: "kb-cron" --- Consider a quantum circuit C, which consists of t gates, g 1 , g 2 , ⋯ , g m {\displaystyle g_{1},g_{2},\cdots ,g_{m}} , where each g j {\displaystyle g_{j}} 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 | 0 ⟩ ⊗ n {\displaystyle |0\rangle ^{\otimes n}} , and each node in the tree has 2 n {\displaystyle 2^{n}} children, each representing a state in C n {\displaystyle \mathbb {C} ^{n}} . The weight on a tree edge from a node in j-th level representing a state | x ⟩ {\displaystyle |x\rangle } to a node in j + 1 {\displaystyle j+1} -th level representing a state | y ⟩ {\displaystyle |y\rangle } is ⟨ y | g j + 1 | x ⟩ {\displaystyle \langle y|g_{j+1}|x\rangle } , the amplitude of | y ⟩ {\displaystyle |y\rangle } after applying g j + 1 {\displaystyle g_{j+1}} on | x ⟩ {\displaystyle |x\rangle } . 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 | ψ ⟩ {\displaystyle |\psi \rangle } , we sum up the amplitudes of all root-to-leave paths that ends at a node representing | ψ ⟩ {\displaystyle |\psi \rangle } . More formally, for the quantum circuit C, its sum over histories tree is a tree of depth m, with one level for each gate g i {\displaystyle g_{i}} in addition to the root, and with branching factor 2 n {\displaystyle 2^{n}} . Notice in the sum over histories algorithm to compute some amplitude α x {\displaystyle \alpha _{x}} , only one history is stored at any point in the computation. Hence, the sum over histories algorithm uses O ( n m ) {\displaystyle O(nm)} space to compute α x {\displaystyle \alpha _{x}} for any x since O ( n m ) {\displaystyle O(nm)} bits are needed to store the histories in addition to some workspace variables. Therefore, in polynomial space, we may compute ∑ x | α x | 2 {\displaystyle \sum _{x}|\alpha _{x}|^{2}} 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 B Q P ⊆ E X P {\displaystyle {\mathsf {BQP}}\subseteq {\mathsf {EXP}}} , our algorithm here takes far less space but far more time instead. In fact it takes O ( m ⋅ 2 m n ) {\displaystyle O(m\cdot 2^{mn})} time to calculate a single amplitude! === BQP and PP === A similar sum-over-histories argument can be used to show that B Q P ⊆ P P {\displaystyle {\mathsf {BQP}}\subseteq {\mathsf {PP}}} . === P and BQP === We know P ⊆ B Q P {\displaystyle {\mathsf {P}}\subseteq {\mathsf {BQP}}} , 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 == See also == Hidden subgroup problem Polynomial hierarchy (PH) Quantum complexity theory QMA, the quantum equivalent to NP. QIP, the quantum equivalent to IP. == References == == External links == Complexity Zoo link to BQP Archived 2013-06-03 at the Wayback Machine