Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

The Equivalence of Sampling and Searching


In a sampling problem, we are given an input x∈{0,1}n, and asked to sample approximately from a probability distribution \(\mathcal{D}_{x}\) over \(\operatorname{poly} ( n ) \)-bit strings. In a search problem, we are given an input x∈{0,1}n, and asked to find a member of a nonempty set A x with high probability. (An example is finding a Nash equilibrium.) In this paper, we use tools from Kolmogorov complexity to show that sampling and search problems are “essentially equivalent.” More precisely, for any sampling problem S, there exists a search problem R S such that, if \(\mathcal{C}\) is any “reasonable” complexity class, then R S is in the search version of \(\mathcal{C}\) if and only if S is in the sampling version. What makes this nontrivial is that the same R S works for every \(\mathcal{C}\).

As an application, we prove the surprising result that SampP=SampBQP if and only if FBPP=FBQP. In other words, classical computers can efficiently sample the output distribution of every quantum circuit, if and only if they can efficiently solve every search problem that quantum computers can solve.

This is a preview of subscription content, log in to check access.


  1. 1.

    Search problems are also called “relational problems,” for the historical reason that one can define such a problem using a binary relation R⊆{0,1}×{0,1}, with (x,y)∈R if and only if yA x . Another name often used is “function problems.” But that is inaccurate, since the desired output is not a function of the input, except in the special case |A x |=1. We find “search problems” to be the clearest name, and will use it throughout. The one important point to remember is that a search problem need not be an NP search problem: that is, solutions need not be efficiently verifiable.

  2. 2.

    The F in FBPP and FBQP stands for “function problem.” Here we are following the standard naming convention, even though the term “function problem” is misleading for the reason pointed out earlier.

  3. 3.

    Note that we write SampP instead of “SampBPP” because there is no chance of confusion here. Unlike with decision, promise, and relation problems, with sampling problems it does not even make sense to talk about deterministic algorithms.

  4. 4.

    This was previously done for different reasons in a cryptographic context—see for example Barak’s beautiful PhD thesis [2].

  5. 5.

    As mentioned in Sect. 1, the same argument shows that SampP=SampBQP (or equivalently, FBPP=FBQP) implies BPP=BQP. However, the converse is far from clear: we have no idea whether BPP=BQP implies SampP=SampBQP.

  6. 6.

    Note, also, that it is irrelevant whether there exists a polynomial p such that M f(n) halts in at most p(n) steps for all n. The index f(n) determines how long we need to simulate y for, not the running time of M f(n).


  1. 1.

    Aaronson, S., Arkhipov, A.: The computational complexity of linear optics. Theory Comput. 9, 143–252 (2013). Conference version in Proceedings of ACM STOC’2011. ECCC TR10-170. arXiv:1011.3245

  2. 2.

    Barak, B.: Non-black-box techniques in cryptography. Ph.D. thesis, Weizmann Institute of Science (2003).

  3. 3.

    Daskalakis, C., Goldberg, P.W., Papadimitriou, C.H.: The complexity of computing a Nash equilibrium. Commun. ACM 52(2), 89–97 (2009). Earlier version in Proceedings of STOC’2006

  4. 4.

    Gács, P.: Lecture notes on descriptional complexity and randomness (2010).

  5. 5.

    Goldreich, O.: On promise problems: a survey. In: Essays in Memory of Shimon Even, pp. 254–290 (2006). ECCC TR05-018

  6. 6.

    Li, M., Vitányi, P.M.B.: An Introduction to Kolmogorov Complexity and Its Applications, 3rd edn. Springer, Berlin (2008)

  7. 7.

    Rao, A.: Parallel repetition in projection games and a concentration bound. In: Proc. ACM STOC, pp. 1–10 (2008). ECCC TR08-013

  8. 8.

    Shor, P.W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comput. 26(5), 1484–1509 (1997). Earlier version in IEEE FOCS 1994. quant-ph/9508027

  9. 9.

    Toda, S.: PP is as hard as the polynomial-time hierarchy. SIAM J. Comput. 20(5), 865–877 (1991)

Download references


I thank Alex Arkhipov for helpful discussions that motivated this work, and Dana Moshkovitz for pointing me to Proposition 16 from [7]. I also thank the anonymous reviewers for catching a bug in the proof of Lemma 18 and for several helpful comments.

Author information

Correspondence to Scott Aaronson.

Additional information

This material is based upon work supported by the National Science Foundation under Grant No. 0844626, a TIBCO Chair, and an Alan T. Waterman award.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Aaronson, S. The Equivalence of Sampling and Searching. Theory Comput Syst 55, 281–298 (2014).

Download citation


  • Algorithmic information theory
  • Extended Church-Turing Thesis
  • FBQP
  • Function problems
  • Kolmogorov complexity
  • Quantum computing
  • Relational problems
  • Sampling problems
  • Search problems